66# 1. Run inference on the pre-converted checkpoint.
77# 2. Run SFT starting from the pre-converted checkpoint.
88# 3. Run inference on the checkpoint produced by the SFT run.
9- # 4. Convert the checkpoint produced by the SFT run back to HuggingFace format.
109
1110# Usage:
1211# export HF_TOKEN=<your Hugging Face access token>
@@ -25,10 +24,7 @@ BASE_OUTPUT_DIRECTORY=gs://runner-maxtext-logs/${MODEL_NAME}
2524UNSCANNED_CKPT_PATH=${BASE_OUTPUT_DIRECTORY} /to_maxtext/unscanned/${run_id} /0/items
2625SCANNED_CKPT_PATH=${BASE_OUTPUT_DIRECTORY} /to_maxtext/scanned/${run_id} /0/items
2726
28- # Step 1: Install torch
29- python3 -m pip install torch --index-url https://download.pytorch.org/whl/cpu
30-
31- # Step 2: Run inference on the original checkpoint converted from Hugging Face
27+ # Step 1: Run inference on the original checkpoint converted from Hugging Face
3228python3 -m maxtext.inference.vllm_decode \
3329 model_name=${MODEL_NAME} \
3430 load_parameters_path=${UNSCANNED_CKPT_PATH} \
@@ -37,7 +33,7 @@ python3 -m maxtext.inference.vllm_decode \
3733 prompt=" Suggest some famous landmarks in London." \
3834 use_chat_template=True scan_layers=false
3935
40- # Step 3 : Run SFT on the converted checkpoint
36+ # Step 2 : Run SFT on the converted checkpoint
4137python3 -m maxtext.trainers.post_train.sft.train_sft \
4238 base_output_directory=${BASE_OUTPUT_DIRECTORY} /sft \
4339 load_parameters_path=${SCANNED_CKPT_PATH} \
@@ -46,7 +42,7 @@ python3 -m maxtext.trainers.post_train.sft.train_sft \
4642 model_name=${MODEL_NAME} enable_single_controller=True \
4743 checkpoint_storage_use_zarr3=False checkpoint_storage_use_ocdbt=False
4844
49- # Step 4 : Run inference on the checkpoint generated from the previous run
45+ # Step 3 : Run inference on the checkpoint generated from the previous run
5046python3 -m maxtext.inference.vllm_decode \
5147 model_name=${MODEL_NAME} \
5248 load_parameters_path=${BASE_OUTPUT_DIRECTORY} /sft/${run_id} /checkpoints/5/model_params \
@@ -55,9 +51,4 @@ python3 -m maxtext.inference.vllm_decode \
5551 prompt=" Suggest some famous landmarks in London." \
5652 use_chat_template=True scan_layers=true
5753
58- # Step 5: Convert the checkpoint from MaxText format to Hugging Face format
59- python3 -m maxtext.checkpoint_conversion.to_huggingface \
60- model_name=${MODEL_NAME} \
61- load_parameters_path=${BASE_OUTPUT_DIRECTORY} /sft/${run_id} /checkpoints/5/model_params \
62- base_output_directory=${BASE_OUTPUT_DIRECTORY} /to_huggingface/unscanned/${run_id} \
63- use_multimodal=false scan_layers=true
54+
0 commit comments