mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-26 01:30:20 +01:00
Fix LoRA in CPU mode
This commit is contained in:
parent
eac27f4f55
commit
29bd41d453
@ -18,10 +18,10 @@ def add_lora_to_model(lora_name):
|
|||||||
params = {}
|
params = {}
|
||||||
if shared.args.load_in_8bit:
|
if shared.args.load_in_8bit:
|
||||||
params['device_map'] = {'': 0}
|
params['device_map'] = {'': 0}
|
||||||
else:
|
elif not shared.args.cpu:
|
||||||
params['device_map'] = 'auto'
|
params['device_map'] = 'auto'
|
||||||
params['dtype'] = shared.model.dtype
|
params['dtype'] = shared.model.dtype
|
||||||
|
|
||||||
shared.model = PeftModel.from_pretrained(shared.model, Path(f"loras/{lora_name}"), **params)
|
shared.model = PeftModel.from_pretrained(shared.model, Path(f"loras/{lora_name}"), **params)
|
||||||
if not shared.args.load_in_8bit:
|
if not shared.args.load_in_8bit and not shared.args.cpu:
|
||||||
shared.model.half()
|
shared.model.half()
|
||||||
|
Loading…
Reference in New Issue
Block a user