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
f63e62e5
Commit
f63e62e5
authored
Mar 11, 2025
by
jmorganca
Committed by
Michael Yang
Mar 11, 2025
Browse files
reduce kernel size, add TODO for loading from config
parent
65b0f329
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
model/models/gemma3/model.go
model/models/gemma3/model.go
+5
-1
No files found.
model/models/gemma3/model.go
View file @
f63e62e5
...
...
@@ -90,7 +90,11 @@ func (m *Model) EncodeMultimodal(ctx ml.Context, multimodalData []byte) (any, er
visionOutputs
:=
m
.
VisionModel
.
Forward
(
ctx
,
pixelValues
)
visionOutputs
=
visionOutputs
.
Permute
(
ctx
,
1
,
0
,
2
,
3
)
.
Contiguous
(
ctx
)
patchesPerImage
:=
m
.
ImageProcessor
.
imageSize
/
m
.
ImageProcessor
.
patchSize
kernelSize
:=
patchesPerImage
*
patchesPerImage
/
256
// TODO (jmorganca): read this from the model config
// it should instead be math.Sqrt(tokens per image)
tokensPerSide
:=
8
kernelSize
:=
patchesPerImage
/
tokensPerSide
visionOutputs
=
visionOutputs
.
AvgPool1D
(
ctx
,
kernelSize
,
kernelSize
,
0
)
visionOutputs
=
visionOutputs
.
Permute
(
ctx
,
1
,
0
,
2
,
3
)
.
Contiguous
(
ctx
)
...
...
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