Bug: Incompatible version pins in documents/chapter11/requirements.txt
The current requirements.txt pins:
trl==0.9.4
transformers==4.51.3
These versions are incompatible with each other. TRL 0.9.4 was released against Transformers ~4.40 and does not support the API changes introduced in Transformers 4.46+.
Attempting to run the RLHF notebook with these requirements will produce import errors such as:
ImportError: cannot import name 'Trainer' from 'trl' or attribute errors due to removed/renamed symbols.
Fix
Update trl to a version compatible with transformers==4.51.3. For example:
transformers==4.51.3
trl==0.15.2
TRL 0.15+ re-aligned with the current Transformers API. You can verify compatibility at https://github.com/huggingface/trl/blob/main/setup.py.
Bug: Incompatible version pins in
documents/chapter11/requirements.txtThe current
requirements.txtpins:These versions are incompatible with each other. TRL 0.9.4 was released against Transformers ~4.40 and does not support the API changes introduced in Transformers 4.46+.
Attempting to run the RLHF notebook with these requirements will produce import errors such as:
ImportError: cannot import name 'Trainer' from 'trl'or attribute errors due to removed/renamed symbols.Fix
Update
trlto a version compatible withtransformers==4.51.3. For example:TRL 0.15+ re-aligned with the current Transformers API. You can verify compatibility at https://github.com/huggingface/trl/blob/main/setup.py.