Merge pull request #210 from rohvani/pt-path-changes

Add llama-65b-4bit.pt support
This commit is contained in:
oobabooga 2023-03-10 11:04:56 -03:00 committed by GitHub
commit e01da4097c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,16 +97,23 @@ def load_model(model_name):
pt_model = '' pt_model = ''
if path_to_model.name.lower().startswith('llama-7b'): if path_to_model.name.lower().startswith('llama-7b'):
pt_model = 'llama-7b-4bit.pt' pt_model = 'llama-7b-4bit.pt'
if path_to_model.name.lower().startswith('llama-13b'): elif path_to_model.name.lower().startswith('llama-13b'):
pt_model = 'llama-13b-4bit.pt' pt_model = 'llama-13b-4bit.pt'
if path_to_model.name.lower().startswith('llama-30b'): elif path_to_model.name.lower().startswith('llama-30b'):
pt_model = 'llama-30b-4bit.pt' pt_model = 'llama-30b-4bit.pt'
elif path_to_model.name.lower().startswith('llama-65b'):
pt_model = 'llama-65b-4bit.pt'
else:
pt_model = f'{model_name}-4bit.pt'
if not Path(f"models/{pt_model}").exists(): # Try to find the .pt both in models/ and in the subfolder
print(f"Could not find models/{pt_model}, exiting...") pt_path = None
exit() for path in [Path(p) for p in [f"models/{pt_model}", f"{path_to_model}/{pt_model}"]]:
elif pt_model == '': if path.exists():
print(f"Could not find the .pt model for {model_name}, exiting...") pt_path = path
if not pt_path:
print(f"Could not find {pt_model}, exiting...")
exit() exit()
model = load_quant(path_to_model, Path(f"models/{pt_model}"), 4) model = load_quant(path_to_model, Path(f"models/{pt_model}"), 4)