-
Notifications
You must be signed in to change notification settings - Fork 565
Migrate the test script to use to_maxtext.py for supported models #4541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,10 +41,28 @@ if [ -z "${CKPT_DISK_LOCATION}" ]; then | |
| fi | ||
|
|
||
| # 1.1 Convert checkpoint to `scanned` format, more suitable for training | ||
| JAX_PLATFORMS=cpu python3 -m maxtext.checkpoint_conversion.standalone_scripts.convert_deepseek_family_ckpt --base_model_path ${CKPT_DISK_LOCATION} --maxtext_model_path ${BASE_OUTPUT_PATH}/scanned --model_size ${MODEL_NAME} | ||
| python3 -m maxtext.checkpoint_conversion.to_maxtext \ | ||
| model_name=${MODEL_NAME} \ | ||
| base_output_directory=${BASE_OUTPUT_PATH}/scanned \ | ||
| scan_layers=true \ | ||
| attention=dot_product \ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The attention type should not affect checkpoint conversion. I suggest leave it the default value to reduce noise.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without dot attention we have error: ``` |
||
| enable_nnx=false \ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you tested enable_nnx=true (default)? We eventually want the nnx path to work since it's the future and we are migrating to it. |
||
| hardware=cpu skip_jax_distributed_system=True \ | ||
| --hf_model_path=${CKPT_DISK_LOCATION} \ | ||
| --lazy_load_tensors=False \ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you tried the default value lazy_load_tensors=True? It minimizes RAM usage, we can always use it. |
||
| --eager_load_method='safetensors' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'safetensors' is the default value, no need to specify?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add these for Pathways compatibility: |
||
|
|
||
| # 1.2 Convert checkpoint to `unscanned` format, more suitable for decoding | ||
| JAX_PLATFORMS=cpu python3 -m maxtext.checkpoint_conversion.standalone_scripts.convert_deepseek_family_unscanned_ckpt --base_model_path ${CKPT_DISK_LOCATION} --maxtext_model_path ${BASE_OUTPUT_PATH}/unscanned --model_size ${MODEL_NAME} | ||
| python3 -m maxtext.checkpoint_conversion.to_maxtext \ | ||
| model_name=${MODEL_NAME} \ | ||
| base_output_directory=${BASE_OUTPUT_PATH}/unscanned \ | ||
| scan_layers=false \ | ||
| attention=dot_product \ | ||
| enable_nnx=false \ | ||
| hardware=cpu skip_jax_distributed_system=True \ | ||
| --hf_model_path=${CKPT_DISK_LOCATION} \ | ||
| --lazy_load_tensors=False \ | ||
| --eager_load_method='safetensors' | ||
|
|
||
| # Step 2: | ||
| # We define the checkpoint paths. This way it is easier to use these paths in the `train.py` and `decode.py` commands | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think permission change is needed? We usually run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't add golden_logits for new models to
tests/assets/golden_logitsany more, because it makes the repo size grow too fast. Now we have this instruction (https://github.com/AI-Hypercomputer/maxtext/pull/4541/changes#diff-af585533e794d79e01037bc09d8f4b879e8328b0a577f037579d6f2b6f45c4c4L57) in the test script. You can download the existing golden logits fromgs://maxtext-test-assets/golden_data_gpt-oss-20b.jsonland test against it.