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
0dabb4ef
Unverified
Commit
0dabb4ef
authored
Jun 11, 2025
by
Michael Yang
Committed by
GitHub
Jun 11, 2025
Browse files
skip tokenizer.model if possible (#11050)
if tokenizer.json is already copied, skip tokenizer.model
parent
2e77aa1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
parser/parser.go
parser/parser.go
+12
-7
No files found.
parser/parser.go
View file @
0dabb4ef
...
@@ -292,13 +292,18 @@ func filesForModel(path string) ([]string, error) {
...
@@ -292,13 +292,18 @@ func filesForModel(path string) ([]string, error) {
}
}
files
=
append
(
files
,
js
...
)
files
=
append
(
files
,
js
...
)
if
tks
,
_
:=
glob
(
filepath
.
Join
(
path
,
"tokenizer.model"
),
"application/octet-stream"
);
len
(
tks
)
>
0
{
// only include tokenizer.model is tokenizer.json is not present
// add tokenizer.model if it exists, tokenizer.json is automatically picked up by the previous glob
if
!
slices
.
ContainsFunc
(
files
,
func
(
s
string
)
bool
{
// tokenizer.model might be a unresolved git lfs reference; error if it is
return
slices
.
Contains
(
strings
.
Split
(
s
,
string
(
os
.
PathSeparator
)),
"tokenizer.json"
)
files
=
append
(
files
,
tks
...
)
})
{
}
else
if
tks
,
_
:=
glob
(
filepath
.
Join
(
path
,
"**/tokenizer.model"
),
"text/plain"
);
len
(
tks
)
>
0
{
if
tks
,
_
:=
glob
(
filepath
.
Join
(
path
,
"tokenizer.model"
),
"application/octet-stream"
);
len
(
tks
)
>
0
{
// some times tokenizer.model is in a subdirectory (e.g. meta-llama/Meta-Llama-3-8B)
// add tokenizer.model if it exists, tokenizer.json is automatically picked up by the previous glob
files
=
append
(
files
,
tks
...
)
// tokenizer.model might be a unresolved git lfs reference; error if it is
files
=
append
(
files
,
tks
...
)
}
else
if
tks
,
_
:=
glob
(
filepath
.
Join
(
path
,
"**/tokenizer.model"
),
"text/plain"
);
len
(
tks
)
>
0
{
// some times tokenizer.model is in a subdirectory (e.g. meta-llama/Meta-Llama-3-8B)
files
=
append
(
files
,
tks
...
)
}
}
}
return
files
,
nil
return
files
,
nil
...
...
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