LossKwargs error when use transformers==4.55.2

#21
by LinJulia - opened
Intern Large Models org

Traceback (most recent call last):
File "/home/zhulin1/transformers_internlm25.py", line 5, in
model = AutoModelForCausalLM.from_pretrained("/nvme/qa_test_models/internlm/internlm3-8b-instruct", torch_dtype=torch.float16, trust_remote_code=True).cuda()
File "/home/zhulin1/miniconda3/envs/v92/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 582, in from_pretrained
model_class = get_class_from_dynamic_module(
File "/home/zhulin1/miniconda3/envs/v92/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 582, in get_class_from_dynamic_module
return get_class_in_module(class_name, final_module, force_reload=force_download)
File "/home/zhulin1/miniconda3/envs/v92/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 277, in get_class_in_module
module_spec.loader.exec_module(module)
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/home/zhulin1/.cache/huggingface/modules/transformers_modules/internlm3-8b-instruct/modeling_internlm3.py", line 39, in
from transformers.utils import (
ImportError: cannot import name 'LossKwargs' from 'transformers.utils' (/home/zhulin1/miniconda3/envs/v92/lib/python3.10/site-packages/transformers/utils/init.py)

Roll back to a previous transformers version: pip install transformers==4.53.3

Sign up or log in to comment