From 00a09ed448082da3d6d35fb23a37b7d04f7b4dcd Mon Sep 17 00:00:00 2001 From: Arthur Zucker Date: Mon, 25 Mar 2024 21:57:31 +0900 Subject: [PATCH] =?UTF-8?q?fix=20=F0=9F=98=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/transformers/modeling_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/transformers/modeling_utils.py b/src/transformers/modeling_utils.py index 263ae5d2f98..315e6004f3a 100644 --- a/src/transformers/modeling_utils.py +++ b/src/transformers/modeling_utils.py @@ -600,7 +600,9 @@ def _load_state_dict_into_model(model_to_load, state_dict, start_prefix): # so we need to apply the function recursively. def load(module: nn.Module, state_dict, prefix=""): local_metadata = {} if metadata is None else metadata.get(prefix[:-1], {}) - args = (state_dict, prefix, local_metadata, True, [], [], error_msgs) + unexpected_keys = [] + missing_keys = [] + args = (state_dict, prefix, local_metadata, True, missing_keys, unexpected_keys, error_msgs) # Parameters of module and children will start with prefix. We can exit early if there are none in this # state_dict if len([key for key in state_dict if key.startswith(prefix)]) > 0: