Unverified Commit 0dabb4ef authored by Michael Yang's avatar Michael Yang Committed by GitHub
Browse files

skip tokenizer.model if possible (#11050)

if tokenizer.json is already copied, skip tokenizer.model
parent 2e77aa1a
...@@ -292,6 +292,10 @@ func filesForModel(path string) ([]string, error) { ...@@ -292,6 +292,10 @@ func filesForModel(path string) ([]string, error) {
} }
files = append(files, js...) files = append(files, js...)
// only include tokenizer.model is tokenizer.json is not present
if !slices.ContainsFunc(files, func(s string) bool {
return slices.Contains(strings.Split(s, string(os.PathSeparator)), "tokenizer.json")
}) {
if tks, _ := glob(filepath.Join(path, "tokenizer.model"), "application/octet-stream"); len(tks) > 0 { if tks, _ := glob(filepath.Join(path, "tokenizer.model"), "application/octet-stream"); len(tks) > 0 {
// add tokenizer.model if it exists, tokenizer.json is automatically picked up by the previous glob // add tokenizer.model if it exists, tokenizer.json is automatically picked up by the previous glob
// tokenizer.model might be a unresolved git lfs reference; error if it is // tokenizer.model might be a unresolved git lfs reference; error if it is
...@@ -300,6 +304,7 @@ func filesForModel(path string) ([]string, error) { ...@@ -300,6 +304,7 @@ func filesForModel(path string) ([]string, error) {
// some times tokenizer.model is in a subdirectory (e.g. meta-llama/Meta-Llama-3-8B) // some times tokenizer.model is in a subdirectory (e.g. meta-llama/Meta-Llama-3-8B)
files = append(files, tks...) files = append(files, tks...)
} }
}
return files, nil return files, nil
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment