bump transformers to 5.9.0 and trl to 1.5.1#3696
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughProject version is bumped to ChangesVersion and Dependency Updates
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pyproject.toml`:
- Around line 20-23: The pyproject metadata lists transformers==5.9.0 and
trl==1.5.1 but lacks minimal verification evidence; run a lightweight
compatibility check and add its result to the PR: run pip check after installing
the env and include the output, and add a one-line smoke test command (e.g., a
python -c invocation that imports transformers, trl, accelerate, datasets,
tokenizers) to demonstrate they import successfully; reference the package names
(transformers, trl, accelerate, datasets, tokenizers) in the PR description or
CI log so reviewers can see the pip check and import/smoke-test results
alongside the pyproject.toml dependency entries.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 45256d01-13c9-4529-8c42-20ee2e413b6e
📒 Files selected for processing (2)
VERSIONpyproject.toml
| "transformers==5.9.0", | ||
| "accelerate==1.13.0", | ||
| "datasets>=4.8.4,<4.9.0", | ||
| "trl==1.1.0", | ||
| "trl==1.5.1", |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Fetch requires_dist metadata directly from PyPI for the exact versions.
python - <<'PY'
import json, urllib.request
pkgs = [("transformers", "5.9.0"), ("trl", "1.5.1")]
for name, ver in pkgs:
url = f"https://pypi.org/pypi/{name}/{ver}/json"
with urllib.request.urlopen(url) as r:
data = json.load(r)
reqs = data["info"].get("requires_dist") or []
print(f"\n{name}=={ver} requires_dist:")
for req in reqs:
print(" -", req)
PYRepository: axolotl-ai-cloud/axolotl
Length of output: 2650
🌐 Web query:
PyPI trl 1.5.1 requires_dist transformers
💡 Result:
Yes. TRL on PyPI lists transformers as a required dependency. The TRL package metadata includes an entry for transformers under its install requirements (shown as a dependency constraint on the PyPI page) [1]. Note: In the search results I could retrieve, the PyPI page shown corresponds to TRL v1.4.0 (not v1.5.1) [1], and the v1.5.1-specific PyPI dependency lines were not directly surfaced in the retrieved snippets. However, TRL’s packaging configuration in the upstream repository declares a transformers dependency in its pyproject.toml for current/typical releases (e.g., transformers>=4.56.2) [2], which is consistent with TRL requiring transformers at install time.
Citations:
- 1: https://pypi.org/project/trl/
- 2: https://github.com/huggingface/trl/blob/main/pyproject.toml
🌐 Web query:
PyPI transformers 5.9.0 requires_dist
💡 Result:
As of June 1, 2026, Transformers version 5.9.0 is a released package on PyPI [1]. The requires_dist field, which defines the package's dependencies in compliance with PEP 508 [2], is specified within the setup.py file [3]. The dependencies for transformers 5.9.0 include a wide range of libraries, such as huggingface-hub, numpy, packaging, pyyaml, regex, safetensors, tokenizers, tqdm, and others [3][4]. The setup.py file explicitly lists these requirements [3]. For example, some of the specific dependency constraints identified include: - huggingface-hub>=1.5.0,<2.0 [3] - numpy>=1.17 [3] - regex>=2025.10.22 [3] - safetensors>=0.4.3 [3] - tokenizers>=0.22.0,<=0.23.0 [3] - torch>=2.4 [3] The requires_dist metadata field in PyPI's JSON API follows the format defined by PEP 508, which allows for complex dependency specifications including version specifiers, environment markers (e.g., for platform or python version), and extras [2]. Developers can verify these dependencies by inspecting the project's setup.py [3] or by querying the PyPI JSON API for the specific version.
Citations:
- 1: https://pypi.org/project/transformers/
- 2: https://stackoverflow.com/questions/71165471/what-is-a-format-of-pypis-requires-dist-in-json-api
- 3: https://fossies.org/linux/misc/transformers-5.9.0.tar.gz/transformers-5.9.0/setup.py
- 4: https://pypistats.org/packages/transformers
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Try fetching PyPI JSON with cert verification disabled (sandbox SSL issue).
python3 - <<'PY'
import json, ssl, urllib.request
from urllib.error import URLError
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
pkgs = [("transformers", "5.9.0"), ("trl", "1.5.1")]
for name, ver in pkgs:
url = f"https://pypi.org/pypi/{name}/{ver}/json"
try:
with urllib.request.urlopen(url, context=ctx, timeout=20) as r:
data = json.load(r)
reqs = data.get("info", {}).get("requires_dist") or []
print(f"\n{name}=={ver} requires_dist:")
for req in reqs:
print(" -", req)
except Exception as e:
print(f"\n{name}=={ver} fetch failed: {e.__class__.__name__}: {e}")
PYRepository: axolotl-ai-cloud/axolotl
Length of output: 11494
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Show the exact dependency lines around the referenced snippet.
sed -n '1,80p' pyproject.toml | nl -ba | sed -n '1,80p'Repository: axolotl-ai-cloud/axolotl
Length of output: 111
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "---- pyproject.toml lines 15-35 ----"
awk 'NR>=15 && NR<=35 {printf "%d:%s\n", NR, $0}' pyproject.toml
echo
echo "---- Find nearby pinned deps (peft/tokenizers) ----"
rg -n '^(peft|tokenizers|accelerate|datasets|trl|transformers)\s*([<>=!~].*)?$' pyproject.toml || trueRepository: axolotl-ai-cloud/axolotl
Length of output: 714
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
import json, ssl, urllib.request
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
def fetch_requires(name, version):
url = f"https://pypi.org/pypi/{name}/{version}/json"
with urllib.request.urlopen(url, context=ctx, timeout=20) as r:
data = json.load(r)
reqs = data.get("info", {}).get("requires_dist") or []
print(f"\n{name}=={version} requires_dist:")
for req in reqs:
print(" -", req)
# Only exact versions can be fetched from PyPI JSON.
# tokenizers pin is a range; fetch the lower bound and upper bound candidate used by transformers' metadata.
# peft pin is a range; fetch lower bound candidate.
fetch_requires("peft", "0.19.1")
fetch_requires("tokenizers", "0.22.1")
fetch_requires("tokenizers", "0.23.0")
PYRepository: axolotl-ai-cloud/axolotl
Length of output: 2621
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
import json, ssl, urllib.request
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
pkgs = [
("accelerate", "1.13.0"),
("datasets", "4.8.4"),
("tokenizers", "0.22.1"),
]
for name, ver in pkgs:
url = f"https://pypi.org/pypi/{name}/{ver}/json"
with urllib.request.urlopen(url, context=ctx, timeout=20) as r:
data = json.load(r)
reqs = data.get("info", {}).get("requires_dist") or []
print(f"\n{name}=={ver} requires_dist:")
for req in reqs:
print(" -", req)
PYRepository: axolotl-ai-cloud/axolotl
Length of output: 8076
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
import json, ssl, urllib.request
pkgs = [("transformers","5.9.0"), ("trl","1.5.1")]
ctx = ssl.create_default_context()
fallback = ssl._create_unverified_context()
for name, ver in pkgs:
url = f"https://pypi.org/pypi/{name}/{ver}/json"
for c in (ctx, fallback):
try:
with urllib.request.urlopen(url, context=c, timeout=20) as r:
data = json.load(r)
reqs = data.get("info", {}).get("requires_dist") or []
print(f"\n{name}=={ver} requires_dist:")
for req in reqs:
print(" -", req)
break
except Exception:
continue
PYRepository: axolotl-ai-cloud/axolotl
Length of output: 11494
Add minimal evidence that transformers==5.9.0 and trl==1.5.1 work together
At pyproject.toml lines 20/23, PyPI metadata aligns: trl==1.5.1 requires transformers>=4.56.2, accelerate>=1.4.0, and datasets>=4.7.0 (matching your transformers==5.9.0, accelerate==1.13.0, datasets>=4.8.4,<4.9.0). transformers==5.9.0 also requires tokenizers>=0.22.0,<0.23.0 (consistent with your tokenizers>=0.22.1).
Add lightweight PR evidence: pip check plus a small import/smoke test (e.g., python -c "import transformers, trl; import accelerate, datasets").
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pyproject.toml` around lines 20 - 23, The pyproject metadata lists
transformers==5.9.0 and trl==1.5.1 but lacks minimal verification evidence; run
a lightweight compatibility check and add its result to the PR: run pip check
after installing the env and include the output, and add a one-line smoke test
command (e.g., a python -c invocation that imports transformers, trl,
accelerate, datasets, tokenizers) to demonstrate they import successfully;
reference the package names (transformers, trl, accelerate, datasets,
tokenizers) in the PR description or CI log so reviewers can see the pip check
and import/smoke-test results alongside the pyproject.toml dependency entries.
a828cab to
6e71851
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…h_hidden_kernels transformers ≤5.8 surfaced the non-Module ``_hidden_kernels`` entry as TypeError/AttributeError via ``module.register_module(name, fn)``. 5.9 reworked ``attach_hidden_kernels`` to raise ``ValueError`` directly with a clearer error message. The patch under test (strip dead entries before ``kernelize()`` runs) does the right thing either way; broaden the expected-crash assertion so the test reflects current upstream behavior.
6e71851 to
4664cd7
Compare
….5.1 ships upstream fix TRL 1.5.1 implements huggingface/trl#5730 natively — ``OffloadActivations`` now has its own ``__enter__`` that clears tracker / stashes between steps, **plus** two things the axolotl backport never had: - ``self.tensor_id = 0`` reset (without this, the tensor_id counter accumulates across steps; harmless on its own but skews the ``fwd_stash`` eviction window). - ``torch.cuda.empty_cache()`` when bitsandbytes is loaded — flushes the BNB allocator between steps so its compute / optimizer-state buffers don't accumulate as live storage. TRL 1.5.1 also adds a ``__exit__`` that syncs the offload streams (``s0``, ``s1``) before the parent cleanup runs. The axolotl backport only overrode ``__enter__``, so ``__exit__`` was inherited correctly either way. Once we bumped TRL 1.1.0 → 1.5.1 (transformers 5.9 bundle), the monkey-patch became strictly worse than upstream — it shadowed the better ``__enter__``, dropping the ``tensor_id`` reset and the BNB ``empty_cache``. Combined with cu130's stricter cross-stream lifetime checks, this surfaced as XID 43 (driver-killed CUDA channel) during ``test_activation_offloading[lora]``, followed by every subsequent test failing at ``torch.manual_seed(42)`` because the CUDA context was permanently poisoned. Drop the patch and the wrapper — upstream is now the source of truth, per the existing TODO in this file.
Description
Motivation and Context
How has this been tested?
AI Usage Disclaimer
Screenshots (if appropriate)
Types of changes
Social Handles (Optional)
Summary by CodeRabbit