Skip to content

ImportError: transformers.utils.LossKwargs removed in transformers>=4.54 breaks import in modeling_qwen3_kv.py #306

@timxu826

Description

@timxu826

Content Summary Upgrading transformers to >=4.54 causes an ImportError in eagle/model/modeling_qwen3_kv.py due to the removal of transformers.utils.LossKwargs. Pinning transformers to 4.53.3 works, but newer versions fail to import and the program cannot start.

Environment

OS: Linux Ubuntu 22.04.3 LTS
Python: 3.9 (also reproducible on 3.13)
torch: 2.6.0
transformers: >=4.54 fails, 4.53.3 works

Steps to Reproduce

Install transformers>=4.54
Run:
python -m eagle.evaluation.gen_ea_answer_llama3chat
--ea-model-path yuhuili/EAGLE3-LLaMA3.1-Instruct-8B
--base-model-path meta-llama/Llama-3.1-8B-Instruct

Actual Behavior:
ImportError: cannot import name 'LossKwargs' from 'transformers.utils'
at eagle/model/modeling_qwen3_kv.py:44
from transformers.utils import LossKwargs, auto_docstring, can_return_tuple, logging

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No 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