bridge.recipes.qwen_vl.qwen3_vl#
Module Contents#
Classes#
Typed options accepted by Qwen3 VL MoE recipe helpers. |
Functions#
Return a pre-training config for Qwen3-VL 8B Instruct. |
|
Return a pre-training config for Qwen3-VL-30B-A3B-Instruct. |
|
Return a pre-training config for Qwen3-VL-235B-A22B-Instruct. |
|
Return a fine-tuning config for Qwen3-VL 8B Instruct. |
|
Return a fine-tuning config for Qwen3-VL-30B-A3B-Instruct. |
|
Return a fine-tuning config for Qwen3-VL-235B-A22B-Instruct. |
|
Create a pre-training configuration for Qwen3 MoE models using a given HuggingFace path. |
API#
- class bridge.recipes.qwen_vl.qwen3_vl.Qwen3VLCommonKwargs#
Bases:
typing_extensions.TypedDictTyped options accepted by Qwen3 VL MoE recipe helpers.
Initialization
Initialize self. See help(type(self)) for accurate signature.
- hf_path: str#
None
- dir: Optional[str]#
None
- name: str#
None
- data_paths: Optional[List[str]]#
None
- data_args_path: Optional[str]#
None
- train_data_path: Optional[List[str]]#
None
- valid_data_path: Optional[List[str]]#
None
- test_data_path: Optional[List[str]]#
None
- per_split_data_args_path: Optional[str]#
None
- mock: bool#
None
- tensor_model_parallel_size: int#
None
- pipeline_model_parallel_size: int#
None
- pipeline_dtype: Optional[torch.dtype]#
None
- virtual_pipeline_model_parallel_size: Optional[int]#
None
- context_parallel_size: int#
None
- expert_model_parallel_size: Optional[int]#
None
- expert_tensor_parallel_size: int#
None
- sequence_parallel: bool#
None
- use_megatron_fsdp: bool#
None
- enable_recompute: bool#
None
- account_for_embedding_in_pipeline_split: bool#
None
- account_for_loss_in_pipeline_split: bool#
None
- train_iters: int#
None
- global_batch_size: int#
None
- micro_batch_size: int#
None
- seq_length: int#
None
- lr: float#
None
- min_lr: float#
None
- lr_warmup_iters: int#
None
- lr_decay_iters: Optional[int]#
None
- eval_interval: int#
None
- save_interval: int#
None
- use_null_tokenizer: bool#
None
- precision_config: Optional[Union[megatron.bridge.training.mixed_precision.MixedPrecisionConfig, str]]#
None
- comm_overlap_config: Optional[megatron.bridge.training.comm_overlap.CommOverlapConfig]#
None
- moe_flex_dispatcher_backend: str | None#
None
- pretrained_checkpoint: Optional[str]#
None
- freeze_language_model: bool#
None
- freeze_vision_model: bool#
None
- freeze_vision_projection: bool#
None
- dataset_type: Optional[str]#
None
- image_folder: Optional[str]#
None
- tokenizer_model: Optional[str]#
None
- peft: Optional[Union[str, megatron.bridge.peft.base.PEFT]]#
None
- finetune_lr: float#
None
- bridge.recipes.qwen_vl.qwen3_vl.qwen3_vl_8b_pretrain_config(
- **user_kwargs: typing_extensions.Unpack[bridge.recipes.qwen_vl.qwen3_vl.Qwen3VLCommonKwargs],
Return a pre-training config for Qwen3-VL 8B Instruct.
See
_qwen3_vl_commonfor the full list of parameters.
- bridge.recipes.qwen_vl.qwen3_vl.qwen3_vl_30b_a3b_pretrain_config(
- **user_kwargs: typing_extensions.Unpack[bridge.recipes.qwen_vl.qwen3_vl.Qwen3VLCommonKwargs],
Return a pre-training config for Qwen3-VL-30B-A3B-Instruct.
See
_qwen3_vl_commonfor the full list of parameters.
- bridge.recipes.qwen_vl.qwen3_vl.qwen3_vl_235b_a22b_pretrain_config(
- **user_kwargs: typing_extensions.Unpack[bridge.recipes.qwen_vl.qwen3_vl.Qwen3VLCommonKwargs],
Return a pre-training config for Qwen3-VL-235B-A22B-Instruct.
See
_qwen3_vl_commonfor the full list of parameters.
- bridge.recipes.qwen_vl.qwen3_vl.qwen3_vl_8b_finetune_config(
- **user_kwargs: typing_extensions.Unpack[bridge.recipes.qwen_vl.qwen3_vl.Qwen3VLCommonKwargs],
Return a fine-tuning config for Qwen3-VL 8B Instruct.
Default configuration: 1 node, 8 GPUs
LoRA/DoRA: TP=1, PP=1, LR=1e-4
Full SFT: TP=4, PP=1, LR=1e-5
See
_qwen3_vl_commonfor the full list of parameters.
- bridge.recipes.qwen_vl.qwen3_vl.qwen3_vl_30b_a3b_finetune_config(
- **user_kwargs: typing_extensions.Unpack[bridge.recipes.qwen_vl.qwen3_vl.Qwen3VLCommonKwargs],
Return a fine-tuning config for Qwen3-VL-30B-A3B-Instruct.
This is a Mixture-of-Experts model with 128 experts and top-8 routing. Recommended to use with expert parallelism (EP) for efficient training.
Default configuration: 1 node, 8 GPUs
LoRA/DoRA: TP=1, PP=1, EP=8, LR=2e-4
Full SFT: TP=1, PP=1, EP=8, LR=2e-5
See
_qwen3_vl_commonfor the full list of parameters.
- bridge.recipes.qwen_vl.qwen3_vl.qwen3_vl_235b_a22b_finetune_config(
- **user_kwargs: typing_extensions.Unpack[bridge.recipes.qwen_vl.qwen3_vl.Qwen3VLCommonKwargs],
Return a fine-tuning config for Qwen3-VL-235B-A22B-Instruct.
This is a Mixture-of-Experts model with 128 experts and top-8 routing. Recommended to use with expert parallelism (EP) for efficient training.
Default configuration: 4 nodes, 32 GPUs total
LoRA/DoRA: TP=1, PP=1, EP=8, LR=2e-4
Full SFT: TP=4, PP=1, EP=8, LR=2e-5
See
_qwen3_vl_commonfor the full list of parameters.
- bridge.recipes.qwen_vl.qwen3_vl._qwen3_vl_common(
- hf_path: str,
- dir: Optional[str] = None,
- name: str = 'default',
- data_paths: Optional[List[str]] = None,
- data_args_path: Optional[str] = None,
- train_data_path: Optional[List[str]] = None,
- valid_data_path: Optional[List[str]] = None,
- test_data_path: Optional[List[str]] = None,
- per_split_data_args_path: Optional[str] = None,
- mock: bool = False,
- tensor_model_parallel_size: int = 4,
- pipeline_model_parallel_size: int = 2,
- pipeline_dtype: Optional[torch.dtype] = torch.bfloat16,
- virtual_pipeline_model_parallel_size: Optional[int] = None,
- context_parallel_size: int = 1,
- expert_model_parallel_size: Optional[int] = 4,
- expert_tensor_parallel_size: int = 1,
- sequence_parallel: bool = False,
- use_megatron_fsdp: bool = False,
- enable_recompute: bool = False,
- account_for_embedding_in_pipeline_split: bool = False,
- account_for_loss_in_pipeline_split: bool = False,
- train_iters: int = 300000,
- global_batch_size: int = 32,
- micro_batch_size: int = 2,
- seq_length: int = 4096,
- lr: float = 0.0003,
- min_lr: float = 3e-05,
- lr_warmup_iters: int = 500,
- lr_decay_iters: Optional[int] = None,
- eval_interval: int = 500,
- save_interval: int = 500,
- use_null_tokenizer: bool = False,
- precision_config: Optional[Union[megatron.bridge.training.mixed_precision.MixedPrecisionConfig, str]] = None,
- comm_overlap_config: Optional[megatron.bridge.training.comm_overlap.CommOverlapConfig] = None,
- moe_flex_dispatcher_backend: Optional[str] = None,
- pretrained_checkpoint: Optional[str] = None,
- freeze_language_model: bool = True,
- freeze_vision_model: bool = True,
- freeze_vision_projection: bool = False,
- dataset_type: Optional[str] = None,
- image_folder: Optional[str] = None,
- tokenizer_model: Optional[str] = None,
- peft: Optional[Union[str, megatron.bridge.peft.base.PEFT]] = None,
- finetune_lr: Optional[float] = None,
Create a pre-training configuration for Qwen3 MoE models using a given HuggingFace path.
- Parameters:
hf_path (str) β HuggingFace model path (e.g., βQwen/Qwen3-30B-A3Bβ, βQwen/Qwen3-235B-A22Bβ).
dir (Optional[str]) β Base directory for saving logs and checkpoints.
name (str) β Name of the pre-training run.
data_paths (Optional[List[str]]) β List of paths to dataset files. If None, mock data will be used.
data_args_path (Optional[str]) β Path to file containing data arguments.
train_data_path (Optional[List[str]]) β List of training data paths.
valid_data_path (Optional[List[str]]) β List of validation data paths.
test_data_path (Optional[List[str]]) β List of test data paths.
per_split_data_args_path (Optional[str]) β Path to JSON file with per-split data configuration.
mock (bool) β Whether to use mock data. If True, ignores data_paths.
tensor_model_parallel_size (int) β Degree of tensor model parallelism.
pipeline_model_parallel_size (int) β Degree of pipeline model parallelism.
pipeline_dtype (Optional[torch.dtype]) β Data type for pipeline parallelism.
virtual_pipeline_model_parallel_size (Optional[int]) β Size of virtual pipeline parallelism.
context_parallel_size (int) β Degree of context parallelism to be passed to model_config.
expert_model_parallel_size (Optional[int]) β Degree of expert parallelism for MoE.
expert_tensor_parallel_size (int) β Expert tensor parallelism for MoE.
sequence_parallel (bool) β Whether to use sequence parallelism.
use_megatron_fsdp (bool) β Whether to use Megatron FSDP.
enable_recompute (bool) β Whether to enable recompute for memory optimization.
account_for_embedding_in_pipeline_split (bool) β Whether to account for embedding in pipeline split.
account_for_loss_in_pipeline_split (bool) β Whether to account for loss in pipeline split.
train_iters (int) β Total number of training iterations.
global_batch_size (int) β Global batch size for training.
micro_batch_size (int) β Micro batch size for training.
seq_length (int) β Sequence length for training data.
lr (float) β Learning rate.
min_lr (float) β Minimum learning rate for cosine decay.
lr_warmup_iters (int) β Number of warmup iterations for the learning rate.
lr_decay_iters (Optional[int]) β Number of iterations over which to decay the LR.
precision_config (Optional[Union[MixedPrecisionConfig, str]]) β Precision configuration for the model.
comm_overlap_config (Optional[CommOverlapConfig]) β Communication overlap configuration.
moe_flex_dispatcher_backend (str | None) β Token dispatcher type [deepep, hybridep].
pretrained_checkpoint (Optional[str]) β Path to pretrained checkpoint.
freeze_language_model (bool) β Whether to freeze the language model.
freeze_vision_model (bool) β Whether to freeze the vision model.
freeze_vision_projection (bool) β Whether to freeze the vision projection.
dataset_type (Optional[str]) β Type of dataset to use.
image_folder (Optional[str]) β Path to image folder.
tokenizer_model (Optional[str]) β Path to tokenizer model.
peft (Optional[Union[str, PEFT]]) β PEFT configuration (e.g., βloraβ, βdoraβ, or PEFT object).
finetune_lr (Optional[float]) β Learning rate override for fine-tuning.
- Returns:
Configuration for pre-training.
- Return type: