Skip to content

Fix: model_type may not read properly when it's not provided in training args #5078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions swift/llm/model/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,10 @@ def _get_model_info(model_dir: str, model_type: Optional[str], quantization_conf

if model_type is None:
model_type = _read_args_json_model_type(model_dir)
# check config first
if model_type is None:
if model_type is None:
model_type = HfConfigFactory.get_config_attr(config, 'model_type') or None
if model_type is None:
architectures = HfConfigFactory.get_config_attr(config, 'architectures')
model_types = get_matched_model_types(architectures)
Expand Down