问题描述
ImportError: cannot import name 'DDPOConfig' from 'trl' (unknown location)
问题分析
DDPOConfig
、SFTConfig
和DPOConfig
等只在main上可用,所以需要从源代码安装TRL。trl作者表示将很快在pypi上发布一个版本,包括+许多其他错误修复。(2024.6.4记,后续发布新版本会更新!)
问题解决
pip install -U git+https://github.com/huggingface/trl.git
参考
ImportError: cannot import name ‘DPOConfig’ from ‘trl’ #1642
ImportError: cannot import name ‘SFTConfig’ from ‘trl’ #1639
Cannot import name ‘RewardConfig’ from ‘trl’ #791