Skip to content

[deps] Pin datasets==3.6.0 in py313 train-requirements - #62926

Merged
elliot-barn merged 2 commits into
masterfrom
elliot-barn-fix-pin-datasets-3-6-0
Apr 28, 2026
Merged

elliot-barn merged 2 commits into
masterfrom
elliot-barn-fix-pin-datasets-3-6-0

Conversation

@elliot-barn

Copy link
Copy Markdown
Collaborator

requirements_compiled_py3.13.txt resolved datasets to 4.8.4 on this branch; master's py3.13 compiled file resolves 3.6.0. HF datasets 4.0 (July 2025) was a major break — removed script-based dataset support and changed schema/dtype behavior that cascades into ray.data.from_huggingface → iter_torch_batches → accelerate's gather_for_metrics.

traingputests / traingpu2tests shards fail deterministically on //python/ray/train:accelerate_torch_trainer and
:accelerate_torch_trainer_no_raydata with:

File ".../evaluate_modules/.../glue.py", line 84, in simple_accuracy
    return float((preds == labels).mean())
AttributeError: 'bool' object has no attribute 'mean'

This surfaces when metric.add_batch is never called (or preds and refs end up as scalars), so [] == [] in the glue accuracy fn returns a Python bool instead of an ndarray. Pinning datasets to 3.6.0 matches the last-known-good CI baseline on master.

requirements_compiled_py3.13.txt resolved `datasets` to 4.8.4 on this
branch; master's py3.13 compiled file resolves 3.6.0. HF datasets 4.0
(July 2025) was a major break — removed script-based dataset support
and changed schema/dtype behavior that cascades into
ray.data.from_huggingface → iter_torch_batches → accelerate's
gather_for_metrics.

traingputests / traingpu2tests shards fail deterministically on
//python/ray/train:accelerate_torch_trainer and
:accelerate_torch_trainer_no_raydata with:

    File ".../evaluate_modules/.../glue.py", line 84, in simple_accuracy
        return float((preds == labels).mean())
    AttributeError: 'bool' object has no attribute 'mean'

This surfaces when `metric.add_batch` is never called (or preds and
refs end up as scalars), so `[] == []` in the glue accuracy fn returns
a Python bool instead of an ndarray. Pinning datasets to 3.6.0 matches
the last-known-good CI baseline on master.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
@elliot-barn
elliot-barn requested a review from aslonnie April 24, 2026 21:42

@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 pins the datasets library to version 3.6.0 in the Python 3.13 training requirements. The review feedback indicates that this pin should be moved to the base requirements file to ensure it is correctly incorporated during dependency compilation and to maintain consistency across all Python versions.

accelerate>=0.20.1
deepspeed>=0.12.3
datasets
datasets==3.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.

high

Pinning datasets in this py313-specific file may not be effective or sufficient for two reasons:

  1. Compilation Path: The python/requirements_compiled_py3.13.txt file appears to be generated from the base python/requirements/ml/train-requirements.txt rather than this file. The # via annotations in the compiled file (e.g., line 433) confirm it pulls from the parent directory. Consequently, this change might be ignored during the next dependency resolution.
  2. Scope of Regression: Since the breakage in datasets 4.0 is a major behavioral change affecting core components like ray.data and evaluation metrics, it is safer to pin datasets==3.6.0 in the base python/requirements/ml/train-requirements.txt. This ensures all Python versions are protected from this regression upon re-compilation.

Consider moving this pin to the base requirement file and verifying that the compiled outputs are updated accordingly.

@ray-gardener ray-gardener Bot added the train Ray Train Related Issue label Apr 25, 2026
@elliot-barn elliot-barn added the go add ONLY when ready to merge, run all tests label Apr 28, 2026
@elliot-barn
elliot-barn merged commit 8a6ce08 into master Apr 28, 2026
4 checks passed
@elliot-barn
elliot-barn deleted the elliot-barn-fix-pin-datasets-3-6-0 branch April 28, 2026 16:35
Lucas61000 pushed a commit to Lucas61000/ray that referenced this pull request May 15, 2026
…2926)

requirements_compiled_py3.13.txt resolved `datasets` to 4.8.4 on this
branch; master's py3.13 compiled file resolves 3.6.0. HF datasets 4.0
(July 2025) was a major break — removed script-based dataset support and
changed schema/dtype behavior that cascades into
ray.data.from_huggingface → iter_torch_batches → accelerate's
gather_for_metrics.

traingputests / traingpu2tests shards fail deterministically on
//python/ray/train:accelerate_torch_trainer and
:accelerate_torch_trainer_no_raydata with:

    File ".../evaluate_modules/.../glue.py", line 84, in simple_accuracy
        return float((preds == labels).mean())
    AttributeError: 'bool' object has no attribute 'mean'

This surfaces when `metric.add_batch` is never called (or preds and refs
end up as scalars), so `[] == []` in the glue accuracy fn returns a
Python bool instead of an ndarray. Pinning datasets to 3.6.0 matches the
last-known-good CI baseline on master.

Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
ArturNiederfahrenhorst added a commit to shorbaji/ray that referenced this pull request Jun 12, 2026
…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 added a commit that referenced this pull request Jun 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 #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]>
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]>
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests train Ray Train Related Issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants