部署llama3.1时出现ValueError: `rope_scaling` must be a dictionary with two fields的解决方案


在部署最新模型llama3.1时出现了ValueError: rope_scaling must be a dictionary with two fields, type and factor, got {‘factor’: 8.0, ‘low_freq_factor’: 1.0, ‘high_freq_factor’: 4.0, ‘original_max_position_embeddings’: 8192, ‘rope_type’: ‘llama3’}

完整报错

[2024-07-25 01:37:53,226] [INFO] [real_accelerator.py:133:get_accelerator] Setting ds_accelerator to cuda (auto detect)
Traceback (most recent call last):
  File "/chenhui/zhangwuhan/stage2/BMLU-0.2.0/src/English_chat/Llama.py", line 90, in <module>
    main(model_path=args.model_path,max_length=args.max_length)
  File "/chenhui/zhangwuhan/stage2/BMLU-0.2.0/src/English_chat/Llama.py", line 71, in main
    pipeline = transformers.pipeline(
  File "/usr/local/lib/python3.10/dist-packages/transformers/pipelines/__init__.py", line 816, in pipeline
    config = AutoConfig.from_pretrained(
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/auto/configuration_auto.py", line 952, in from_pretrained
    return config_class.from_dict(config_dict, **unused_kwargs)
  File "/usr/local/lib/python3.10/dist-packages/transformers/configuration_utils.py", line 761, in from_dict
    config = cls(**config_dict)
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/llama/configuration_llama.py", line 161, in __init__
    self._rope_scaling_validation()
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/llama/configuration_llama.py", line 181, in _rope_scaling_validation
    raise ValueError(
ValueError: `rope_scaling` must be a dictionary with two fields, `type` and `factor`, got {'factor': 8.0, 'low_freq_factor': 1.0, 'high_freq_factor': 4.0, 'original_max_position_embeddings': 8192, 'rope_type': 'llama3'}

解决方法

更新使用最新版本的transformers:

pip install --upgrade transformers
  • 14
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值