Don't use low_cpu_mem_usage and device_map together

This commit is contained in:
oobabooga 2023-01-31 13:24:05 -03:00
parent 824329749d
commit bb77f20a6c

View File

@ -87,10 +87,11 @@ def load_model(model_name):
model = AutoModelForCausalLM.from_pretrained(Path(f"models/{model_name}"), low_cpu_mem_usage=True, torch_dtype=torch.float16).cuda()
# Custom
else:
settings = ["low_cpu_mem_usage=True"]
command = "AutoModelForCausalLM.from_pretrained"
settings = []
if args.cpu:
settings.append("low_cpu_mem_usage=True")
settings.append("torch_dtype=torch.float32")
else:
settings.append("device_map='auto'")