Skip to content

Commit

Permalink
Make sure that LoRAs are loaded to the correct device
Browse files Browse the repository at this point in the history
  • Loading branch information
asagi4 committed Aug 22, 2024
1 parent 42acef7 commit 2930f03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions prompt_control/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ def _patch_model(model, forget=False, orig=None, offload_to_cpu=False):
if offload_to_cpu:
saved_offload = model.offload_device
model.offload_device = torch.device("cpu")
log.info("Patching model, cpu_offload=%s", model.offload_device == torch.device("cpu"))
log.info("Patching model, model.load_device=%s model.model.device=%s cpu_offload=%s", model.load_device, model.model.device, model.offload_device == torch.device("cpu"))
if orig:
model.backup = orig.backup
model.patch_model()
model.patch_model(device_to=model.load_device)
if offload_to_cpu:
model.offload_device = saved_offload
if forget:
Expand Down

0 comments on commit 2930f03

Please sign in to comment.