File tree Expand file tree Collapse file tree
gpu_megatron/torch/export Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232 PreTrainedModel ,
3333 Qwen3Config ,
3434 Qwen3MoeConfig ,
35- Qwen3VLConfig ,
3635 T5Config ,
3736 T5ForConditionalGeneration ,
3837)
39- from transformers .models .qwen3_vl .modeling_qwen3_vl import Qwen3VLForConditionalGeneration
4038
4139import modelopt .torch .opt as mto
4240
@@ -125,6 +123,12 @@ def create_tiny_qwen3_moe_dir(
125123
126124##### Qwen3-VL #####
127125def get_tiny_qwen3vl (** config_kwargs ) -> PreTrainedModel :
126+ # Lazy imports — Qwen3VL classes live under transformers.models.qwen3_vl which
127+ # may not exist in older transformers builds, and this module is imported by
128+ # every test that uses transformers_models.py.
129+ from transformers import Qwen3VLConfig
130+ from transformers .models .qwen3_vl .modeling_qwen3_vl import Qwen3VLForConditionalGeneration
131+
128132 set_seed (SEED )
129133
130134 # Defaults: hidden_size=num_attention_heads*head_dim (e.g. 4*8=32).
Original file line number Diff line number Diff line change 3030)
3131from safetensors import safe_open
3232from safetensors .torch import save_file
33- from transformers .models .qwen3_vl .modeling_qwen3_vl import Qwen3VLForConditionalGeneration
3433
3534import modelopt .torch .quantization as mtq
3635import modelopt .torch .speculative as mtsp
@@ -198,6 +197,10 @@ def _test_unified_export_megatron(
198197 "vision encoder keys missing from combined export"
199198 )
200199 # try to load the model and run a forward pass
200+ from transformers .models .qwen3_vl .modeling_qwen3_vl import (
201+ Qwen3VLForConditionalGeneration ,
202+ )
203+
201204 vl_model = Qwen3VLForConditionalGeneration .from_pretrained (
202205 tmp_export_dir , torch_dtype = torch .bfloat16
203206 ).cuda ()
You can’t perform that action at this time.
0 commit comments