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
c5cbe4fc
"examples/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "3f3652e0a7e58278b1d79901b5a5987fb31ad2d9"
Commit
c5cbe4fc
authored
Mar 10, 2025
by
Michael Yang
Browse files
fallback to cpu
parent
f8889128
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
ml/backend/ggml/ggml.go
ml/backend/ggml/ggml.go
+10
-8
No files found.
ml/backend/ggml/ggml.go
View file @
c5cbe4fc
...
@@ -248,6 +248,14 @@ func New(r *os.File, params ml.BackendParams) (ml.Backend, error) {
...
@@ -248,6 +248,14 @@ func New(r *os.File, params ml.BackendParams) (ml.Backend, error) {
case
strings
.
HasPrefix
(
t
.
Name
,
"v."
)
||
strings
.
HasPrefix
(
t
.
Name
,
"mm."
)
:
case
strings
.
HasPrefix
(
t
.
Name
,
"v."
)
||
strings
.
HasPrefix
(
t
.
Name
,
"mm."
)
:
// TODO: assign vision tensors to the gpu if possible
// TODO: assign vision tensors to the gpu if possible
createTensor
(
tensor
{
source
:
t
},
input
.
bts
)
createTensor
(
tensor
{
source
:
t
},
input
.
bts
)
case
contains
(
t
.
Name
,
"rope_freqs"
,
"rope_factors_long"
,
"rope_factors_short"
)
:
// these tensors should be repeated per layer
for
i
,
layer
:=
range
layers
{
createTensor
(
tensor
{
source
:
t
,
target
:
"blk."
+
strconv
.
Itoa
(
i
)
+
"."
+
t
.
Name
,
},
layer
.
bts
)
}
default
:
default
:
layerIndex
:=
-
1
layerIndex
:=
-
1
if
fields
:=
strings
.
FieldsFunc
(
t
.
Name
,
func
(
r
rune
)
bool
{
return
!
unicode
.
IsNumber
(
r
)
});
len
(
fields
)
>
0
{
if
fields
:=
strings
.
FieldsFunc
(
t
.
Name
,
func
(
r
rune
)
bool
{
return
!
unicode
.
IsNumber
(
r
)
});
len
(
fields
)
>
0
{
...
@@ -259,14 +267,8 @@ func New(r *os.File, params ml.BackendParams) (ml.Backend, error) {
...
@@ -259,14 +267,8 @@ func New(r *os.File, params ml.BackendParams) (ml.Backend, error) {
if
layerIndex
>=
0
{
if
layerIndex
>=
0
{
createTensor
(
tensor
{
source
:
t
},
layers
[
layerIndex
]
.
bts
)
createTensor
(
tensor
{
source
:
t
},
layers
[
layerIndex
]
.
bts
)
}
else
{
}
else
{
// this is a repeating tensor that doesn't explicitly associated with a layer so
// load all other tensors on the cpu
// duplicate it for each layer
createTensor
(
tensor
{
source
:
t
},
input
.
bts
)
for
i
,
layer
:=
range
layers
{
createTensor
(
tensor
{
source
:
t
,
target
:
"blk."
+
strconv
.
Itoa
(
i
)
+
"."
+
t
.
Name
,
},
layer
.
bts
)
}
}
}
}
}
}
}
...
...
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