Skip to content

When Qwen2VLConfig is saved and loaded again, an incorrect model_type will be obtained #41746

@ZX-ModelCloud

Description

@ZX-ModelCloud

System Info

  • transformers version: 4.57.1
  • Platform: Linux-6.14.0-29-generic-x86_64-with-glibc2.39
  • Python version: 3.11.10
  • Huggingface_hub version: 0.34.4
  • Safetensors version: 0.6.2
  • Accelerate version: 1.10.1
  • Accelerate config: not found
  • DeepSpeed version: not installed
  • PyTorch version (accelerator?): 2.8.0+cu128 (CUDA)
  • Tensorflow version (GPU?): not installed (NA)
  • Flax version (CPU?/GPU?/TPU?): not installed (NA)
  • Jax version: not installed
  • JaxLib version: not installed
  • Using distributed or parallel set-up in script?:
  • Using GPU in script?:
  • GPU type: NVIDIA GeForce RTX 4090

Who can help?

No response

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

import tempfile
from transformers import AutoConfig

cfg = AutoConfig.from_pretrained("Qwen/Qwen2-VL-2B-Instruct")
assert cfg.model_type == "qwen2_vl"

with tempfile.TemporaryDirectory() as tmp_dir:
    cfg.save_pretrained(tmp_dir)

    new_cfg = AutoConfig.from_pretrained(tmp_dir)

    assert new_cfg.model_type == "qwen2_vl"  # Expected "qwen2_vl", but got "qwen2_vl_text".

Expected behavior

when Qwen2VLConfig is saved and then loaded again.
Expected model_type is "qwen2_vl", but got "qwen2_vl_text".

Qwen2_5_VLConfig also has the same bug.

This bug is caused by PR#41158

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions