Fix LoRA in CPU mode
This commit is contained in:
parent
eac27f4f55
commit
29bd41d453
1 changed files with 2 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue