fix: preserve speaker_encoder in checkpoints to allow training resume#232
Open
haosenwang1018 wants to merge 1 commit intoQwenLM:mainfrom
Open
fix: preserve speaker_encoder in checkpoints to allow training resume#232haosenwang1018 wants to merge 1 commit intoQwenLM:mainfrom
haosenwang1018 wants to merge 1 commit intoQwenLM:mainfrom
Conversation
The speaker_encoder weights were explicitly deleted from the state dict before saving checkpoints (lines 150-153). When resuming training from a checkpoint, model.speaker_encoder becomes None, causing a crash on the first forward pass. Keep speaker_encoder in checkpoints so that training can resume correctly. Users who want smaller inference-only models can strip these weights separately. Fixes QwenLM#204 (bug 1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In
finetuning/sft_12hz.py, thespeaker_encoderweights are explicitly deleted from the state dict before saving checkpoints (lines 150-153). When training is resumed from one of these checkpoints,model.speaker_encoderisNone, causing a crash on the first forward pass.Related to #204 (bug 1: "Speaker encoder is removed from checkpoints – breaks resume")
Root Cause
Fix
Remove the
speaker_encoderdeletion. Checkpoints now include all model weights, allowing training to resume correctly. Users who need smaller inference-only exports can strip the speaker_encoder weights in a separate post-processing step.Impact