Skip to content

[deps] Upgrade HuggingFace stack: datasets 4.x - #64054

Merged
ArturNiederfahrenhorst merged 29 commits into
ray-project:masterfrom
ArturNiederfahrenhorst:upgrade-hf-stack-datasets4
Jun 18, 2026
Merged

ArturNiederfahrenhorst merged 29 commits into
ray-project:masterfrom
ArturNiederfahrenhorst:upgrade-hf-stack-datasets4

Conversation

@ArturNiederfahrenhorst

@ArturNiederfahrenhorst ArturNiederfahrenhorst commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Coordinated bump of Ray's HuggingFace ML stack so it can run on datasets 4.x and huggingface-hub 1.x:

  • datasets: ==3.6.0 -> >=4.0.0,<5.0.0 (reverts the [deps] Pin datasets==3.6.0 in py313 train-requirements #62926 pin; verified the dtype regression it worked around in from_huggingface -> iter_torch_batches does NOT recur with datasets 4.x — the CPU train transformers tests pass on this branch).
  • huggingface-hub: >=0.24.0 -> >=1.0,<2.0.
  • transformers: ==4.36.2 -> >=5.0,<6.0, accelerate: ==0.28.0 -> >=1.0. Every transformers 4.x (through 4.57) hard-caps huggingface-hub <1.0, so hf-hub 1.x requires transformers 5.x.

For the Ray Serve docs this means that we have to switch from model.translate(...) to model.generate() ( https://huggingface.co/docs/transformers/en/tasks/translation ) which impacts the text content around the relevant code changes and makes the PR bigger.
Also, there is a small number of other places across the libraries that need attention.

Follow-ups

  • diffusers vs. transformers 5 in the ML release (BYOD) image: this PR brings transformers==5.11.0 alongside the pre-existing diffusers==0.12.1 baseline pin in release/ray_release/byod/requirements_ml_byod_3.{10,13}.in. diffusers 0.12.1 targets the transformers 4.x era and should be upgraded

…ers 5.x

Coordinated bump of Ray's HuggingFace ML stack so it can run on datasets 4.x
and huggingface-hub 1.x:

- datasets: ==3.6.0 -> >=4.0.0,<5.0.0 (reverts the ray-project#62926 pin; the dtype
  regression it worked around in from_huggingface -> iter_torch_batches must be
  fixed as part of this change).
- huggingface-hub: >=0.24.0 -> >=1.0,<2.0.
- transformers: ==4.36.2 -> >=5.0,<6.0, accelerate: ==0.28.0 -> >=1.0. Every
  transformers 4.x (through 4.57) hard-caps huggingface-hub <1.0, so hf-hub 1.x
  requires transformers 5.x.

Input-requirements only; the compiled lockfiles (requirements_compiled*.txt) and
deplocks must be regenerated on x86 CI/forge (compile_pip_dependencies skips
aarch64). Resolution verified coherent: the stack resolves to transformers
5.11.0 / datasets 4.8.5 / huggingface-hub 1.19.0 / tokenizers 0.22.2 /
accelerate 1.14.0, and s3fs==2023.12.1's pinned fsspec stays within datasets
4.x's accepted range.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
@ArturNiederfahrenhorst ArturNiederfahrenhorst added the go add ONLY when ready to merge, run all tests label Jun 12, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates machine learning dependency requirements across several requirements files, upgrading transformers, accelerate, datasets, and huggingface-hub to newer major versions. The reviewer identified that several of these specified major versions (such as transformers 5.x, datasets 4.x, and huggingface-hub 1.x) have not yet been released on PyPI, which will cause dependency resolution to fail and break CI/CD pipelines. It is recommended to revert these pins to the latest available stable versions.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

pip-compile reuses the existing requirements_compiled*.txt as constraints and
won't auto-upgrade transitive deps, so the stale tokenizers==0.15.2 /
regex==2024.5.15 / accelerate==0.28.0 / datasets==3.6.0 pins blocked the
transformers 5.x resolution. Remove the HF cluster (transformers, tokenizers,
regex, accelerate, huggingface-hub, hf-xet, datasets, safetensors, dill,
multiprocess) so CI's pip-compile re-resolves just those to the modern stack
(pip-tools partial upgrade). The recompiled files will be committed back.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Comment thread python/requirements_compiled.txt Resolved
@ray-gardener ray-gardener Bot added the data Ray Data-related issues label Jun 12, 2026
Authoritative recompile from CI's pip-compile jobs (premerge ray-project#68150), pulled
from their artifacts. Resolves the HF cluster to the modern stack:
transformers 5.11.0, datasets 4.8.5 (4.0.0 on py3.11), huggingface-hub 1.16.1,
tokenizers 0.22.2, accelerate 1.14.0, safetensors 0.8.0, regex 2026.5.9.

Replaces the temporary line-removal from the previous commit.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
ArturNiederfahrenhorst and others added 2 commits June 12, 2026 16:19
Regenerated all affected deplocks against the updated requirements_compiled*.txt
via `raydepsets build --all-configs` (bazel-pinned uv, --python-platform=linux,
deterministic). 39 lock files updated to the modern HF stack: datasets 4.8.5,
transformers 5.11.0, huggingface-hub 1.16.1, accelerate 1.14.0, tokenizers 0.22.2.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Keep the requirement files to bare version specs; the rationale lives in the
PR/commit history, not inline.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
ArturNiederfahrenhorst added a commit to shorbaji/ray that referenced this pull request Jun 12, 2026
Brings the HuggingFace stack upgrade (datasets 4.x, huggingface-hub 1.x,
transformers 5.x; PR ray-project#64054) and current master into the lerobot datasource
branch. datasets 4.x / hf-hub 1.x in the shared data lock is what lets
lerobot[dataset] (which requires huggingface-hub>=1.0) resolve there, so the
read_lerobot test can finally run in CI.

Conflict resolved in python/requirements/ml/data-test-requirements.txt: kept
both master's `obstore` and the py>=3.12-gated lerobot stack.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
ArturNiederfahrenhorst and others added 2 commits June 13, 2026 09:03
transformers 5.x removed two long-deprecated TrainingArguments kwargs:
- no_cuda  -> use_cpu
- evaluation_strategy -> eval_strategy

Update all call sites (train v1/v2 transformers tests, test_train_usage,
test_local_mode, the transformers/pbt_transformers examples). Internal config
dict keys are left as-is; only the kwargs passed to TrainingArguments change.
Both replacements are valid on transformers 4.x as well.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
transformers 5 removed the translation_* pipeline tasks and changed BPE
tokenization spacing, breaking the Serve doc examples:

- Translation examples (getting_started models/translator/model_deployment*,
  translator_example, production_guide/text_ml, develop_and_deploy): replace
  pipeline("translation_en_to_*", model="t5-small") with direct
  AutoModelForSeq2SeqLM + AutoTokenizer + generate() using a task prefix
  ("translate English to French/German/Romanian: ").
- streaming_tutorial: the hardcoded GPT-2 chunk asserts pinned exact tokenizer
  output; replace with "streaming happened" (chunk-count) checks.
- Replace exact-match output asserts with robust checks; model output isn't
  stable across transformers versions (which is what broke here).
- Update getting_started / develop-and-deploy prose to describe the generate()
  flow instead of the removed pipeline's [{"translation_text"}] dict.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
@ArturNiederfahrenhorst
ArturNiederfahrenhorst requested review from a team as code owners June 15, 2026 11:16
ArturNiederfahrenhorst and others added 3 commits June 15, 2026 15:41
…5 pipeline task

transformers 5 removed the summarization pipeline task (same as translation;
the supported-task list has no translation/summarization/text2text-generation).
Migrate the Summarizer examples (getting_started/models, getting_started/
translator, production_guide/text_ml) from pipeline("summarization", ...) to
AutoModelForSeq2SeqLM + AutoTokenizer + generate() with a "summarize: " prefix,
preserving the Summarizer->Translator composition. Fix the dead
SummarizationPipeline doc reference. Asserts use robust non-empty checks.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
evaluate 0.4.3 calls the removed huggingface_hub.hf_api.HfFolder.get_token(),
which breaks GPU train tests (accelerate/glue metrics) under hf-hub 1.x with
AttributeError. evaluate 0.4.6 uses build_hf_headers instead and has an
identical dependency tree. Bump the requirement + compiled files and relock the
affected deplocks.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
…rmers-5 pipeline task

doc/BUILD.bazel runs every serve doc_code/*.py (gradio-integration.py included),
so the pipeline("summarization", model="t5-small") call here breaks the same way
the getting_started Summarizers did under transformers 5. Switch it to
AutoModelForSeq2SeqLM + generate() with a "summarize: " prefix. Also fix the
remaining dead SummarizationPipeline prose reference in getting_started.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
ArturNiederfahrenhorst and others added 2 commits June 15, 2026 15:52
The evaluate 0.4.3 -> 0.4.6 bump propagates to the ml_torchft release-test byod
lock as well; regenerate it so raydepsets --check stays consistent and the
release image doesn't pull the old evaluate that breaks under hf-hub 1.x.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
…l examples

The transformers-5 migration swapped pipeline() for greedy generate(), which
(a) weakened the doc-example asserts to isinstance(x, str), losing the regression
coverage the old exact-string asserts provided, and (b) degraded output quality:
greedy t5-small loops/repeats and truncates mid-phrase without the beam search
the old pipeline applied by default.

Restore num_beams=4, early_stopping=True (the pipeline's behavior) across the
Translator/Summarizer examples, bump the summary to max_new_tokens=20 so it
finishes a phrase, and re-pin the exact transformers-5 outputs (verified by
running t5-small under transformers 5.12). Each assert carries an f"got {x!r}"
message so any divergence self-reports. Update the matching expected-output text
in getting_started.md and kubernetes.md.

Outputs were captured on arm64; CI (x86) confirms them, and the got-message
surfaces any beam-scoring divergence for a one-line re-pin.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>

@dstrodtman dstrodtman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One suggestion to simplify text, and confirming that many docs tests are intentionally changed from deterministic output to slightly broader checks (asserts on types, length, etc.)

Would be useful if you can canonize as much of your flow as possible as an agentic skill and commit this somewhere (either docs subsumed in general external dependency updates, or specific instructions for auditing and updating dependencies for docs and tests). Happy to collaborate.

Comment thread doc/source/serve/getting_started.md Resolved
Per review, remove the f"got {x!r}" messages added alongside the exact-output
pins; keep the plain equality assertions.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
class Translator:
def __init__(self):
# Load model
self.model = pipeline("translation_en_to_fr", model="t5-small")

@ArturNiederfahrenhorst ArturNiederfahrenhorst Jun 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

See https://github.com/huggingface/transformers/blob/main/MIGRATION_GUIDE_V5.md

Such pipelines have been removed. They prepended a small chunk of text. We can get the original behavior by prepending "translate English to French:".

ArturNiederfahrenhorst and others added 2 commits June 15, 2026 17:54
…gs unchanged

Reproduce the exact pre-migration pipeline() outputs with generate() by passing
t5-small's task_specific_params (num_beams=4, early_stopping, length_penalty,
no_repeat_ngram_size) and decoding with clean_up_tokenization_spaces=False
(transformers 5 flipped that decode default to True). This restores the original
output strings, so the assertions and doc console outputs revert to master
verbatim -- no expected-output changes.

Also drop the injected migration-explanation code comments and the
LANGUAGE_TO_PREFIX dict (reconfigure now mirrors the original if/elif), keeping
the diff to the necessary pipeline() -> tokenizer/generate/decode change plus
prose that described the removed pipeline dict output.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
…anslator.py

The summarize generate() in the composition example carried six kwargs. Trim it
to the same shape as the translate() call (num_beams=4, early_stopping=True,
max_length=15) and update the composed example's expected French output to the
string this produces. models.py / text_ml.py keep their faithful reproduction.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
CI surfaced these once the cu13/pytorch-index flakes cleared. Two patterns:

- datasets 4.x requires a namespaced repo id: bare load_dataset("glue", ...) /
  "hf://datasets/glue/cola/" now raise HfUriError/RepositoryNotFoundError. Point
  them at nyu-mll/glue (matching the existing deepspeed_torch_trainer_no_raydata
  fix), and yelp_review_full -> Yelp/yelp_review_full.
- transformers 5 removed the TrainingArguments kwargs evaluation_strategy and
  no_cuda; rename to eval_strategy and use_cpu (same migration already applied to
  the train test files).

Files: accelerate/deepspeed torch trainer examples, transformers_torch_trainer_basic,
checkpoints doc_code, and the huggingface_text_classification / pbt_transformers /
intel_gaudi llama / lightning_cola_advanced notebooks.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
@@ -140,7 +140,7 @@ def collate_fn(batch):
}

# Prepare Ray Datasets
hf_datasets = load_dataset("glue", "mrpc")
hf_datasets = load_dataset("nyu-mll/glue", "mrpc")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@@ -19,7 +19,7 @@
# ====================================================================
def train_func(config):
# Datasets
dataset = load_dataset("yelp_review_full")
dataset = load_dataset("Yelp/yelp_review_full")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same as for the NYU one, this one is canonical.

The Gaudi example isn't run in CI (no bazel target) and isn't locally testable
(needs Habana HPU + optimum-habana, which may pin its own transformers and use
GaudiTrainingArguments), so the evaluation_strategy->eval_strategy rename there
was unverifiable. Restore the original to avoid shipping a blind change.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Empty commit to re-run premerge so the newly-added continuous-build label is
evaluated, running the py3.11/3.12/3.13 suites that validate the transformers-5
/ datasets-4 / hf-hub-1 upgrade across Python versions.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
ArturNiederfahrenhorst added a commit to shorbaji/ray that referenced this pull request Jun 16, 2026
…nto add-lerobot-datasource

Bring the dependency upgrade and example migrations from the upgrade-hf-stack-
datasets4 branch (PR ray-project#64054 work) into the lerobot datasource branch so
read_lerobot can build on datasets 4.x / huggingface-hub 1.x.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
transformers 5 removed the deprecated `tokenizer=` kwarg on `Trainer`
(replaced by `processing_class=` since 4.46), which raised
TypeError: Trainer.__init__() got an unexpected keyword argument 'tokenizer'
in the train v1 gpu notebook test (build ray-project#68368).

Update the two notebooks that still passed it:
- transformers/huggingface_text_classification.ipynb (the failing CI test)
- deepspeed/gptj_deepspeed_fine_tuning.ipynb (gated test; same latent bug)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
ArturNiederfahrenhorst added a commit to shorbaji/ray that referenced this pull request Jun 16, 2026
…datasource

Brings the Trainer(tokenizer=) -> processing_class= fix (PR ray-project#64054) so the
train notebook tests pass on transformers 5.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
…transformers 4.36.2)

gptj_deepspeed_fine_tuning.ipynb pins transformers==4.36.2 (pip cell + runtime_env),
where Trainer's `processing_class` kwarg does not exist (added in 4.46). The notebook
also has no CI test target, so the change went untested. Revert to `tokenizer=`, which
is correct for 4.36.2. The transformers 5 processing_class fix remains in the
CI-executed huggingface_text_classification notebook.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
ArturNiederfahrenhorst added a commit to shorbaji/ray that referenced this pull request Jun 17, 2026
gptj pins transformers 4.36.2 (no processing_class); revert keeps it on
tokenizer=. Brings PR ray-project#64054 c603345.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Pull fresh master (f58b442) to keep the HF stack upgrade PR current.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>

@jeffreywang88 jeffreywang88 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

reviewed serve-related code


# __model_start__
from transformers import pipeline
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is AutoTokenizer + AutoModelForSeq2SeqLM equivalent to pipeline? was pipeline deprecated so we decided to move over to AutoTokenizer + AutoModelForSeq2SeqLM?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks like with pipeline, users don't have to worry about tokenization. is there a equivalent API in the target HF version so that tokenization is abstracted away, matching the original doc code behavior?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also I think the original example is more intuitive to the user

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, they where indeed deprecated but I misread the migration guide at https://github.com/huggingface/transformers/blob/main/MIGRATION_GUIDE_V5.md#text-pipelines-that-should-just-be-llms
It basically tells us to try and use TextGenerationPipeline.
I'll make the changes.

@ArturNiederfahrenhorst ArturNiederfahrenhorst Jun 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Mhhh ok I was a little quick there. The TextgenerationPipeline actually only implements to decoder only architectures. t5 is encoder-decoder.

https://huggingface.co/docs/transformers/en/main_classes/pipelines#transformers.TextGenerationPipeline

https://huggingface.co/docs/transformers/en/model_doc/t5

I ended up trying it out locally and when we use t5 with that last remaining pipeline that HF offers, it emits a warning that it does not work and then proceeds to producing garbage.

I tried to move to a model like Qwen 2.5 0.5. It's a bit larger so will be higher CI cost and it sadly does not handle the tasks very well that we use here. So I propose that I open an issue to investigate the examples that are touched in this PR and consider re-doing them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sounds good, thanks for looking into it!

@@ -8,8 +8,8 @@ xgboost==2.1.0
lightgbm==4.6.0

# Huggingface
transformers==4.36.2
accelerate==0.28.0
transformers>=5.0,<6.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

probably needs @elliot-barn's opinion here -- i believe the general guideline is to prefer pinning

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can you remove the upper bound please

Remove the <6.0 upper bound on transformers in the ML core requirements so
the dependency isn't capped at the 5.x series.

Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@ArturNiederfahrenhorst
ArturNiederfahrenhorst force-pushed the upgrade-hf-stack-datasets4 branch from 276b0d7 to 4dc1e07 Compare June 17, 2026 22:05
@ArturNiederfahrenhorst
ArturNiederfahrenhorst merged commit 95fcc4d into ray-project:master Jun 18, 2026
3 checks passed
ArturNiederfahrenhorst added a commit to shorbaji/ray that referenced this pull request Jun 18, 2026
The HuggingFace stack upgrade (PR ray-project#64054) landed in master. This merge brings it in
so the lerobot PR's diff vs master collapses back to the lerobot changes only.

Conflicts were in the HF dependency files; resolved to master (the canonical merged
HF): core-requirements.txt (+ py313) and the three data deplocks. The data deplocks
now match master and need a raydepsets regen to re-add lerobot (av/lerobot via the
override); raydepsets --check will flag this and the regen yields master-HF + lerobot.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
ArturNiederfahrenhorst added a commit to shorbaji/ray that referenced this pull request Jun 24, 2026
lerobot/av/torchcodec (gated python>=3.12) were dropped from the committed data
locks when the branch merged current master: zarr (ray-project#63003) and the HF stack
upgrade (ray-project#64054) rewrote the same py3.12 locks, and the merge took master's
lerobot-free version while keeping lerobot in data-test-requirements.txt. That
left the lock inconsistent with the .txt, so the py3.12 CI image never installed
lerobot and test_lerobot skip-passed.

Re-ran `raydepsets build ci/raydepsets/configs/ci_data.depsets.yaml` (same relock
as 6321043, with lerobot_overrides.txt). Re-adds lerobot==0.5.1 / av==15.1.0 /
torchcodec==0.10.0 (torch 2.9.0+cpu) to the py3.12 data-base, pyarrow-latest, and
relaxed locks; py3.10/3.11 untouched (gated). Resolves cleanly against master's
HF stack.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
limarkdcunha pushed a commit to limarkdcunha/ray that referenced this pull request Jun 30, 2026
Coordinated bump of Ray's HuggingFace ML stack so it can run on datasets
4.x and huggingface-hub 1.x:

- datasets: ==3.6.0 -> >=4.0.0,<5.0.0 (reverts the ray-project#62926 pin; verified
the dtype regression it worked around in from_huggingface ->
iter_torch_batches does NOT recur with datasets 4.x — the CPU train
transformers tests pass on this branch).
- huggingface-hub: >=0.24.0 -> >=1.0,<2.0.
- transformers: ==4.36.2 -> >=5.0,<6.0, accelerate: ==0.28.0 -> >=1.0.
Every transformers 4.x (through 4.57) hard-caps huggingface-hub <1.0, so
hf-hub 1.x requires transformers 5.x.


For the Ray Serve docs this means that we have to switch from
model.translate(...) to model.generate() (
https://huggingface.co/docs/transformers/en/tasks/translation ) which
impacts the text content around the relevant code changes and makes the
PR bigger.
Also, there is a small number of other places across the libraries that
need attention.

## Follow-ups

- **diffusers vs. transformers 5 in the ML release (BYOD) image:** this
PR brings `transformers==5.11.0` alongside the pre-existing
`diffusers==0.12.1` baseline pin in
`release/ray_release/byod/requirements_ml_byod_3.{10,13}.in`. diffusers
0.12.1 targets the transformers 4.x era and should be upgraded

---------

Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
elliot-barn added a commit that referenced this pull request Jul 29, 2026
…or transformers 5.x (#65062)

## Why are these changes needed?

The `huggingface_accelerate` nightly release test fails at startup with:

```
ImportError: cannot import name 'HybridCache' from 'transformers'
```

Root cause: after the HuggingFace stack upgrade (#64054), the ray-ml
base-extra-testdeps lock pairs `transformers==5.11.0` with
`peft==0.17.1`.
`peft` has no source pin — it is pulled in transitively by `lm_eval` —
so uv
left it at a stale resolution. peft 0.17.x imports `HybridCache` from
transformers at module scope, but transformers 5.x removed that class,
and
transformers' `trainer_utils` imports peft whenever it is installed, so
any
`import transformers` on the image crashes.

Fix: add a `peft>=0.18` floor (0.18 made the `HybridCache` import lazy
and
version-guarded; verified 0.19.1 only references it inside a deferred
Gemma-specific code path) to the ml byod source requirements for both
py3.10
and py3.13, and recompile the affected locks:

-
`python/deplocks/base_extra_testdeps/ray-ml-base_extra_testdeps_py3.10.lock`:
peft 0.17.1 → 0.19.1 (no other resolution changes)
- `release/ray_release/byod/ml_torchft_py3.13.lock`: already resolved
peft 0.19.1; only picks up the new `via` annotation

## Related issue number

N/A — nightly release-test failure (`huggingface_accelerate`, Train
tests group).

## Checks

- [x] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
(pre-commit hooks ran at commit time)
- [ ] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [ ] I've added any new APIs to the API Reference.
- [x] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/

Testing:
- Locks regenerated with `bazel run //ci/raydepsets:raydepsets -- build
ci/raydepsets/configs/rayimg.depsets.yaml --name
ray_ml_base_extra_testdeps_cuda_310` and `... build
ci/raydepsets/configs/release_ml_torchft_tests.depsets.yaml` (both
compiled successfully; diffs are minimal as described above).
- Verified against the peft 0.19.1 wheel that `peft/peft_model.py` no
longer imports `HybridCache` at module scope.
- End-to-end verification requires a nightly image rebuild +
release-test run of `huggingface_accelerate`.

AI assistance: this PR was prepared with AI assistance (Claude Code); I
reviewed every changed line. Not a duplicate: searched open PRs for
`peft` and `huggingface_accelerate` — no existing PR addresses this
failure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


Successful release test run:
https://buildkite.com/ray-project/release/builds/102272/canvas

---------

Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
elliot-barn added a commit that referenced this pull request Jul 29, 2026
…oor peft>=0.18 for transformers 5.x (#65062) (#65101)

Cherry-pick of #65062 onto `releases/2.57.0`.

## Why are these changes needed?

The `huggingface_accelerate` nightly release test fails at startup with:

```
ImportError: cannot import name 'HybridCache' from 'transformers'
```

Root cause: after the HuggingFace stack upgrade (#64054), the ray-ml
base-extra-testdeps lock pairs `transformers==5.11.0` with
`peft==0.17.1`. `peft` has no source pin — it is pulled in transitively
by `lm_eval` — so uv left it at a stale resolution. peft 0.17.x imports
`HybridCache` from transformers at module scope, but transformers 5.x
removed that class, and transformers' `trainer_utils` imports peft
whenever it is installed, so any `import transformers` on the image
crashes.

Fix: add a `peft>=0.18` floor (0.18 made the `HybridCache` import lazy
and version-guarded) to the ml byod source requirements for both py3.10
and py3.13, and recompile the affected locks.

Clean cherry-pick of merge commit
6e160e6 — no conflicts, diff identical
to master.

Successful release test run on master:
https://buildkite.com/ray-project/release/builds/102272/canvas

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Artimislyy pushed a commit to Artimislyy/ray that referenced this pull request Aug 11, 2026
…or transformers 5.x (ray-project#65062)

## Why are these changes needed?

The `huggingface_accelerate` nightly release test fails at startup with:

```
ImportError: cannot import name 'HybridCache' from 'transformers'
```

Root cause: after the HuggingFace stack upgrade (ray-project#64054), the ray-ml
base-extra-testdeps lock pairs `transformers==5.11.0` with
`peft==0.17.1`.
`peft` has no source pin — it is pulled in transitively by `lm_eval` —
so uv
left it at a stale resolution. peft 0.17.x imports `HybridCache` from
transformers at module scope, but transformers 5.x removed that class,
and
transformers' `trainer_utils` imports peft whenever it is installed, so
any
`import transformers` on the image crashes.

Fix: add a `peft>=0.18` floor (0.18 made the `HybridCache` import lazy
and
version-guarded; verified 0.19.1 only references it inside a deferred
Gemma-specific code path) to the ml byod source requirements for both
py3.10
and py3.13, and recompile the affected locks:

-
`python/deplocks/base_extra_testdeps/ray-ml-base_extra_testdeps_py3.10.lock`:
peft 0.17.1 → 0.19.1 (no other resolution changes)
- `release/ray_release/byod/ml_torchft_py3.13.lock`: already resolved
peft 0.19.1; only picks up the new `via` annotation

## Related issue number

N/A — nightly release-test failure (`huggingface_accelerate`, Train
tests group).

## Checks

- [x] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
(pre-commit hooks ran at commit time)
- [ ] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [ ] I've added any new APIs to the API Reference.
- [x] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/

Testing:
- Locks regenerated with `bazel run //ci/raydepsets:raydepsets -- build
ci/raydepsets/configs/rayimg.depsets.yaml --name
ray_ml_base_extra_testdeps_cuda_310` and `... build
ci/raydepsets/configs/release_ml_torchft_tests.depsets.yaml` (both
compiled successfully; diffs are minimal as described above).
- Verified against the peft 0.19.1 wheel that `peft/peft_model.py` no
longer imports `HybridCache` at module scope.
- End-to-end verification requires a nightly image rebuild +
release-test run of `huggingface_accelerate`.

AI assistance: this PR was prepared with AI assistance (Claude Code); I
reviewed every changed line. Not a duplicate: searched open PRs for
`peft` and `huggingface_accelerate` — no existing PR addresses this
failure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


Successful release test run:
https://buildkite.com/ray-project/release/builds/102272/canvas

---------

Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
Coordinated bump of Ray's HuggingFace ML stack so it can run on datasets
4.x and huggingface-hub 1.x:

- datasets: ==3.6.0 -> >=4.0.0,<5.0.0 (reverts the ray-project#62926 pin; verified
the dtype regression it worked around in from_huggingface ->
iter_torch_batches does NOT recur with datasets 4.x — the CPU train
transformers tests pass on this branch).
- huggingface-hub: >=0.24.0 -> >=1.0,<2.0.
- transformers: ==4.36.2 -> >=5.0,<6.0, accelerate: ==0.28.0 -> >=1.0.
Every transformers 4.x (through 4.57) hard-caps huggingface-hub <1.0, so
hf-hub 1.x requires transformers 5.x.

For the Ray Serve docs this means that we have to switch from
model.translate(...) to model.generate() (
https://huggingface.co/docs/transformers/en/tasks/translation ) which
impacts the text content around the relevant code changes and makes the
PR bigger.
Also, there is a small number of other places across the libraries that
need attention.

## Follow-ups

- **diffusers vs. transformers 5 in the ML release (BYOD) image:** this
PR brings `transformers==5.11.0` alongside the pre-existing
`diffusers==0.12.1` baseline pin in
`release/ray_release/byod/requirements_ml_byod_3.{10,13}.in`. diffusers
0.12.1 targets the transformers 4.x era and should be upgraded

---------

Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: 400Ping <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…or transformers 5.x (ray-project#65062)

## Why are these changes needed?

The `huggingface_accelerate` nightly release test fails at startup with:

```
ImportError: cannot import name 'HybridCache' from 'transformers'
```

Root cause: after the HuggingFace stack upgrade (ray-project#64054), the ray-ml
base-extra-testdeps lock pairs `transformers==5.11.0` with
`peft==0.17.1`.
`peft` has no source pin — it is pulled in transitively by `lm_eval` —
so uv
left it at a stale resolution. peft 0.17.x imports `HybridCache` from
transformers at module scope, but transformers 5.x removed that class,
and
transformers' `trainer_utils` imports peft whenever it is installed, so
any
`import transformers` on the image crashes.

Fix: add a `peft>=0.18` floor (0.18 made the `HybridCache` import lazy
and
version-guarded; verified 0.19.1 only references it inside a deferred
Gemma-specific code path) to the ml byod source requirements for both
py3.10
and py3.13, and recompile the affected locks:

-
`python/deplocks/base_extra_testdeps/ray-ml-base_extra_testdeps_py3.10.lock`:
peft 0.17.1 → 0.19.1 (no other resolution changes)
- `release/ray_release/byod/ml_torchft_py3.13.lock`: already resolved
peft 0.19.1; only picks up the new `via` annotation

## Related issue number

N/A — nightly release-test failure (`huggingface_accelerate`, Train
tests group).

## Checks

- [x] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
(pre-commit hooks ran at commit time)
- [ ] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [ ] I've added any new APIs to the API Reference.
- [x] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/

Testing:
- Locks regenerated with `bazel run //ci/raydepsets:raydepsets -- build
ci/raydepsets/configs/rayimg.depsets.yaml --name
ray_ml_base_extra_testdeps_cuda_310` and `... build
ci/raydepsets/configs/release_ml_torchft_tests.depsets.yaml` (both
compiled successfully; diffs are minimal as described above).
- Verified against the peft 0.19.1 wheel that `peft/peft_model.py` no
longer imports `HybridCache` at module scope.
- End-to-end verification requires a nightly image rebuild +
release-test run of `huggingface_accelerate`.

AI assistance: this PR was prepared with AI assistance (Claude Code); I
reviewed every changed line. Not a duplicate: searched open PRs for
`peft` and `huggingface_accelerate` — no existing PR addresses this
failure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Successful release test run:
https://buildkite.com/ray-project/release/builds/102272/canvas

---------

Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Signed-off-by: 400Ping <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…or transformers 5.x (ray-project#65062)

## Why are these changes needed?

The `huggingface_accelerate` nightly release test fails at startup with:

```
ImportError: cannot import name 'HybridCache' from 'transformers'
```

Root cause: after the HuggingFace stack upgrade (ray-project#64054), the ray-ml
base-extra-testdeps lock pairs `transformers==5.11.0` with
`peft==0.17.1`.
`peft` has no source pin — it is pulled in transitively by `lm_eval` —
so uv
left it at a stale resolution. peft 0.17.x imports `HybridCache` from
transformers at module scope, but transformers 5.x removed that class,
and
transformers' `trainer_utils` imports peft whenever it is installed, so
any
`import transformers` on the image crashes.

Fix: add a `peft>=0.18` floor (0.18 made the `HybridCache` import lazy
and
version-guarded; verified 0.19.1 only references it inside a deferred
Gemma-specific code path) to the ml byod source requirements for both
py3.10
and py3.13, and recompile the affected locks:

-
`python/deplocks/base_extra_testdeps/ray-ml-base_extra_testdeps_py3.10.lock`:
peft 0.17.1 → 0.19.1 (no other resolution changes)
- `release/ray_release/byod/ml_torchft_py3.13.lock`: already resolved
peft 0.19.1; only picks up the new `via` annotation

## Related issue number

N/A — nightly release-test failure (`huggingface_accelerate`, Train
tests group).

## Checks

- [x] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
(pre-commit hooks ran at commit time)
- [ ] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [ ] I've added any new APIs to the API Reference.
- [x] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/

Testing:
- Locks regenerated with `bazel run //ci/raydepsets:raydepsets -- build
ci/raydepsets/configs/rayimg.depsets.yaml --name
ray_ml_base_extra_testdeps_cuda_310` and `... build
ci/raydepsets/configs/release_ml_torchft_tests.depsets.yaml` (both
compiled successfully; diffs are minimal as described above).
- Verified against the peft 0.19.1 wheel that `peft/peft_model.py` no
longer imports `HybridCache` at module scope.
- End-to-end verification requires a nightly image rebuild +
release-test run of `huggingface_accelerate`.

AI assistance: this PR was prepared with AI assistance (Claude Code); I
reviewed every changed line. Not a duplicate: searched open PRs for
`peft` and `huggingface_accelerate` — no existing PR addresses this
failure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


Successful release test run:
https://buildkite.com/ray-project/release/builds/102272/canvas

---------

Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

continuous-build data Ray Data-related issues go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants