Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean dependencies #2298

Merged
merged 21 commits into from
Oct 31, 2024
Merged

Clean dependencies #2298

merged 21 commits into from
Oct 31, 2024

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.

@@ -21,7 +21,6 @@
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

@@ -95,7 +98,7 @@ def test_create_peft_model_from_config(self):
nb_trainable_params = sum(p.numel() for p in trl_model.parameters() if p.requires_grad)
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)

trl/trainer/judges.py Outdated Show resolved Hide resolved
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

trl/trainer/judges.py Outdated Show resolved Hide resolved
@qgallouedec qgallouedec merged commit 06be6f4 into main Oct 31, 2024
10 of 12 checks passed
@qgallouedec qgallouedec deleted the clean-deps branch October 31, 2024 10:08
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