Skip to content

Commit c34b128

Browse files
authored
fix citest (#2953)
1 parent 3f83691 commit c34b128

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

swift/llm/model/register.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,11 @@ def get_model_tokenizer_from_local(model_dir: str,
210210
model = automodel_class.from_pretrained(
211211
model_dir, config=model_config, torch_dtype=torch_dtype, trust_remote_code=True, **model_kwargs)
212212

213-
# fix not save modeling_xxx.py (transformers 4.45)
214-
# https://github.com/huggingface/transformers/issues/24737
215-
has_remote_code = hasattr(model_config, 'auto_map') and automodel_class.__name__ in model_config.auto_map
216-
if model is not None and has_remote_code and model._auto_class is None:
217-
model._auto_class = automodel_class.__name__
213+
# fix not save modeling_xxx.py (transformers 4.45)
214+
# https://github.com/huggingface/transformers/issues/24737
215+
has_remote_code = hasattr(model_config, 'auto_map') and automodel_class.__name__ in model_config.auto_map
216+
if has_remote_code and model._auto_class is None:
217+
model._auto_class = automodel_class.__name__
218218
return model, tokenizer
219219

220220

0 commit comments

Comments
 (0)