Skip to content

Declare direct dependencies we currently get transitively - #7666

Closed
RerankerGuo wants to merge 1 commit into
huggingface:mainfrom
RerankerGuo:fix/declare-direct-deps-7653
Closed

RerankerGuo wants to merge 1 commit into
huggingface:mainfrom
RerankerGuo:fix/declare-direct-deps-7653

Conversation

@RerankerGuo

@RerankerGuo RerankerGuo commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #7653.

Adds the packages TRL imports by name but currently only gets transitively (via accelerate, datasets, or transformers) to the direct dependency list:

  • huggingface_hub (trl/trainer/base_trainer.py, trl/trainer/grpo_trainer.py, trl/trainer/utils.py)
  • numpy (trl/data_utils.py, trl/trainer/grpo_trainer.py)
  • pandas (trl/trainer/callbacks.py, trl/trainer/grpo_trainer.py)
  • psutil (trl/models/activation_offloading.py)
  • pyarrow (trl/data_utils.py)
  • pyyaml (trl/scripts/_hf_argparser.py)

If one of those upstream packages drops or makes one of them optional, import trl breaks. torch is left to #7642, which adds the version pin (>=2.6.0); no version floors are introduced here, matching the existing jinja2 line.

Before submitting

AI writing disclosure

  • AI-assisted: the dependency list and commit message were drafted with AI assistance and reviewed by a human.

Note

Low Risk
Metadata-only change to declared install requirements; no runtime or API behavior changes.

Overview
Packaging fix: six libraries TRL imports directly are now listed in pyproject.toml as first-class dependencies instead of relying on them coming in transitively through accelerate, datasets, or transformers.

Added: huggingface_hub, numpy, pandas, psutil, pyarrow, and pyyaml (with inline comments pointing at the importing modules). No version floors were added, consistent with existing entries like jinja2. torch is intentionally left for a separate PR.

This prevents import trl from breaking if an upstream package drops or optionalizes one of these deps.

Reviewed by Cursor Bugbot for commit 3daeac7. Bugbot is set up for automated code reviews on this repo. Configure here.

Adds numpy, pandas, pyarrow, huggingface_hub, pyyaml, and psutil to the
direct dependencies list. Each is imported by name in trl/* sources but
only reaches the package via accelerate, datasets, or transformers. If
any of those upstream packages drops or makes one of these optional,
'import trl' breaks.

torch is left to huggingface#7642, which adds the version pin (>=2.6.0).

Fixes huggingface#7653.
@github-actions github-actions Bot added the 🔧 maintenance CI, tooling, tests, or repo upkeep label Oct 13, 2026
@qgallouedec

Copy link
Copy Markdown
Member

Thanks but I'll let @albertvillanova handling it, it has more context on the demand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔧 maintenance CI, tooling, tests, or repo upkeep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Declare direct dependencies we currently get transitively

2 participants