cookbook(finetune): document how to enable LoRA in the SFT recipes - #303
Draft
lfengad wants to merge 1 commit into
Draft
cookbook(finetune): document how to enable LoRA in the SFT recipes#303lfengad wants to merge 1 commit into
lfengad wants to merge 1 commit into
Conversation
Both finetune cookbooks ship LoRA-capable recipes but never explain how to
turn LoRA on, so anyone starting from a full fine-tune recipe has to reverse
it out of the framework's TOML schema.
Add a "LoRA fine-tuning" section to each README, written as a guide rather
than a second set of recipes: which TOML sections to touch, what each knob
does, and why. Concrete numbers appear only as examples to start from, with
the learning rate framed as "take the recipe's full-FT value and go up".
The generator section points at launch_sft_vision_super.sh and its TOML as a
ready-made LoRA recipe; the reasoner section links to the same script as the
vfm-side reference for the identical mechanism.
The two sides differ in four places, and each README covers its own:
* target module names -- q/k/v/o_proj_moe_gen (vfm) vs q/k/v/o_proj (vlm)
* lora_exclude_path_regex -- vlm only, required on the Cosmos3-Edge
backbone whose SigLIP2 tower shares projection names with the LLM
* checkpoint.keys_to_skip_loading -- vfm must add "lora_", vlm stays []
* EMA / torch.compile -- on in the vfm recipes, already off in the vlm ones
No TOML or launch shell is added; the guide converts the existing ones.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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
Adds a LoRA fine-tuning section to both finetune cookbook READMEs:
cookbooks/cosmos3/generator/audiovisual/finetune/README.mdcookbooks/cosmos3/reasoner/finetune/README.mdBoth cookbooks already ship LoRA-capable recipes, but neither explains how to turn LoRA on — today you'd have to reverse it out of the framework's TOML schema.
Approach
Written as a guide, not a second set of recipes. No new TOML or launch shell is added; the section explains how to convert an existing recipe:
lora_enabled,keys_to_select = ["lora_"],keys_to_skip_loading, EMA/compile, and the Edgelora_exclude_path_regex) — getting these wrong fails silently rather than loudlylaunch_sft_vision_super.shis surfaced in both READMEs as the ready-made LoRA recipe to read alongside: directly in the generator cookbook, and by relative link from the reasoner one as thevfm-side reference for the same mechanism.vfm vs vlm
The mechanism is identical; four things differ, and each README covers its own side:
vfm)vlm)lora_target_modulesq/k/v/o_proj_moe_genq/k/v/o_projlora_exclude_path_regexcheckpoint.keys_to_skip_loading"lora_"[](HF safetensors, not DCP)torch.compilefalseMerge order
The reasoner section depends on VLM LoRA support landing in cosmos-framework (
liangf/vlm-lora-sft) — on today'smain,PATH_REMAPS["vlm"]still skips thelora_*keys. Filed as draft for that reason; the generator section is accurate against the released framework as-is.Verification
Every claim was checked against the corresponding TOMLs, the framework source, or actual runs — including one fix caught during review: extending vfm LoRA to the FFN needs path-qualified targets (
mlp_moe_gen.up_proj), because a bareup_projalso matches the understanding tower'smlp.up_projand there is no path-exclusion knob on thevfmside.🤖 Generated with Claude Code