mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-10-01 01:26:03 -04:00
Better recognize the model sizes
This commit is contained in:
parent
62c4d9880b
commit
342e756878
@ -30,7 +30,7 @@ def load_model(model_name):
|
|||||||
print("Loading in .pt format...")
|
print("Loading in .pt format...")
|
||||||
model = torch.load(f"torch-dumps/{model_name}.pt").cuda()
|
model = torch.load(f"torch-dumps/{model_name}.pt").cuda()
|
||||||
elif model_name.lower().startswith(('gpt-neo', 'opt-', 'galactica')):
|
elif model_name.lower().startswith(('gpt-neo', 'opt-', 'galactica')):
|
||||||
if any(size in model_name for size in ('13b', '20b', '30b')):
|
if any(size in model_name.lower() for size in ('13b', '20b', '30b')):
|
||||||
model = AutoModelForCausalLM.from_pretrained(f"models/{model_name}", device_map='auto', load_in_8bit=True)
|
model = AutoModelForCausalLM.from_pretrained(f"models/{model_name}", device_map='auto', load_in_8bit=True)
|
||||||
else:
|
else:
|
||||||
model = AutoModelForCausalLM.from_pretrained(f"models/{model_name}", low_cpu_mem_usage=True, torch_dtype=torch.float16).cuda()
|
model = AutoModelForCausalLM.from_pretrained(f"models/{model_name}", low_cpu_mem_usage=True, torch_dtype=torch.float16).cuda()
|
||||||
|
Loading…
Reference in New Issue
Block a user