Skip to content

Conversation

@Prince213
Copy link

@Prince213 Prince213 commented Oct 23, 2025

This PR fixes the following error:

______ BackendsTest.test_no_backend_warning_on_cpu_if_platform_specified _______
[gw0] linux -- Python 3.12.11 /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-python3-3.12.11/bin/python3.12

self = <tests.api_test.BackendsTest testMethod=test_no_backend_warning_on_cpu_if_platform_specified>

    @unittest.skipIf(not sys.executable, "test requires sys.executable")
    @jtu.run_on_devices("cpu")
    def test_no_backend_warning_on_cpu_if_platform_specified(self):
      warning_not_expected = (
        "import jax; "
        "jax.config.update('jax_platform_name', 'cpu'); "
        "jax.numpy.arange(10)")

      result = subprocess.run([sys.executable, '-c', warning_not_expected],
                              check=True, capture_output=True)
>     assert "may be present" not in result.stderr.decode()
E     AssertionError: assert 'may be present' not in 'ERROR:2025-...ck to cpu.\n'
E
E       'may be present' is contained here:
E         VIDIA GPU may be present on this machine, but a CUDA-enabled jaxlib is not installed. Falling back to cpu.
E       ?           ++++++++++++++

tests/api_test.py:7632: AssertionError
=========================== short test summary info ============================
FAILED tests/api_test.py::BackendsTest::test_no_backend_warning_on_cpu_if_platform_specified - AssertionError: assert 'may be present' not in 'ERROR:2025-...ck to cpu.\n'

  'may be present' is contained here:
    VIDIA GPU may be present on this machine, but a CUDA-enabled jaxlib is not installed. Falling back to cpu.
  ?           ++++++++++++++
========= 1 failed, 29959 passed, 20204 skipped in 2379.18s (0:39:39) ==========

@google-cla
Copy link

google-cla bot commented Oct 23, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Prince213, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses the use of a deprecated JAX configuration setting within a test file. It updates the jax.config.update call to use the currently supported jax_platforms key instead of the older jax_platform_name, ensuring the test remains functional and aligned with modern JAX library practices. This is a maintenance fix to prevent potential warnings or errors related to deprecated features.

Highlights

  • JAX Configuration Update: Replaced the deprecated jax_platform_name configuration key with the current jax_platforms within a test case to ensure compatibility with the latest JAX API.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 correctly replaces the deprecated jax_platform_name configuration option with the new jax_platforms option in a test case. The change is straightforward and helps keep the codebase up-to-date by removing usage of deprecated APIs. The implementation is sound, and I have no further comments.

Copy link
Collaborator

@superbobry superbobry left a comment

Choose a reason for hiding this comment

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

Thanks!

@google-ml-butler google-ml-butler bot added kokoro:force-run pull ready Ready for copybara import and testing labels Oct 23, 2025
@superbobry
Copy link
Collaborator

Can you sign the CLA, please? I'm afraid we won't be able to merge the PR otherwise.

@Prince213
Copy link
Author

The test failures look like they were false positives before, as the flag isn't actually respected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kokoro:force-run pull ready Ready for copybara import and testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants