modelscope / modelscope/ms-swift

Qwen2.5VL resume_from_checkpoint key mismatch

Open
#7,947 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug stale
Dominant language
Python
Stars
15.7k
Forks
1.7k
Avg merge
1d 16h
Merged PRs (30d)
136

Description

Checklist / 检查清单
  • I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。
Bug Description / Bug 描述

当transformers版本大于4.52的时候,训练Qwen2.5VL并保存ckpt会保存为self.visual和self.model,而resume的时候模型会初始化为self.model.visual和self.model.language_model,从而导致resume_from_checkpoint会报提示key mismatch,无法加载前一次训练的ckpt模型

[补充]:开启deepspeed之后不会报key mismatch的信息,不确定是否正确加载了

How to Reproduce / 如何复现

transformers>=4.52,Qwen2.5VL训练时resume_from_checkpoint

Additional Information / 补充信息

部分mismatch信息:
Image

Image resume loss从最高点开始降: Image Image

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing Qwen2.5VL training and resume_from_checkpoint with transformers >=4.52, then compare the checkpoint keys saved before and after model initialization. Verify whether the reported self.visual versus self.model.visual and self.model.language_model mismatch prevents correct loading, including the deepspeed case; done means resuming loads the prior checkpoint without mismatches and preserves training state.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.