Skip to content

Commit

Permalink
Support "BigCode"-like models
Browse files Browse the repository at this point in the history
  • Loading branch information
LLukas22 committed Jun 21, 2023
1 parent d91bdc5 commit e122489
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ rand_chacha = "0.3.1"
log = "0.4.17"
serde = "1.0.163"
serde_json = "1.0"
llm = { git = "https://github.com/rustformers/llm.git", rev="e52a102" }
llm-base = { git = "https://github.com/rustformers/llm.git",rev="e52a102" }
ggml = { git = "https://github.com/rustformers/llm.git",rev="e52a102" }
llm = { git = "https://github.com/rustformers/llm.git", rev="275ba35" }
llm-base = { git = "https://github.com/rustformers/llm.git",rev="275ba35" }
ggml = { git = "https://github.com/rustformers/llm.git",rev="275ba35" }
10 changes: 7 additions & 3 deletions llm_rs/auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,14 @@ def from_file(cls, path:Union[str,os.PathLike],

tokenizer = tokenizer_path_or_repo_id
if use_hf_tokenizer and tokenizer is None:
metadata = cls.load_metadata(path)
tokenizer = metadata.base_model
try:
metadata = cls.load_metadata(path)
tokenizer = metadata.base_model
except Exception as e:
logging.warning(f"Could not load metadata for model '{path}'!")

if tokenizer is None or tokenizer == "":
raise ValueError(f"Model file '{path}' does not have a base_model specified in its metadata file but wants to use a huggingface-tokenizer! Please specify a base_model or expilicitly specify a tokenizer via `tokenizer_path_or_repo_id`.")
logging.warning(f"Model file '{path}' does not have a base_model specified in its metadata file but wants to use a huggingface-tokenizer! Please expilicitly specify a tokenizer via `tokenizer_path_or_repo_id` if you intend to use a huggingface-tokenizer.")

model = cls._infer_model_type(path,model_type)
return model(path,session_config,tokenizer_path_or_repo_id,lora_paths,verbose)
Expand Down

0 comments on commit e122489

Please sign in to comment.