mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-26 01:30:20 +01:00
Don't use low_cpu_mem_usage and device_map together
This commit is contained in:
parent
824329749d
commit
bb77f20a6c
@ -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()
|
model = AutoModelForCausalLM.from_pretrained(Path(f"models/{model_name}"), low_cpu_mem_usage=True, torch_dtype=torch.float16).cuda()
|
||||||
# Custom
|
# Custom
|
||||||
else:
|
else:
|
||||||
settings = ["low_cpu_mem_usage=True"]
|
|
||||||
command = "AutoModelForCausalLM.from_pretrained"
|
command = "AutoModelForCausalLM.from_pretrained"
|
||||||
|
settings = []
|
||||||
|
|
||||||
if args.cpu:
|
if args.cpu:
|
||||||
|
settings.append("low_cpu_mem_usage=True")
|
||||||
settings.append("torch_dtype=torch.float32")
|
settings.append("torch_dtype=torch.float32")
|
||||||
else:
|
else:
|
||||||
settings.append("device_map='auto'")
|
settings.append("device_map='auto'")
|
||||||
@ -374,7 +375,7 @@ if args.chat or args.cai_chat:
|
|||||||
reply = reply[idx + 1 + len(apply_extensions(f"{current}:", "bot_prefix")):]
|
reply = reply[idx + 1 + len(apply_extensions(f"{current}:", "bot_prefix")):]
|
||||||
else:
|
else:
|
||||||
reply = reply[idx + 1 + len(f"{current}:"):]
|
reply = reply[idx + 1 + len(f"{current}:"):]
|
||||||
|
|
||||||
if check:
|
if check:
|
||||||
reply = reply.split('\n')[0].strip()
|
reply = reply.split('\n')[0].strip()
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user