Repository navigation
refactor(trainer)!: fold multimodal into trainer/vlm.py; one VLM registry; drop vlm attr fields #3861
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
refactor(trainer)!: fold multimodal into trainer/vlm.py; one VLM registry; drop vlm attr fields #3861
Changes from 7 commits
770b2e6
c9aa101
6113c9a
24447b9
969672e
eaf0ef0
82a65e9
a976bd3
44e9418
fef8808
fecaf4e
5130274
34388d1
f7af0f8
2fc44f4
4028409
bba4004
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
| ResumeConfig, | ||
| TrainerLogConfig, | ||
| TransportConfig, | ||
| VLMConfig, | ||
| WeightBroadcastConfig, | ||
| ZMQTransportConfig, | ||
| ) | ||
|
|
@@ -262,6 +263,9 @@ class MoERuntimeConfig(BaseConfig): | |
|
|
||
|
|
||
| class ModelConfig(BaseModelConfig): | ||
| vlm: VLMConfig | None = None | ||
| """VLM configuration. Setting this enables vision-language model support.""" | ||
|
|
||
| conversion_dir: Path | None = None | ||
| """Directory for the auto-converted weights (written to a `prime`/`hf` subdirectory). If not set, we write into the model snapshot directory.""" | ||
|
|
||
|
|
@@ -330,6 +334,16 @@ class ModelConfig(BaseModelConfig): | |
| fused_lm_head_token_chunk_size: int | Literal["disabled"] = 8192 | ||
| """Flattened token chunk size for the fused LM head. ``int >= 1`` sets the tokens per LM-head chunk explicitly; ``disabled`` uses the vanilla LM head. In SFT the fused head computes the summed cross-entropy and its gradients chunk by chunk, holding one chunk's full-vocab logits at a time.""" | ||
|
|
||
| @model_validator(mode="after") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason we still validate it? |
||
| def validate_vlm(self): | ||
| if self.vlm is None: | ||
| return self | ||
| if self.optimization_dtype != "bfloat16" or self.reduce_dtype != "bfloat16": | ||
| raise ValueError( | ||
| "VLM models must use optimization_dtype='bfloat16' and reduce_dtype='bfloat16' to match vLLM inference." | ||
| ) | ||
| return self | ||
|
|
||
| @model_validator(mode="after") | ||
| def validate_cp(self): | ||
| if self.cp > 1 and self.attn not in ["flash_attention_2", "flash_attention_3", "flash_attention_4", "auto"]: | ||
|
|
||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.