Skip to content

Replace 'with mesh' with 'with jax.set_mesh(mesh)'#4034

Open
SurbhiJainUSC wants to merge 1 commit into
mainfrom
with_mesh_upgrade
Open

Replace 'with mesh' with 'with jax.set_mesh(mesh)'#4034
SurbhiJainUSC wants to merge 1 commit into
mainfrom
with_mesh_upgrade

Conversation

@SurbhiJainUSC
Copy link
Copy Markdown
Collaborator

@SurbhiJainUSC SurbhiJainUSC commented Jun 1, 2026

Description

This PR replaces the usage of the with mesh context manager with the newer with jax.set_mesh(mesh) API across the MaxText codebase. This change is being made to address JAX deprecation warnings.

Fixes: b/470443463

Tests

SFT:

python3 -m maxtext.trainers.post_train.sft.train_sft \
model_name=llama3.1-8b-Instruct \
load_parameters_path=gs://maxtext-model-checkpoints/llama3.1_8b_instruct/2025-10-16/scanned/0/items \
run_name=$RUN_NAME \
base_output_directory=$BASE_OUTPUT_DIRECTORY \
steps=2

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, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../trainers/post_train/distillation/train_distill.py 0.00% 1 Missing ⚠️
src/maxtext/utils/lora_utils.py 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@richjames0 richjames0 left a comment

Choose a reason for hiding this comment

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

lgtm

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.

5 participants