Skip to content

Commit 56fc8af

Browse files
Merge pull request #3015 from AI-Hypercomputer:assets_refactor
PiperOrigin-RevId: 862796558
2 parents c4499d8 + 9898f76 commit 56fc8af

113 files changed

Lines changed: 262 additions & 255 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/run_pathways_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
FINAL_PYTEST_MARKER="${{ inputs.pytest_marker }} and not scheduled_only"
9999
fi
100100
export MAXTEXT_REPO_ROOT=$(pwd)
101-
export MAXTEXT_ASSETS_ROOT=$(pwd)/src/MaxText/assets
101+
export MAXTEXT_ASSETS_ROOT=$(pwd)/src/maxtext/assets
102102
export MAXTEXT_TEST_ASSETS_ROOT=$(pwd)/tests/assets
103103
export MAXTEXT_PKG_DIR=$(pwd)/src/MaxText
104104
# TODO(b/454659463): Enable test_default_hlo_match after volume mount is supported.

.github/workflows/run_tests_against_package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
fi
109109
# TODO: Use package data for testing and remove the env vars
110110
export MAXTEXT_REPO_ROOT=$(pwd)
111-
export MAXTEXT_ASSETS_ROOT=$(pwd)/src/MaxText/assets
111+
export MAXTEXT_ASSETS_ROOT=$(pwd)/src/maxtext/assets
112112
export MAXTEXT_TEST_ASSETS_ROOT=$(pwd)/tests/assets
113113
export MAXTEXT_PKG_DIR=$(pwd)/src/MaxText
114114
# omit this libtpu init args for gpu tests

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repos:
88
- id: codespell
99
args:
1010
- '-w'
11-
- '--skip="*.txt,pylintrc,.*,src/MaxText/assets/*"'
11+
- '--skip="*.txt,pylintrc,.*,src/maxtext/assets/*"'
1212
- '-L ND,nd,sems,TE,ROUGE,rouge,astroid,ags,dout'
1313
- '.'
1414
additional_dependencies:

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"dataset_path=gs://test-maxtext-dataset",
1616
"model_name=llama2-7b",
1717
"load_parameters_path=gs://msingh-bkt/checkpoints/quant_llama2-7b-chat/20241120034012/int8_",
18-
"tokenizer_path=src/MaxText/assets/tokenizer.llama2",
18+
"tokenizer_path=src/maxtext/assets/tokenizers/tokenizer.llama2",
1919
"per_device_batch_size=8",
2020
"max_prefill_predict_length=8",
2121
"max_target_length=20",
@@ -70,7 +70,7 @@
7070
"args": [
7171
"src/MaxText/configs/base.yml",
7272
"model_name=llama2-7b",
73-
"tokenizer_path=src/MaxText/assets/tokenizer.llama2",
73+
"tokenizer_path=src/maxtext/assets/tokenizers/tokenizer.llama2",
7474
"weight_dtype=bfloat16",
7575
"scan_layers=false",
7676
"attention=dot_product",

benchmarks/globals.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
r if os.path.isdir(os.path.join(r := os.path.dirname(os.path.dirname(__file__)), ".git")) else MAXTEXT_PKG_DIR,
2626
)
2727

28-
# This is the assets root: with "tokenizer.gemma3"; &etc.
29-
MAXTEXT_ASSETS_ROOT = os.environ.get("MAXTEXT_ASSETS_ROOT", os.path.join(MAXTEXT_PKG_DIR, "assets"))
28+
# This is the assets root: with "tokenizers/"; &etc.
29+
MAXTEXT_ASSETS_ROOT = os.environ.get("MAXTEXT_ASSETS_ROOT", os.path.join(MAXTEXT_REPO_ROOT, "src", "maxtext", "assets"))
3030

3131
__all__ = ["MAXTEXT_ASSETS_ROOT", "MAXTEXT_PKG_DIR", "MAXTEXT_REPO_ROOT"]

benchmarks/maxtext_trillium_model_configs.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@
544544
"profiler": "xplane",
545545
"dataset_path": "gs://max-datasets-rogue",
546546
"dataset_type": "tfds",
547-
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizer.llama2"),
547+
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizers", "tokenizer.llama2"),
548548
"sa_block_q": 1024,
549549
"sa_block_q_dkv": 2048,
550550
"sa_block_q_dq": 2048,
@@ -1280,7 +1280,7 @@
12801280
"skip_first_n_steps_for_profiler": 10,
12811281
"profiler_steps": 5,
12821282
"tokenizer_type": "tiktoken",
1283-
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizer_llama3.tiktoken"),
1283+
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizers", "tokenizer_llama3.tiktoken"),
12841284
},
12851285
xla_flags=(
12861286
xla_flags_library.DENSE_VMEM_LIMIT_FLAG
@@ -1336,7 +1336,7 @@
13361336
"skip_first_n_steps_for_profiler": 10,
13371337
"profiler_steps": 5,
13381338
"tokenizer_type": "tiktoken",
1339-
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizer_llama3.tiktoken"),
1339+
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizers", "tokenizer_llama3.tiktoken"),
13401340
},
13411341
xla_flags=(
13421342
xla_flags_library.DENSE_VMEM_LIMIT_FLAG
@@ -1517,7 +1517,7 @@
15171517
"megablox": False,
15181518
"sparse_matmul": False,
15191519
"capacity_factor": 1.25,
1520-
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizer.mistral-v1"),
1520+
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizers", "tokenizer.mistral-v1"),
15211521
},
15221522
xla_flags=(
15231523
xla_flags_library.MOE_VMEM_LIMIT_FLAG
@@ -1552,7 +1552,7 @@
15521552
"sparse_matmul": False,
15531553
"capacity_factor": 1.25,
15541554
"quantization": "int8",
1555-
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizer.mistral-v1"),
1555+
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizers", "tokenizer.mistral-v1"),
15561556
},
15571557
xla_flags=(
15581558
xla_flags_library.MOE_VMEM_LIMIT_FLAG
@@ -1593,7 +1593,7 @@
15931593
"megablox": False,
15941594
"sparse_matmul": False,
15951595
"capacity_factor": 1.25,
1596-
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizer.mistral-v3"),
1596+
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizers", "tokenizer.mistral-v3"),
15971597
"dtype": "bfloat16",
15981598
"weight_dtype": "bfloat16",
15991599
"allow_split_physical_axes": True,
@@ -1634,7 +1634,7 @@
16341634
"megablox": False,
16351635
"sparse_matmul": False,
16361636
"capacity_factor": 1.0,
1637-
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizer.mistral-v3"),
1637+
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizers", "tokenizer.mistral-v3"),
16381638
"dtype": "bfloat16",
16391639
"opt_type": "sgd",
16401640
"weight_dtype": "bfloat16",
@@ -1667,7 +1667,7 @@
16671667
"reuse_example_batch": 1,
16681668
"enable_checkpointing": False,
16691669
"profiler": "xplane",
1670-
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizer.llama2"),
1670+
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizers", "tokenizer.llama2"),
16711671
"sa_block_q": 2048,
16721672
"sa_block_q_dkv": 2048,
16731673
"sa_block_q_dq": 2048,
@@ -1700,7 +1700,7 @@
17001700
"reuse_example_batch": 1,
17011701
"enable_checkpointing": False,
17021702
"profiler": "xplane",
1703-
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizer.llama2"),
1703+
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizers", "tokenizer.llama2"),
17041704
"sa_block_q": 2048,
17051705
"sa_block_q_dkv": 2048,
17061706
"sa_block_q_dq": 2048,
@@ -1739,7 +1739,7 @@
17391739
"profiler": "xplane",
17401740
"skip_first_n_steps_for_profiler": 10,
17411741
"profiler_steps": 2,
1742-
"tokenizer_path": os.path.join("assets", "tokenizer.gemma3"),
1742+
"tokenizer_path": os.path.join("assets", "tokenizers", "tokenizer.gemma3"),
17431743
"sa_block_q": 1024,
17441744
"sa_block_kv": 1024,
17451745
"sa_block_kv_compute": 1024,
@@ -1779,7 +1779,7 @@
17791779
"profiler": "xplane",
17801780
"skip_first_n_steps_for_profiler": 10,
17811781
"profiler_steps": 2,
1782-
"tokenizer_path": os.path.join("assets", "tokenizer.gemma3"),
1782+
"tokenizer_path": os.path.join("assets", "tokenizers", "tokenizer.gemma3"),
17831783
"sa_block_q": 1024,
17841784
"sa_block_kv": 1024,
17851785
"sa_block_kv_compute": 1024,
@@ -1819,7 +1819,7 @@
18191819
"profiler": "xplane",
18201820
"skip_first_n_steps_for_profiler": 10,
18211821
"profiler_steps": 2,
1822-
"tokenizer_path": os.path.join("assets", "tokenizer.gemma3"),
1822+
"tokenizer_path": os.path.join("assets", "tokenizers", "tokenizer.gemma3"),
18231823
"sa_block_q": 1024,
18241824
"sa_block_kv": 1024,
18251825
"sa_block_kv_compute": 1024,
@@ -1868,7 +1868,7 @@
18681868
"skip_first_n_steps_for_profiler": 10,
18691869
"profiler_steps": 5,
18701870
"tokenizer_type": "tiktoken",
1871-
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizer_llama3.tiktoken"),
1871+
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizers", "tokenizer_llama3.tiktoken"),
18721872
"packing": False,
18731873
},
18741874
xla_flags=(
@@ -1933,7 +1933,7 @@
19331933
"sa_use_fused_bwd_kernel": True,
19341934
"sparse_matmul": False,
19351935
"capacity_factor": 1.5,
1936-
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizer.mistral-v1"),
1936+
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizers", "tokenizer.mistral-v1"),
19371937
"dtype": "bfloat16",
19381938
"weight_dtype": "bfloat16",
19391939
"opt_type": "sgd",

benchmarks/maxtext_v5e_model_configs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
"remat_policy": "save_qkv_proj",
150150
"max_target_length": 2048,
151151
"use_iota_embed": True,
152-
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizer.llama2"),
152+
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizers", "tokenizer.llama2"),
153153
"dataset_path": "gs://max-datasets-rogue",
154154
"dataset_type": "synthetic",
155155
"reuse_example_batch": 1,
@@ -171,7 +171,7 @@
171171
"remat_policy": "qkv_proj_offloaded",
172172
"max_target_length": 2048,
173173
"use_iota_embed": True,
174-
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizer.llama2"),
174+
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizers", "tokenizer.llama2"),
175175
"dataset_path": "gs://max-datasets-rogue",
176176
"dataset_type": "synthetic",
177177
"reuse_example_batch": 1,

benchmarks/maxtext_v5p_model_configs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
"remat_policy": "minimal",
228228
"max_target_length": 4096,
229229
"use_iota_embed": True,
230-
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizer.llama2"),
230+
"tokenizer_path": os.path.join(MAXTEXT_ASSETS_ROOT, "tokenizers", "tokenizer.llama2"),
231231
"dataset_path": "gs://max-datasets-rogue",
232232
"dataset_type": "synthetic",
233233
"reuse_example_batch": 1,

benchmarks/maxtext_xpk_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ def build_user_command(
437437
"export ENABLE_PATHWAYS_PERSISTENCE=1 &&",
438438
f"export JAX_PLATFORMS={jax_platforms} &&",
439439
"export ENABLE_PJRT_COMPATIBILITY=true &&",
440-
"export MAXTEXT_ASSETS_ROOT=/deps/src/MaxText/assets MAXTEXT_PKG_DIR=/deps/src/MaxText MAXTEXT_REPO_ROOT=/deps &&"
440+
"export MAXTEXT_ASSETS_ROOT=/deps/src/maxtext/assets MAXTEXT_PKG_DIR=/deps/src/MaxText MAXTEXT_REPO_ROOT=/deps &&"
441441
f'{hlo_dump} python3 -m MaxText.train {os.path.join(MAXTEXT_PKG_DIR, "configs", "base.yml")}',
442442
f"{config_tuning_params}",
443443
f"steps={wl_config.num_steps}",

benchmarks/mmlu/mmlu_eval.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@
2121
To run the MMLU benchmark:
2222
# Default is zero-shot prompting
2323
python3 -m benchmarks.mmlu.mmlu_eval src/MaxText/configs/base.yml \
24-
tokenizer_path=src/MaxText/assets/tokenizer_llama3.tiktoken \
24+
tokenizer_path=src/maxtext/assets/tokenizer_llama3.tiktoken \
2525
load_parameters_path=check_point_path model_name=llama3.1-8b \
2626
max_prefill_predict_length=1024 max_target_length=2048 ici_tensor_parallelism=4 per_device_batch_size=1
2727
2828
# Example of using the prompt_template flag for Chain-of-Thought (CoT) prompting:
2929
python3 -m benchmarks.mmlu.mmlu_eval src/MaxText/configs/base.yml \
30-
tokenizer_path=src/MaxText/assets/tokenizer_llama3.tiktoken \
30+
tokenizer_path=src/maxtext/assets/tokenizer_llama3.tiktoken \
3131
load_parameters_path=check_point_path model_name=llama3.1-8b \
3232
max_prefill_predict_length=1024 max_target_length=2048 ici_tensor_parallelism=4 per_device_batch_size=1 \
3333
prompt_template="The following are multiple choice questions (with answers) about {subject}.\n\n{question}\n
3434
{choices}\nAnswer: Let's think step by step."
3535
3636
# Example of using the prompt_template flag for 5-shot prompting (replace with actual examples):
3737
python3 -m benchmarks.mmlu.mmlu_eval src/MaxText/configs/base.yml \
38-
tokenizer_path=src/MaxText/assets/tokenizer_llama3.tiktoken \
38+
tokenizer_path=src/maxtext/assets/tokenizer_llama3.tiktoken \
3939
load_parameters_path=check_point_path model_name=llama3.1-8b \
4040
max_prefill_predict_length=1024 max_target_length=2048 ici_tensor_parallelism=4 per_device_batch_size=1 \
4141
prompt_template='Example 1:\nQuestion: What is the capital of France?\nChoices:\nA. London\nB. Paris\nC. Rome\nD. Berlin\nAnswer: B\n\nExample 2:\nQuestion: What is the highest mountain in the world?\nChoices:\nA. K2\nB. Kangchenjunga\nC. Mount Everest\nD. Lhotse\nAnswer: C\n\nExample 3:\nQuestion: What is the chemical symbol for water?\nChoices:\nA. H2O\nB. CO2\nC. O2\nD. NaCl\nAnswer: A\n\nExample 4:\nQuestion: Who painted the Mona Lisa?\nChoices:\nA. Michelangelo\nB. Leonardo da Vinci\nC. Raphael\nD. Donatello\nAnswer: B\n\nExample 5:\nQuestion: Which planet is known as the Red Planet?\nChoices:\nA. Venus\nB. Mars\nC. Jupiter\nD. Saturn\nAnswer: B\n\nThe following are multiple choice questions (with answers) about {subject}.\n\n{question}\n{choices}\nAnswer:' # pylint: disable=line-too-long

0 commit comments

Comments
 (0)