Update models.py (#3020)
Hopefully fixed error with "ValueError: Tokenizer class GPTNeoXTokenizer does not exist or is not currently imported."
This commit is contained in:
parent
b67c362735
commit
ff45317032
1 changed files with 12 additions and 5 deletions
|
@ -95,11 +95,18 @@ def load_tokenizer(model_name, model):
|
||||||
if any(s in model_name.lower() for s in ['gpt-4chan', 'gpt4chan']) and Path(f"{shared.args.model_dir}/gpt-j-6B/").exists():
|
if any(s in model_name.lower() for s in ['gpt-4chan', 'gpt4chan']) and Path(f"{shared.args.model_dir}/gpt-j-6B/").exists():
|
||||||
tokenizer = AutoTokenizer.from_pretrained(Path(f"{shared.args.model_dir}/gpt-j-6B/"))
|
tokenizer = AutoTokenizer.from_pretrained(Path(f"{shared.args.model_dir}/gpt-j-6B/"))
|
||||||
elif path_to_model.exists():
|
elif path_to_model.exists():
|
||||||
tokenizer = AutoTokenizer.from_pretrained(
|
try:
|
||||||
path_to_model,
|
tokenizer = AutoTokenizer.from_pretrained(
|
||||||
trust_remote_code=shared.args.trust_remote_code,
|
path_to_model,
|
||||||
use_fast=False
|
trust_remote_code=shared.args.trust_remote_code,
|
||||||
)
|
use_fast=False
|
||||||
|
)
|
||||||
|
except ValueError:
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained(
|
||||||
|
path_to_model,
|
||||||
|
trust_remote_code=shared.args.trust_remote_code,
|
||||||
|
use_fast=True
|
||||||
|
)
|
||||||
|
|
||||||
if tokenizer.__class__.__name__ == 'LlamaTokenizer':
|
if tokenizer.__class__.__name__ == 'LlamaTokenizer':
|
||||||
pairs = [
|
pairs = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue