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
9d2a20a7
Commit
9d2a20a7
authored
Mar 10, 2025
by
Michael Yang
Browse files
use non-causal mask for inputs with images
parent
2e54d72f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
model/models/gemma3/model_text.go
model/models/gemma3/model_text.go
+5
-0
No files found.
model/models/gemma3/model_text.go
View file @
9d2a20a7
...
@@ -181,6 +181,11 @@ func (m *TextModel) Forward(ctx ml.Context, inputs, positions, outputs ml.Tensor
...
@@ -181,6 +181,11 @@ func (m *TextModel) Forward(ctx ml.Context, inputs, positions, outputs ml.Tensor
visionOutputs
:=
multimodal
[
0
]
.
Multimodal
.
(
ml
.
Tensor
)
visionOutputs
:=
multimodal
[
0
]
.
Multimodal
.
(
ml
.
Tensor
)
offset
:=
multimodal
[
0
]
.
Index
-
1
-
visionOutputs
.
Dim
(
1
)
offset
:=
multimodal
[
0
]
.
Index
-
1
-
visionOutputs
.
Dim
(
1
)
hiddenState
=
hiddenState
.
Set
(
ctx
,
visionOutputs
,
offset
*
hiddenState
.
Stride
(
1
))
hiddenState
=
hiddenState
.
Set
(
ctx
,
visionOutputs
,
offset
*
hiddenState
.
Stride
(
1
))
if
causal
,
ok
:=
cache
.
(
*
kvcache
.
WrapperCache
)
.
UnderlyingCache
()
.
(
*
kvcache
.
Causal
);
ok
{
causal
.
SetCausal
(
ctx
,
false
)
defer
causal
.
SetCausal
(
ctx
,
true
)
}
}
}
for
i
,
layer
:=
range
m
.
Layers
{
for
i
,
layer
:=
range
m
.
Layers
{
...
...
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