Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
cf50ef5b
Unverified
Commit
cf50ef5b
authored
Dec 22, 2023
by
Daniel Hiltgen
Committed by
GitHub
Dec 22, 2023
Browse files
Merge pull request #1684 from dhiltgen/tag_integration_tests
Guard integration tests with a tag
parents
10da41d6
697bea69
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
5 deletions
+15
-5
scripts/setup_integration_tests.sh
scripts/setup_integration_tests.sh
+7
-4
server/llm_image_test.go
server/llm_image_test.go
+2
-0
server/llm_test.go
server/llm_test.go
+2
-0
server/llm_utils_test.go
server/llm_utils_test.go
+4
-1
No files found.
scripts/setup_integration_tests.sh
View file @
cf50ef5b
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
# This script sets up integration tests which run the full stack to verify
# This script sets up integration tests which run the full stack to verify
# inference locally
# inference locally
#
# To run the relevant tests use
# go test -tags=integration ./server
set
-e
set
-e
set
-o
pipefail
set
-o
pipefail
...
@@ -21,15 +24,15 @@ for model in ${TEST_MODELS[@]}; do
...
@@ -21,15 +24,15 @@ for model in ${TEST_MODELS[@]}; do
echo
"Pulling manifest for
${
TEST_MODEL
}
:
${
TEST_MODEL_TAG
}
"
echo
"Pulling manifest for
${
TEST_MODEL
}
:
${
TEST_MODEL_TAG
}
"
curl
-s
--header
"
${
ACCEPT_HEADER
}
"
\
curl
-s
--header
"
${
ACCEPT_HEADER
}
"
\
-o
${
OLLAMA_MODELS
}
/manifests/
${
REGISTRY
}
/
${
TEST_MODEL
}
/
${
TEST_MODEL_TAG
}
\
-o
${
OLLAMA_MODELS
}
/manifests/
${
REGISTRY
}
/
${
TEST_MODEL
}
/
${
TEST_MODEL_TAG
}
\
${
REGISTRY_SCHEME
}
://
${
REGISTRY
}
/v2/
${
TEST_MODEL
}
/manifests/
${
TEST_MODEL_TAG
}
${
REGISTRY_SCHEME
}
://
${
REGISTRY
}
/v2/
${
TEST_MODEL
}
/manifests/
${
TEST_MODEL_TAG
}
CFG_HASH
=
$(
cat
${
OLLAMA_MODELS
}
/manifests/
${
REGISTRY
}
/
${
TEST_MODEL
}
/
${
TEST_MODEL_TAG
}
| jq
-r
".config.digest"
)
CFG_HASH
=
$(
cat
${
OLLAMA_MODELS
}
/manifests/
${
REGISTRY
}
/
${
TEST_MODEL
}
/
${
TEST_MODEL_TAG
}
| jq
-r
".config.digest"
)
echo
"Pulling config blob
${
CFG_HASH
}
"
echo
"Pulling config blob
${
CFG_HASH
}
"
curl
-L
-C
-
--header
"
${
ACCEPT_HEADER
}
"
\
curl
-L
-C
-
--header
"
${
ACCEPT_HEADER
}
"
\
-o
${
OLLAMA_MODELS
}
/blobs/
${
CFG_HASH
}
\
-o
${
OLLAMA_MODELS
}
/blobs/
${
CFG_HASH
}
\
${
REGISTRY_SCHEME
}
://
${
REGISTRY
}
/v2/
${
TEST_MODEL
}
/blobs/
${
CFG_HASH
}
${
REGISTRY_SCHEME
}
://
${
REGISTRY
}
/v2/
${
TEST_MODEL
}
/blobs/
${
CFG_HASH
}
for
LAYER
in
$(
cat
${
OLLAMA_MODELS
}
/manifests/
${
REGISTRY
}
/
${
TEST_MODEL
}
/
${
TEST_MODEL_TAG
}
| jq
-r
".layers[].digest"
)
;
do
for
LAYER
in
$(
cat
${
OLLAMA_MODELS
}
/manifests/
${
REGISTRY
}
/
${
TEST_MODEL
}
/
${
TEST_MODEL_TAG
}
| jq
-r
".layers[].digest"
)
;
do
echo
"Pulling blob
${
LAYER
}
"
echo
"Pulling blob
${
LAYER
}
"
curl
-L
-C
-
--header
"
${
ACCEPT_HEADER
}
"
\
curl
-L
-C
-
--header
"
${
ACCEPT_HEADER
}
"
\
-o
${
OLLAMA_MODELS
}
/blobs/
${
LAYER
}
\
-o
${
OLLAMA_MODELS
}
/blobs/
${
LAYER
}
\
...
...
server/llm_image_test.go
View file @
cf50ef5b
//go:build integration
package
server
package
server
import
(
import
(
...
...
server/llm_test.go
View file @
cf50ef5b
//go:build integration
package
server
package
server
import
(
import
(
...
...
server/llm_utils_test.go
View file @
cf50ef5b
//go:build integration
package
server
package
server
import
(
import
(
...
@@ -38,7 +40,7 @@ func PrepareModelForPrompts(t *testing.T, modelName string, opts api.Options) (*
...
@@ -38,7 +40,7 @@ func PrepareModelForPrompts(t *testing.T, modelName string, opts api.Options) (*
}
}
func
OneShotPromptResponse
(
t
*
testing
.
T
,
ctx
context
.
Context
,
req
api
.
GenerateRequest
,
model
*
Model
,
runner
llm
.
LLM
)
string
{
func
OneShotPromptResponse
(
t
*
testing
.
T
,
ctx
context
.
Context
,
req
api
.
GenerateRequest
,
model
*
Model
,
runner
llm
.
LLM
)
string
{
prompt
,
err
:=
model
.
Prompt
(
PromptVars
{
prompt
,
err
:=
model
.
PreResponse
Prompt
(
PromptVars
{
System
:
req
.
System
,
System
:
req
.
System
,
Prompt
:
req
.
Prompt
,
Prompt
:
req
.
Prompt
,
First
:
len
(
req
.
Context
)
==
0
,
First
:
len
(
req
.
Context
)
==
0
,
...
@@ -54,6 +56,7 @@ func OneShotPromptResponse(t *testing.T, ctx context.Context, req api.GenerateRe
...
@@ -54,6 +56,7 @@ func OneShotPromptResponse(t *testing.T, ctx context.Context, req api.GenerateRe
success
<-
true
success
<-
true
}
}
}
}
predictReq
:=
llm
.
PredictOpts
{
predictReq
:=
llm
.
PredictOpts
{
Prompt
:
prompt
,
Prompt
:
prompt
,
Format
:
req
.
Format
,
Format
:
req
.
Format
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment