Skip to content

Commit 4002b5a

Browse files
committed
Revert "Move Qwen3VL imports back to module top level"
This reverts commit 63a229a.
1 parent 8cd9043 commit 4002b5a

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

tests/_test_utils/torch/transformers_models.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@
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

4139
import modelopt.torch.opt as mto
4240

@@ -125,6 +123,12 @@ def create_tiny_qwen3_moe_dir(
125123

126124
##### Qwen3-VL #####
127125
def 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).

tests/gpu_megatron/torch/export/test_unified_export_megatron.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
)
3131
from safetensors import safe_open
3232
from safetensors.torch import save_file
33-
from transformers.models.qwen3_vl.modeling_qwen3_vl import Qwen3VLForConditionalGeneration
3433

3534
import modelopt.torch.quantization as mtq
3635
import 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()

0 commit comments

Comments
 (0)