fix: derive checkpoint_format from resolved local path (LoRA base weights silently not loaded)#161
Open
Rouhi-Amirreza wants to merge 1 commit into
Conversation
…ghts silently not loaded) Signed-off-by: Amirreza Rouhi <ar3755@drexel.edu>
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.
What
checkpoint_formatis computed from the configuredcheckpoint.load_pathstring, butget_checkpoint_path()may resolve a DCP-style URI to a consolidated.ptfile. The LoRA key-mapping branch is gated oncheckpoint_format == "pt", so PEFT-wrapped models (use_lora=True) load zero parameters under the non-strict load and train from random init — with no error raised. This derives the format from the resolved file instead.Fixes #160. Also matches the long-standing symptom reported in
nvidia-cosmos/cosmos-predict2#176(LoRA model produces identical/degenerate results vs. base; checkpoint-loading warnings).Change
One conditional in
cosmos_predict2/_src/predict2/utils/model_loader.py, immediately after theget_checkpoint_path(...)resolution:Verification
Cosmos-Predict2.5-2B LoRA post-training (rank 32, single H100), per the issue's reproduction:
_IncompatibleKeys(missing_keys=[<all base params>]), no LoRA-mapping lineMapped 689 LoRA keys from checkpoint to modelNo behavior change for runs whose
load_pathalready ends in.pt(the condition only promotesdcp→ptwhen the resolved file is a.pt).