Skip to content

Remove --parallel_threads flag from to_huggingface.py - #4977

Open
chiajunglien wants to merge 1 commit into
mainfrom
emma/remove-parallel-flag
Open

Remove --parallel_threads flag from to_huggingface.py#4977
chiajunglien wants to merge 1 commit into
mainfrom
emma/remove-parallel-flag

Conversation

@chiajunglien

Copy link
Copy Markdown
Collaborator

Description

This PR removes the exposed --parallel_threads command-line flag from src/maxtext/checkpoint_conversion/to_huggingface.py and cleans up its arguments.

The --parallel_threads flag was originally introduced to explicitly limit concurrency in the E2E testing script (test_llama3.1_70b_to_hf.sh) to prevent OOM errors on smaller memory profiles like v5p-8.

Since that script was subsequently refactored to use alternative memory optimization techniques and no longer passes --parallel_threads=2, keeping this isolated flag implementation in to_huggingface.py is obsolete.

Tests

xpk workload create \
  --cluster=mlperf-v5p \
  --workload=llama-hf-3 \
  --device-type=v5p-8 \
  --num-slices=1 \
  --docker-image=[gcr.io/tpu-prod-env-multipod/maxtext_post_training_stable:32316847848](http://gcr.io/tpu-prod-env-multipod/maxtext_post_training_stable:32316847848) \
  --project=cloud-tpu-multipod-dev \
  --zone=europe-west4-b \
  --priority=very-high \
  --skip-validation \
  --env GCS_OUTPUT=gs://ml-auto-solutions/output/unowned/to-hf-v5p-8-2026-08-19-01-47-34/ \
  --command="set -xue; export HF_HOME=/dev/shm/hf_cache; export LIBTPU_INIT_ARGS="--xla_tpu_scoped_vmem_limit_kib=20480"; python3 -m maxtext.checkpoint_conversion.to_huggingface model_name=llama3.1-70b tokenizer_type=huggingface load_parameters_path=gs://runner-maxtext-logs/llama3.1-70b/sft/e2e-32200790571/checkpoints/2/model_params base_output_directory=gs://runner-maxtext-logs/llama3.1-70b/to_huggingface/scanned/e2e-32200790571 use_multimodal=false scan_layers=true weight_dtype=bfloat16 checkpoint_storage_concurrent_gb=48 checkpoint_storage_use_zarr3=False checkpoint_storage_use_ocdbt=False skip_jax_distributed_system=true"

Log: https://cloudlogging.app.goo.gl/Wh68u2VnKSo3hw9u7

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.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request removes the "parallel_threads" command-line flag and its validator from "to_huggingface.py". However, this change will cause a runtime "AttributeError" because "FLAGS.parallel_threads" is still referenced in a downstream call to "save_model_files". You should remove this argument from the function call to allow it to use its default value.

Comment thread src/maxtext/checkpoint_conversion/to_huggingface.py
@chiajunglien
chiajunglien force-pushed the emma/remove-parallel-flag branch from a88b8d9 to 23fd513 Compare August 24, 2026 02:20
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rc/maxtext/checkpoint_conversion/to_huggingface.py 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant