Skip to content

fix: incompatible version pins trl==0.9.4 vs transformers==4.51.3 in chapter11/requirements.txt #36

@kuishou68

Description

@kuishou68

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions