Skip to content

Fixes for sklearn 1.9 release - #8208

Merged
csadorf merged 3 commits into
NVIDIA:release/26.06from
jcrist:exact-pin-sklearn-in-accel-upstream-ci
Jun 3, 2026
Merged

Fixes for sklearn 1.9 release#8208
csadorf merged 3 commits into
NVIDIA:release/26.06from
jcrist:exact-pin-sklearn-in-accel-upstream-ci

Conversation

@jcrist

@jcrist jcrist commented Jun 2, 2026

Copy link
Copy Markdown
Member

This does 2 things to provide minimal but adequate support for the just released sklearn 1.9:

Pins sklearn in our upstream test runs

We previously exact pinned the intermediate and oldest dep runs, but left the latest run to be unbounded. This can cause CI to fail when sklearn releases a new version.

For normal test runs I think we want this. We're pretty flexible with sklearn compat in cuml core, so we don't anticipate large breakage with each sklearn release.

The upstream sklearn tests run with cuml.accel are a different story. Our test infra is tightly coupled to the tests shipped with each version of sklearn. Since tests are (rightfully) not a public interface, these can change wildly between sklearn versions, leading to more effort to update our xfails and CI setup with each release.

This change:

  • Updates our CI setup to pin the sklearn version used in all upstream sklearn test runs (oldest, intermediate, and latest)
  • Applies this to both the conda-python-scikit-learn-accel-tests runs and the conda-python-sklearn-example-tests runs.
  • Drops the intermediate pinnings from test_python. This wasn't necessary, intermediate deps are only used for sklearn upstream runs and not any other test run. It's cleaner to keep this list specific to the upstream test setup.

Fixes #8206.

Adds support for sklearn.callbacks in cuml.accel

This adds plumbing support for sklearn.callbacks in cuml.accel. Only 2 non-meta-estimators currently support this in sklearn (LogisticRegression and StandardScaler). In cases where a callback is configured on either of these we now fallback to CPU. For other cases where accelerated estimators are wrapped in meta-estimators that have a callback configured we don't fall back and everything works appropriately.

Fixes #8209.


With this PR we are assured that:

  • All of our tests for cuml itself still pass with the new sklearn 1.9
  • All of the tests we wrote in cuml_accel_tests for cuml.accel pass with sklearn 1.9
  • CI continues to pass for our sklearn upstream tests. Notably we don't ensure the upstream tests pass with sklearn 1.9 since this requires more effort than seems feasible for today given our imminent release. I don't anticipate major incompatibilities within this release though, so this should be enough to say we have compatibility with sklearn 1.9.

We previously exact pinned the `intermediate` and `oldest` dep runs, but
left the `latest` run to be unbounded. This can cause CI to fail when
sklearn releases a new version.

For _normal_ test runs I think we want this. We're pretty flexible with
sklearn compat in cuml core, so we don't anticipate large breakage with
each sklearn release.

The upstream sklearn tests run with `cuml.accel` are a different story.
Our test infra is tightly coupled to the tests shipped with each version
of sklearn. Since tests are (rightfully) not a public interface, these
can change wildly between sklearn versions, leading to more effort to
update our xfails and CI setup with each release.

This change:

- Updates our CI setup to pin the sklearn version used in all upstream
  sklearn test runs (oldest, intermediate, and latest)
- Applies this to both the `conda-python-scikit-learn-accel-tests` runs
  and the `conda-python-sklearn-example-tests` runs.
- Drops the `intermediate` pinnings from `test_python`. This wasn't
  necessary, intermediate deps are only used for sklearn upstream runs
  and not any other test run. It's cleaner to keep this list specific to
  the upstream test setup.
@jcrist jcrist self-assigned this Jun 2, 2026
@jcrist jcrist added the improvement Improvement / enhancement to an existing function label Jun 2, 2026
@jcrist
jcrist requested review from a team as code owners June 2, 2026 15:40
@jcrist jcrist added the non-breaking Non-breaking change label Jun 2, 2026
@jcrist
jcrist requested a review from jameslamb June 2, 2026 15:40
@github-actions github-actions Bot added the ci label Jun 2, 2026
@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 806ab50a-5f5e-43ec-a0d8-7edce2e5cca8

📥 Commits

Reviewing files that changed from the base of the PR and between 287a27a and 0782a1b.

📒 Files selected for processing (1)
  • python/cuml/cuml_accel_tests/test_estimator_proxy.py

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Enhanced callback support for GPU-accelerated estimators with automatic CPU fallback when callbacks are configured.
  • Bug Fixes

    • Improved scikit-learn callback handling in GPU dispatch to ensure correct fallback and state sync between CPU/GPU.
  • Documentation

    • Clarified GPU-acceleration limitations for callback usage on LogisticRegression and StandardScaler.
  • Tests

    • Added coverage for callback behavior, fallback paths, and representation robustness.
  • Chores

    • Updated pinned scikit-learn version matrix for supported compatibility.

Walkthrough

Adds a pinned scikit-learn dependency entry and exposes it to CI test scripts, and implements callback-aware ProxyBase changes that route callbacks to CPU, enforce GPU rejection when callbacks exist, sync state on partial_fit fallback, plus gated tests and docs noting CPU fallbacks.

Changes

Scikit-learn dependency management

Layer / File(s) Summary
Dependency configuration and file wiring
dependencies.yaml
Adds test_python_accel_sklearn files entry and a new dependencies.test_python_accel_sklearn block that exact-pins scikit-learn (1.8.0, 1.7.2, 1.5.0); removes legacy pinned packages from dependencies.test_python intermediate.
Test script environment variable exports
ci/test_python_scikit_learn_tests.sh, ci/test_python_sklearn_examples.sh
Both scripts export DEPENDENCY_FILE_KEY=test_python_accel_sklearn early so sourced/shared test utilities and invoked tooling see the dependency key.

Proxy callback routing, fallback, and tests

Layer / File(s) Summary
ProxyBase callback routing and CPU reset
python/cuml/cuml/accel/estimator_proxy.py
Adds ProxyBase._reset_cpu() and _gpu_set_callbacks(), routes _parent_callback_ctx/_skl_callbacks attribute access to the CPU estimator, and redirects assignments/deletions to CPU; adds GPU dispatch precondition rejecting callback-bearing estimators.
Fit/partial_fit flow and GPU-failure handling
python/cuml/cuml/accel/estimator_proxy.py
Use _reset_cpu() in fit/partial_fit transitions, sync fit attributes from GPU back to CPU before dropping GPU model on partial_fit failure, and replace manual clone/reset with the centralized helper.
Tests and documentation
python/cuml/cuml_accel_tests/test_estimator_proxy.py, docs/source/cuml-accel/limitations.rst
Add SKLEARN_19 gate and three set_callbacks tests; update repr tests to tolerate UnicodeDecodeError; document CPU-fallback for LogisticRegression and StandardScaler when callbacks are configured.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

cuml-accel, sklearn-api-compat

Suggested reviewers

  • csadorf
  • dantegd
  • divyegala
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: addressing sklearn 1.9 release compatibility through two key fixes.
Description check ✅ Passed The description clearly explains both major changes (pinning sklearn versions in CI and adding sklearn.callbacks support) and references the fixed issues.
Linked Issues check ✅ Passed Changes fully address both linked issues: pins sklearn in upstream tests (#8206) and implements callback support with CPU fallback for affected estimators (#8209).
Out of Scope Changes check ✅ Passed All changes are within scope: CI configuration updates directly support pinning sklearn, callback plumbing and tests directly fix callback-related failures, and documentation updates address callback limitations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@csadorf csadorf linked an issue Jun 2, 2026 that may be closed by this pull request
@jcrist
jcrist requested a review from a team as a code owner June 2, 2026 19:48
@jcrist
jcrist requested a review from divyegala June 2, 2026 19:48
@github-actions github-actions Bot added the Cython / Python Cython or Python issue label Jun 2, 2026
@jcrist jcrist changed the title Exact pin sklearn version used for running upstream sklearn tests Fixes for sklearn 1.9 release Jun 2, 2026
@jcrist
jcrist requested review from csadorf and removed request for divyegala June 2, 2026 19:51

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 `@python/cuml/cuml/accel/estimator_proxy.py`:
- Around line 389-392: The current guard that checks getattr(self._cpu,
"_skl_callbacks", ()) is too broad and forces all methods
(predict/transform/score) to fall back to CPU; change the logic so the
UnsupportedOnGPU is raised only inside fit and partial_fit paths (methods named
fit and partial_fit) when callbacks are present, and in shared dispatch
code/checks (the place referencing reason) short-circuit GPU dispatch only if a
dispatch "reason" is already set (i.e., skip re-checking/forcing CPU when
self._reason exists). Apply the same targeted change where the duplicate guard
appears (the other block around lines 467-472) so callback rejection is limited
to fit-like methods and other methods respect an existing reason flag rather
than unconditionally falling back.
🪄 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: Enterprise

Run ID: 7e8cd233-0434-4ad4-9649-12158a847c91

📥 Commits

Reviewing files that changed from the base of the PR and between 1b895e1 and 49bf40b.

📒 Files selected for processing (3)
  • docs/source/cuml-accel/limitations.rst
  • python/cuml/cuml/accel/estimator_proxy.py
  • python/cuml/cuml_accel_tests/test_estimator_proxy.py

Comment thread python/cuml/cuml/accel/estimator_proxy.py Outdated
@jcrist
jcrist force-pushed the exact-pin-sklearn-in-accel-upstream-ci branch from 49bf40b to 03c1683 Compare June 2, 2026 19:59
We don't support these configured directly on any of our proxy
estimators. This plumbing just ensures that things don't error.

For example, configuring a `ProgressBar(0)` on a pipeline won't cause
CPU fallback, but a `ProgressBar(None)` (recurses into all
sub-estimators) will. In future releases once the callbacks API has
stabilized we might add direct support.
@jcrist
jcrist force-pushed the exact-pin-sklearn-in-accel-upstream-ci branch from 03c1683 to 287a27a Compare June 2, 2026 20:09
Comment thread dependencies.yaml

@jameslamb jameslamb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Left one very small suggestion for improvement, but overall I'm supportive of this. Do anything you want with that comment. Thanks for the clear description!

Comment thread dependencies.yaml
# machine, but :shrug:. All we care about is that things are plumbed
# properly, so ignoring this error here for now. This is repeated twice
# below as well.
# See https://github.com/rapidsai/cuml/issues/8212.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We're seeing a new issue where the _repr_mimebundle_ call (which is fully sklearn code) now fails on one CI run. I suspect a misconfigured CI machine. For now we're skipping the failure mode that occurs here to move on, opened an issue to track: #8212

@csadorf
csadorf merged commit d98c77e into NVIDIA:release/26.06 Jun 3, 2026
102 checks passed
@jcrist
jcrist deleted the exact-pin-sklearn-in-accel-upstream-ci branch June 3, 2026 00:31
@coderabbitai coderabbitai Bot mentioned this pull request Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Cython / Python Cython or Python issue improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] scikit-learn 1.9 breaks upstream accel xfail matching

5 participants