diff --git a/src/peft/peft_model.py b/src/peft/peft_model.py index e20e64d..be08ed2 100644 --- a/src/peft/peft_model.py +++ b/src/peft/peft_model.py @@ -155,7 +155,8 @@ class PeftModel(PushToHubMixin, torch.nn.Module): f"Please check that the file {WEIGHTS_NAME} is present at {model_id}." ) - adapters_weights = torch.load(filename) + adapters_weights = torch.load( + filename, map_location=torch.device("cuda" if torch.cuda.is_available() else "cpu")) # load the weights into the model model = set_peft_model_state_dict(model, adapters_weights) if getattr(model, "hf_device_map", None) is not None: