Skip to content

[Bug] Qwen3-VL fails to load model. #3637

@David-AU-github

Description

@David-AU-github
  1. Did you update? pip install --upgrade unsloth unsloth_zoo
  • YES
  1. Colab or Kaggle or local / cloud
  • LOCAL, Linux
  1. Number GPUs used, use nvidia-smi
  • ONE
  1. Which notebook? Please link!
  • N/A
  1. Which Unsloth version, TRL version, transformers version, PyTorch version?
    2025.11.3, Transformers 4.57.1 , 2.9.0+cu128

  2. Which trainer? SFTTrainer, GRPOTrainer etc
    FAILS on loading model.

Put Minimal code to reproduce error here ###Remove Hugging Face token###

🦥 You can also ask via our Reddit page: https://www.reddit.com/r/unsloth/

CODE:

model, tokenizer = FastVisionModel.from_pretrained(
model_name="/mnt/e/Qwen3-vl-8B-20x-2",
max_seq_length=max_seq_length,
dtype=dtype,
load_in_4bit=True,

# VISION
use_gradient_checkpointing = "unsloth"		
# local_files_only=True 					

)

FAILS to LOAD MODEL:

python3 instruct-12B-QwenVL-4bit-r64--VISION--PKD2--lnx-split.py

🦥 Unsloth: Will patch your computer to enable 2x faster free finetuning.
🦥 Unsloth Zoo will now patch everything to make training faster!

Traceback (most recent call last):
File "/home/david/.local/lib/python3.12/site-packages/unsloth_zoo/compiler.py", line 667, in create_new_function
new_module, old_path = import_module(compile_folder, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/david/.local/lib/python3.12/site-packages/unsloth_zoo/compiler.py", line 663, in import_module
raise e
File "/home/david/.local/lib/python3.12/site-packages/unsloth_zoo/compiler.py", line 658, in import_module
new_module = importlib.import_module(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 991, in exec_module
File "", line 1129, in get_code
File "", line 1059, in source_to_code
File "", line 488, in _call_with_frames_removed
File "/mnt/f/unsloth/unsloth_compiled_cache/unsloth_compiled_module_qwen3_vl.py", line 612
()
^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/david/.local/lib/python3.12/site-packages/unsloth_zoo/compiler.py", line 694, in create_new_function
spec.loader.exec_module(new_module)
File "", line 991, in exec_module
File "", line 1129, in get_code
File "", line 1059, in source_to_code
File "", line 488, in _call_with_frames_removed
File "/tmp/unsloth_compiled_cache/unsloth_compiled_module_qwen3_vl.py", line 612
()
^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/david/.local/lib/python3.12/site-packages/unsloth_zoo/compiler.py", line 2971, in unsloth_compile_transformers
combined_module = create_new_function(
^^^^^^^^^^^^^^^^^^^^
File "/home/david/.local/lib/python3.12/site-packages/unsloth_zoo/compiler.py", line 696, in create_new_function
raise RuntimeError(f"Direct module loading failed for {name}: {e}")
RuntimeError: Direct module loading failed for unsloth_compiled_module_qwen3_vl: invalid syntax (unsloth_compiled_module_qwen3_vl.py, line 612)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/mnt/f/unsloth/instruct-12B-QwenVL-4bit-r64--VISION--PKD2--lnx-split.py", line 23, in
model, tokenizer = FastVisionModel.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/david/.local/lib/python3.12/site-packages/unsloth/models/loader.py", line 1009, in from_pretrained
model_types, supports_sdpa = unsloth_compile_transformers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/david/.local/lib/python3.12/site-packages/unsloth/models/_utils.py", line 1858, in unsloth_compile_transformers
_unsloth_compile_transformers(
File "/home/david/.local/lib/python3.12/site-packages/unsloth_zoo/compiler.py", line 2983, in unsloth_compile_transformers
raise RuntimeError(exception)
RuntimeError: Direct module loading failed for unsloth_compiled_module_qwen3_vl: invalid syntax (unsloth_compiled_module_qwen3_vl.py, line 612)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions