mirror of
https://github.com/ollama/ollama.git
synced 2025-04-13 14:19:23 +02:00
close temporary context
This commit is contained in:
parent
efa75659c3
commit
2fce80288f
@ -112,8 +112,10 @@ func (m *TextModel) Forward(ctx ml.Context, inputs, positions, outputs ml.Tensor
|
||||
row := image.Multimodal.(*imageRow)
|
||||
row.parent.dataOnce.Do(func() {
|
||||
// use a new, throwaway context so the image tensor is not added to the graph
|
||||
m.Backend().NewContext().Forward(row.parent.tensor).Compute(row.parent.tensor)
|
||||
temp := m.Backend().NewContext()
|
||||
temp.Forward(row.parent.tensor).Compute(row.parent.tensor)
|
||||
row.parent.data = row.parent.tensor.Floats()
|
||||
temp.Close()
|
||||
})
|
||||
|
||||
imageFeature, err := ctx.Input().FromFloatSlice(row.data(), row.shape...)
|
||||
|
Loading…
x
Reference in New Issue
Block a user