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
8a9bb0d0
Unverified
Commit
8a9bb0d0
authored
Oct 31, 2024
by
Daniel Hiltgen
Committed by
GitHub
Oct 31, 2024
Browse files
Add basic mllama integration tests (#7455)
parent
26acdcf4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletion
+28
-1
integration/llm_image_test.go
integration/llm_image_test.go
+28
-1
No files found.
integration/llm_image_test.go
View file @
8a9bb0d0
...
@@ -12,7 +12,7 @@ import (
...
@@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
)
)
func
TestIntegration
Multimodal
(
t
*
testing
.
T
)
{
func
TestIntegration
Llava
(
t
*
testing
.
T
)
{
image
,
err
:=
base64
.
StdEncoding
.
DecodeString
(
imageEncoding
)
image
,
err
:=
base64
.
StdEncoding
.
DecodeString
(
imageEncoding
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
req
:=
api
.
GenerateRequest
{
req
:=
api
.
GenerateRequest
{
...
@@ -39,6 +39,33 @@ func TestIntegrationMultimodal(t *testing.T) {
...
@@ -39,6 +39,33 @@ func TestIntegrationMultimodal(t *testing.T) {
DoGenerate
(
ctx
,
t
,
client
,
req
,
[]
string
{
resp
},
120
*
time
.
Second
,
30
*
time
.
Second
)
DoGenerate
(
ctx
,
t
,
client
,
req
,
[]
string
{
resp
},
120
*
time
.
Second
,
30
*
time
.
Second
)
}
}
func
TestIntegrationMllama
(
t
*
testing
.
T
)
{
image
,
err
:=
base64
.
StdEncoding
.
DecodeString
(
imageEncoding
)
require
.
NoError
(
t
,
err
)
req
:=
api
.
GenerateRequest
{
// TODO fix up once we publish the final image
Model
:
"x/llama3.2-vision"
,
Prompt
:
"what does the text in this image say?"
,
Stream
:
&
stream
,
Options
:
map
[
string
]
interface
{}{
"seed"
:
42
,
"temperature"
:
0.0
,
},
Images
:
[]
api
.
ImageData
{
image
,
},
}
resp
:=
"the ollamas"
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
5
*
time
.
Minute
)
defer
cancel
()
client
,
_
,
cleanup
:=
InitServerConnection
(
ctx
,
t
)
defer
cleanup
()
require
.
NoError
(
t
,
PullIfMissing
(
ctx
,
client
,
req
.
Model
))
// mllama models on CPU can be quite slow to start,
DoGenerate
(
ctx
,
t
,
client
,
req
,
[]
string
{
resp
},
240
*
time
.
Second
,
30
*
time
.
Second
)
}
const
imageEncoding
=
`iVBORw0KGgoAAAANSUhEUgAAANIAAAB4CAYAAACHHqzKAAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEb
const
imageEncoding
=
`iVBORw0KGgoAAAANSUhEUgAAANIAAAB4CAYAAACHHqzKAAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEb
AAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAANKgAwAEAAAAAQAA
AAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAANKgAwAEAAAAAQAA
AHgAAAAAXdsepgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6
AHgAAAAAXdsepgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6
...
...
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