Skip to content

Moved tunix to setup.sh to only install when DEVICE=tpu - #2394

Merged
copybara-service[bot] merged 1 commit into
mainfrom
rbierneni-move-tunix-installation
Sep 25, 2025
Merged

Moved tunix to setup.sh to only install when DEVICE=tpu#2394
copybara-service[bot] merged 1 commit into
mainfrom
rbierneni-move-tunix-installation

Conversation

@Rohan-Bierneni

@Rohan-Bierneni Rohan-Bierneni commented Sep 24, 2025

Copy link
Copy Markdown
Collaborator

Description

Tunix has a requirement on jax[tpu], which is causing errors and bugs in setting up maxtext environment for GPUs since it is in requirements.txt.

When using the JAX AI Image flow, since jax is installed as part of the image and tunix is installed when using JAX AI Image as a base image, there is a weird bug where libtpu is being installed in the final maxtext GPU image. This is probably due to jax and tunix not being installed in the same step, which would normally throw an error but is hidden in this 2-stage flow.

When using setup.sh, since both jax[cuda12] and tunix are being installed in the same step, pip correctly recognizes that tunix depends on jax[tpu] and will throw an error here.

To fix this, we will move tuni from requirements.txt to setup.sh and install the pinned commit when MODE=stable and the unpinned repo when MODE=nightly. We already do something similar for transformer_engine which is a gpu-only dependency.

Note: when tunix supports GPUs, we can move it back to requirements.txt
Note2: Added a small change for migration to jax-ai-image from jax-stable-stack in the entrypoint for JAX AI Images.

Tests

Gpu image built in the unit test run does not contain libtpu: https://screenshot.googleplex.com/AxYbecHHimTdRx8

Tpu image has tunix installed: https://screenshot.googleplex.com/3JM78mv6ZJR76ju

PR is working as intended

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Hi @parambole, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

@RissyRan

RissyRan commented Sep 24, 2025

Copy link
Copy Markdown
Collaborator

It seems this label doesn't work here, but works as expected in other PR. Wondering if it's due to the draft status?

Updated: tried another PR in ready status (not draft), and it works well.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Hi @shuningjin, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

@Rohan-Bierneni
Rohan-Bierneni force-pushed the rbierneni-move-tunix-installation branch 2 times, most recently from d116300 to 87b8edc Compare September 25, 2025 18:26
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Hi @RissyRan, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

@github-actions github-actions 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.

📋 Review Summary

This pull request correctly moves the tunix dependency from the general requirements to be installed only in TPU environments. This resolves an issue with GPU environment setup. The changes in the Dockerfile and setup.sh are consistent and well-implemented.

🔍 General Feedback

  • The conditional installation of tunix is a good solution to handle environment-specific dependencies.
  • The code is clean and the changes are easy to understand.

Removed tunix from requirements files

Install tunix if device=tpu

Mark tunix-based tests as tpu-only

Ignore sft hooks test for gpu tests
@Rohan-Bierneni
Rohan-Bierneni force-pushed the rbierneni-move-tunix-installation branch from e0ef316 to 38f38dd Compare September 25, 2025 20:27

@parambole parambole left a comment

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.

LGTM. Thank you for the quick fix.

@copybara-service
copybara-service Bot merged commit 659e1de into main Sep 25, 2025
42 checks passed
@copybara-service
copybara-service Bot deleted the rbierneni-move-tunix-installation branch September 25, 2025 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants