Skip to content

Commit b239a0f

Browse files
committed
[Inference] Note GLM fallback generation path
Signed-off-by: Chen Cui <chcui@nvidia.com>
1 parent 5c60f2e commit b239a0f

3 files changed

Lines changed: 21 additions & 17 deletions

File tree

‎examples/models/glm/glm5/slurm_inference.sh‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@
2424
# TP does NOT reduce expert memory — increase EP instead.
2525
# Recommended: TP=2, EP=32, PP=1 (64 GPUs, 8 nodes).
2626
#
27-
# Loads the HF checkpoint, converts to Megatron in-memory, and runs efficient
28-
# text generation via examples/inference/text_generation.py.
27+
# Megatron inference engine support is not yet available for this architecture.
28+
# This launcher defaults to the older slow sanity-check generation path for now.
29+
#
30+
# Loads the HF checkpoint, converts to Megatron in-memory, and runs greedy
31+
# text generation via examples/conversion/hf_to_megatron_generate_text.py.
2932
#
3033
# Requirements: transformers >= 5.2.0
3134
#
@@ -61,12 +64,12 @@ MODEL_NAME="${MODEL_NAME:-GLM-5}"
6164
# Use the direct local snapshot path to avoid 64 processes calling
6265
# snapshot_download simultaneously (causes Lustre race conditions).
6366
HF_MODEL_PATH="${HF_HOME}/hub/models--zai-org--${MODEL_NAME}/snapshots/$(ls ${HF_HOME}/hub/models--zai-org--${MODEL_NAME}/snapshots/ | head -1)"
64-
TP=2
65-
EP=32
66-
PP=1
67+
TP="${TP:-2}"
68+
EP="${EP:-32}"
69+
PP="${PP:-1}"
6770

68-
PROMPT="What is artificial intelligence?"
69-
MAX_NEW_TOKENS=100
71+
PROMPT="${PROMPT:-What is artificial intelligence?}"
72+
MAX_NEW_TOKENS="${MAX_NEW_TOKENS:-100}"
7073

7174
# ── Environment ───────────────────────────────────────────────────────────
7275
export TORCH_NCCL_AVOID_RECORD_STREAMS=1
@@ -114,12 +117,11 @@ print(m.group(1) + m.group(2) if m else s.split(',')[0])
114117
--node_rank=\$SLURM_PROCID \
115118
--master_addr=\$MASTER_ADDR \
116119
--master_port=29500 \
117-
examples/inference/text_generation.py \
120+
examples/conversion/hf_to_megatron_generate_text.py \
118121
--hf_model_path $HF_MODEL_PATH \
119122
--prompt '$PROMPT' \
120123
--max_new_tokens $MAX_NEW_TOKENS \
121-
--tp $TP --ep $EP --pp $PP \
122-
--use-coordinator
124+
--tp $TP --ep $EP --pp $PP
123125
"
124126

125127
echo "======================================"

‎examples/models/glm47/inference.sh‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
#
1919
# GLM-4.7-Flash (MLA+MoE, ~30B, 64 experts top-4) fits on 8 GPUs with EP=8.
2020
# GLM-4.7 (MoE, ~358B, 160 experts top-8) requires multi-node.
21+
#
22+
# Megatron inference engine support is not yet available for this architecture.
23+
# This launcher defaults to the older slow sanity-check generation path for now.
2124
# ==============================================================================
2225

2326
set -xeuo pipefail
@@ -27,13 +30,10 @@ set -xeuo pipefail
2730
GLM47_FLASH_HF="${GLM47_FLASH_HF:-zai-org/GLM-4.7-Flash}"
2831
PROMPT="${PROMPT:-What is artificial intelligence?}"
2932
MAX_NEW_TOKENS="${MAX_NEW_TOKENS:-100}"
30-
COORDINATOR_HOST="${COORDINATOR_HOST:-127.0.0.1}"
3133

3234
uv run python -m torch.distributed.run --nproc_per_node=8 \
33-
examples/inference/text_generation.py \
35+
examples/conversion/hf_to_megatron_generate_text.py \
3436
--hf_model_path "$GLM47_FLASH_HF" \
3537
--prompt "$PROMPT" \
3638
--max_new_tokens "$MAX_NEW_TOKENS" \
37-
--tp 1 --pp 1 --ep 8 \
38-
--use-coordinator \
39-
--coordinator-host "$COORDINATOR_HOST"
39+
--tp 1 --pp 1 --ep 8

‎examples/models/glm47/slurm_inference.sh‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
# GLM-4.7 (MoE: 160 experts, top-8, ~358B params)
2020
# Requires at least 4 nodes (32 GPUs) with EP=32.
2121
#
22+
# Megatron inference engine support is not yet available for this architecture.
23+
# This launcher defaults to the older slow sanity-check generation path for now.
24+
#
2225
# Usage:
2326
# 1. Set CONTAINER_IMAGE and token exports; set CONTAINER_MOUNTS if needed
2427
# 2. Create logs/ if your Slurm setup requires the output directory to exist
@@ -87,12 +90,11 @@ echo "Warming uv cache"
8790
printf -v HF_MODEL_ARG "%q" "$HF_MODEL_ID"
8891
printf -v PROMPT_ARG "%q" "$PROMPT"
8992

90-
CMD="uv run --no-sync python examples/inference/text_generation.py"
93+
CMD="uv run --no-sync python examples/conversion/hf_to_megatron_generate_text.py"
9194
CMD="$CMD --hf_model_path $HF_MODEL_ARG"
9295
CMD="$CMD --prompt $PROMPT_ARG"
9396
CMD="$CMD --max_new_tokens $MAX_NEW_TOKENS"
9497
CMD="$CMD --tp 1 --pp 1 --ep 32"
95-
CMD="$CMD --use-coordinator"
9698

9799
echo "Executing: $CMD"
98100

0 commit comments

Comments
 (0)