[Python] Cannot import `QwenForCausalLM` after installing `v4.51.3-Qwen2.5-Omni-preview` tag;...

Discussão em 'Python' iniciado por Stack, Setembro 3, 2025.

  1. Stack

    Stack Membro Participativo

    Description: I am trying to install the Hugging Face Transformers version that supports the Qwen2.5-Omni model. According to the official docs, the correct tag to install is v4.51.3-Qwen2.5-Omni-preview. However, every attempt ends with pip installing transformers-4.52.0.dev0, and I cannot import QwenForCausalLM or QwenTokenizer.

    Steps attempted:

    1. Install via pip directly from GitHub:

    pip install git+https://github.com/huggingface/transformers@v4.51.3-Qwen2.5-Omni-preview

    • Result: pip installs transformers-4.52.0.dev0
    1. Clone and install manually:

    git clone https://github.com/huggingface/transformers.git
    cd transformers
    git checkout v4.51.3-Qwen2.5-Omni-preview
    pip install .

    • Result: Still installs 4.52.0.dev0
    1. Uninstall, purge cache, and reinstall:

    pip uninstall transformers -y
    pip cache purge
    pip install --no-deps --force-reinstall .

    • Result: Still installs 4.52.0.dev0
    1. Python import test:

    import transformers
    print(transformers.__version__)
    from transformers import QwenForCausalLM, QwenTokenizer

    • Result: ImportError: cannot import name 'QwenForCausalLM'

    Errors observed:

    • ImportError: cannot import name 'QwenForCausalLM' from 'transformers'
    • Installing v4.51.3-Qwen2.5-Omni-preview always results in 4.52.0.dev0
    • Using --upgrade installs the latest dev version, overwriting the preview tag

    Explanation:

    • The Qwen2.5-Omni tag is based on Transformers v4.51.3, but pip interprets the dev release v4.52.0.dev0 as newer and installs it.
    • Official docs note: "This tag is a preview of the Qwen2.5-Omni model. This tag is a tagged version of the main branch and does not follow semantic versioning. This model will be included in the next minor release: v4.52.0."
    • Pip cache, pre-installed dependencies, and Windows path handling contribute to the dev version being installed instead of the intended tag.

    Workarounds tried:

    1. Editable local install:

    git clone https://github.com/huggingface/transformers.git
    cd transformers
    git checkout v4.51.3-Qwen2.5-Omni-preview
    pip uninstall transformers -y
    pip install -e .

    1. Clean environment:
    • Create a fresh virtual environment dedicated to Qwen2.5-Omni.
    • Avoid using pip install --upgrade transformers.

    Notes:

    • Even with correct tag checkout, pip may rebuild the wheel as 4.52.0.dev0 due to versioning and caching logic.
    • This is a common issue on Windows and pip-managed environments.

    Request for help:

    • How can I reliably install the v4.51.3-Qwen2.5-Omni-preview tag on Windows so that QwenForCausalLM and QwenTokenizer can be imported?

    Continue reading...

Compartilhe esta Página