From 8b5ddedda436b40df59b0af57622de68268d3e63 Mon Sep 17 00:00:00 2001 From: younesbelkada Date: Thu, 24 Aug 2023 14:28:25 +0000 Subject: [PATCH] fix failing PEFT tests --- src/transformers/modeling_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/transformers/modeling_utils.py b/src/transformers/modeling_utils.py index fbcd136376cc..c5925467677f 100644 --- a/src/transformers/modeling_utils.py +++ b/src/transformers/modeling_utils.py @@ -2406,8 +2406,9 @@ def from_pretrained( _commit_hash=commit_hash, ) if _adapter_model_path is not None and os.path.isfile(_adapter_model_path): - with open(_adapter_model_path, "r", encoding="utf-8"): + with open(_adapter_model_path, "r", encoding="utf-8") as f: _adapter_model_path = pretrained_model_name_or_path + pretrained_model_name_or_path = json.load(f)["base_model_name_or_path"] # change device_map into a map if we passed an int, a str or a torch.device if isinstance(device_map, torch.device):