Skip to content

Commit fab4b4f

Browse files
authored
add v5p config for llama2-7b, llama2-70b, gpt3-175b (GoogleCloudPlatform#725)
uncomment models for v5e add v5p-128 minor change resolve format fix variable name fix variable name
1 parent 87c45a8 commit fab4b4f

4 files changed

Lines changed: 104 additions & 0 deletions

File tree

dags/common/model_configs.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,18 @@ class MaxTextV5eModelConfigs(enum.Enum):
2525
DEFAULT_128B = "default_128b_v5e_256"
2626
GPT3_175B = "gpt_3_175b_v5e_256"
2727
LLAMA2_7B = "llama2_7b_v5e_256"
28+
LLAMA2_13B = "llama2_13b_v5e_256"
2829
LLAMA2_70B = "llama2_70b_v5e_256"
2930

3031

32+
class MaxTextV5pModelConfigs(enum.Enum):
33+
# Refers to model configs in https://github.com/AI-Hypercomputer/maxtext/blob/main/benchmarks/maxtext_v5p_model_configs.py
34+
GPT3_175B = "gpt_3_175b_v5p_128"
35+
GPT3_175B_SC = "gpt_3_175b_v5p_128_sc"
36+
LLAMA2_7B = "llama2_7b_v5p_128"
37+
LLAMA2_70B = "llama2_70b_v5p_128"
38+
39+
3140
class MaxTextTrilliumModelConfigs(enum.Enum):
3241
# Refers to model configs in https://github.com/AI-Hypercomputer/maxtext/blob/main/benchmarks/maxtext_trillium_model_configs.py
3342
GPT3_175B = "gpt_3_175b"

dags/common/test_owner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class Team(enum.Enum):
5050
MOHIT_K = "Mohit K."
5151
ANISHA_M = "Anisha M."
5252
YUWEI_Y = "Yuwei Y."
53+
RISHABH_B = "Rishabh B."
5354

5455
# Multi-tier Checkpointing
5556
ABHINAV_S = "ABHINAV S."

dags/common/vm_resource.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,13 @@ class XpkClusters:
249249
project=Project.CLOUD_TPU_MULTIPOD_DEV.value,
250250
zone=Zone.EUROPE_WEST4_B.value,
251251
)
252+
TPU_V5P_128_CLUSTER = XpkClusterConfig(
253+
name="v5p-128-bodaborg-europe-west4-b",
254+
device_version=TpuVersion.V5P,
255+
core_count=128,
256+
project=Project.CLOUD_TPU_MULTIPOD_DEV.value,
257+
zone=Zone.EUROPE_WEST4_B.value,
258+
)
252259
TPU_V5E_256_CLUSTER = XpkClusterConfig(
253260
name="v5e-256-bodaborg-europe-west4",
254261
device_version=TpuVersion.V5E,
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""
16+
A DAG to run perf tests for MaxText model configs on V5p.
17+
"""
18+
import datetime
19+
from airflow import models
20+
from airflow.utils.task_group import TaskGroup
21+
from dags import composer_env
22+
from dags.common import test_owner
23+
from dags.common.vm_resource import Project, XpkClusters, DockerImage
24+
from dags.common.model_configs import MaxTextV5pModelConfigs
25+
from dags.multipod.configs import maxtext_sweep_gke_config
26+
from dags.multipod.configs.common import SetupMode
27+
from xlml.apis import metric_config
28+
29+
# Run once a day at 4 am UTC (8 pm PST / 9 pm PDT)
30+
SCHEDULED_TIME = "0 4 * * *" if composer_env.is_prod_env() else None
31+
DOCKER_IMAGES = [
32+
(SetupMode.STABLE, DockerImage.MAXTEXT_TPU_JAX_STABLE_STACK),
33+
(SetupMode.NIGHTLY, DockerImage.MAXTEXT_TPU_JAX_NIGHTLY),
34+
]
35+
QUANTIZATION_SWEEP = {"M_QUANTIZATION": ["", "int8"]}
36+
BASE_OUTPUT_DIRECTORY = "gs://runner-maxtext-logs"
37+
38+
with models.DAG(
39+
dag_id="maxtext_v5p_configs_perf",
40+
schedule=SCHEDULED_TIME,
41+
tags=[
42+
"multipod_team",
43+
"maxtext",
44+
"stable",
45+
"nightly",
46+
"mlscale_perfx",
47+
],
48+
start_date=datetime.datetime(2024, 2, 19),
49+
catchup=False,
50+
) as dag:
51+
quarantine_task_group = TaskGroup(
52+
group_id="Quarantine", dag=dag, prefix_group_id=False
53+
)
54+
for mode, image in DOCKER_IMAGES:
55+
for model in MaxTextV5pModelConfigs:
56+
base_run_model_cmds = [
57+
"bash preflight.sh",
58+
f"python3 -m benchmarks.benchmark_runner on-device --base_output_directory={BASE_OUTPUT_DIRECTORY} --model_name={model.value} --libtpu_type=maxtext-docker --num_steps=15",
59+
]
60+
maxtext_sweep_gke_test = (
61+
maxtext_sweep_gke_config.get_maxtext_sweep_gke_config(
62+
test_owner=test_owner.RISHABH_B,
63+
dataset_project=Project.CLOUD_ML_AUTO_SOLUTIONS.value,
64+
composer_project=Project.CLOUD_ML_AUTO_SOLUTIONS.value,
65+
dataset_name=metric_config.DatasetOption.XLML_DATASET,
66+
cluster=XpkClusters.TPU_V5P_128_CLUSTER,
67+
time_out_in_min=360,
68+
base_output_directory=BASE_OUTPUT_DIRECTORY,
69+
num_slices=[1, 2],
70+
docker_image=image.value,
71+
run_name_prefix=f"maxtext-{model.name.lower()}-{mode.value}",
72+
base_run_model_cmds=base_run_model_cmds,
73+
sweep_params=QUANTIZATION_SWEEP,
74+
)
75+
)
76+
77+
chain_num = 4
78+
prev = maxtext_sweep_gke_test[0].run_with_name_gen_and_quarantine(
79+
quarantine_task_group
80+
)
81+
for i in range(1, len(maxtext_sweep_gke_test)):
82+
curr = maxtext_sweep_gke_test[i].run_with_name_gen_and_quarantine(
83+
quarantine_task_group
84+
)
85+
if i % chain_num != 0:
86+
prev >> curr
87+
prev = curr

0 commit comments

Comments
 (0)