Parcourir la source

Don't require GPT-J to be installed to load gpt4chan

oobabooga il y a 3 ans
Parent
commit
a751d7e693
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      server.py

+ 1 - 1
server.py

@@ -47,7 +47,7 @@ def load_model(model_name):
         model = AutoModelForCausalLM.from_pretrained(Path(f"models/{model_name}"), low_cpu_mem_usage=True, torch_dtype=dtype)
 
     # Loading the tokenizer
-    if model_name.lower().startswith('gpt4chan'):
+    if model_name.lower().startswith('gpt4chan') and Path(f"models/gpt-j-6B/").exists():
         tokenizer = AutoTokenizer.from_pretrained(Path("models/gpt-j-6B/"))
     elif model_name in ['flan-t5', 't5-large']:
         tokenizer = T5Tokenizer.from_pretrained(Path(f"models/{model_name}/"))