Skip to content

Clean dependencies#2298

Merged
qgallouedec merged 21 commits intomainfrom
clean-deps
Oct 31, 2024
Merged

Clean dependencies#2298
qgallouedec merged 21 commits intomainfrom
clean-deps

Conversation

@qgallouedec
Copy link
Member

@qgallouedec qgallouedec commented Oct 30, 2024

What does this PR do?

This PR cleans up TRL dependencies by better dividing and following best practice.
It updates the test workflow accordingly.

  • For a test extra, it's usually best practice to include only the dependencies required for testing and not all optional dependencies. This PR makes the appropriate change.
  • Optional dependencies deepspeed and liger-kernel are only supported for linux. This PR ensure that they are not part of optional dependencies with windows.
  • Add test for python 3.12 (stable for more than a year now)
  • Test with both latest and dev versions to better track breaking changes in our dependencies.
OS Python Required dependencies Optional dependencies
Tests Ubuntu 3.9 Latest Latest
Tests Ubuntu 3.10 Latest Latest
Tests Ubuntu 3.11 Latest Latest
Tests Ubuntu 3.12 Latest Latest
Tests Windows 3.9 Latest Latest
Tests Windows 3.10 Latest Latest
Tests Windows 3.11 Latest Latest
Tests Windows 3.12 Latest Latest
Tests without optional dependencies Ubuntu 3.12 Latest No
Tests with dev dependencies Ubuntu 3.12 Dev Latest

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a GitHub issue? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

import numpy as np
from accelerate import Accelerator
from huggingface_hub import InferenceClient
from scipy.special import softmax
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this dep

assert nb_trainable_params == 10273

@require_bitsandbytes
@require_torch_gpu_if_bnb_not_multi_backend_enabled
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it requires cuda

@qgallouedec
Copy link
Member Author

Failing test are expected and will be solved later (in #2288 for example)

Copy link
Member

@lewtun lewtun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a small tweak to the softmax

cache: "pip"
cache-dependency-path: |
setup.py
requirements.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we find the dependencies are a hassle to maintain, we might want to switch to the transformers approach, which uses a look-up table to give fine-grained control: https://github.com/huggingface/transformers/blob/main/setup.py

@qgallouedec qgallouedec merged commit 06be6f4 into main Oct 31, 2024
@qgallouedec qgallouedec deleted the clean-deps branch October 31, 2024 10:08
yxliu-TAMU pushed a commit to mincheolseong/ECEN743-GRPO-Project-Proposal that referenced this pull request Apr 20, 2025
* clean deps

* new tests

* tests

* Add tests without optional dependencies workflow

* Update dependencies in tests.yml

* cpu version of torch

* Update dependencies and installation commands

* Disable fail-fast in test workflow

* Update test matrix in workflows file

* try fix windows

* Remove "rich" from required packages in setup.py

* Update dependency installation in tests.yml

* Add torch and deepspeed installation for windows-latest

* Fix conditional statement in workflow file

* Add torch and deepspeed installation for Windows

* Fix if statement

* Update torch and deepspeed dependencies

* Update liger package requirement for non-Windows platforms

* remove scipy dep

* Add torch GPU requirement for testing_utils

* Update trl/trainer/judges.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants