Skip to content
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

Tpu profiles #11041

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update fix for distributed
robertgshaw2-neuralmagic committed Dec 10, 2024
commit 02ea274b5159f60486c3d150ad33e0197c2785c4
6 changes: 3 additions & 3 deletions profile/README.md
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ This guide explains how to profile the TPU performance on VLLM for specific shap

```bash
export XLA_HLO_DEBUG=1
export MODEL=meta-llama/Llama-3.1-8B-Instruct
export MODEL=meta-llama/Llama-3.1-70B-Instruct
export VLLM_TPU_PROFILE_DURATION_MS=2000
export VLLM_TPU_PROFILE_DELAY_MS=1000

@@ -20,7 +20,7 @@ python3 profile_tpu.py \
--batch-size 32 \
--enforce-eager \
--profile-result-dir profiles \
--max-model-len 2048
--max-model-len 2048 --tensor-parallel-size 8
```

### Generate Prefill Trace
@@ -39,5 +39,5 @@ python3 profile_tpu.py \
--batch-size 1 \
--enforce-eager \
--profile-result-dir profiles \
--max-model-len 2048
--max-model-len 2048 --tensor-parallel-size 8
```
13 changes: 5 additions & 8 deletions profile/profile_tpu.py
Original file line number Diff line number Diff line change
@@ -17,11 +17,11 @@
DELAY_MS = int(os.getenv("VLLM_TPU_PROFILE_DELAY_MS", 0))

def main(args: argparse.Namespace):
server = xp.start_server(9012)
print(args)

engine_args = EngineArgs.from_cli_args(args)
llm = LLM(**dataclasses.asdict(engine_args))
server = xp.start_server(9012)

Check failure on line 24 in profile/profile_tpu.py

GitHub Actions / ruff (3.12)

Ruff (F841)

profile/profile_tpu.py:24:5: F841 Local variable `server` is assigned to but never used

sampling_params = SamplingParams(
temperature=0.0,
@@ -44,13 +44,10 @@
duration_ms=DURATION_MS)
if DELAY_MS == 0:
time.sleep(1.0)
# NOTE: for prefill, you could run this in a loop
# so that you get a trace of multiple prefill steps
# NOTE: for decode, you will get traces of multiple
# steps because we generae for 128 tokens.
llm.generate(dummy_prompts,
sampling_params=sampling_params,
use_tqdm=False)
for _ in range(5):
llm.generate(dummy_prompts,
sampling_params=sampling_params,
use_tqdm=False)
else:
start_time = time.perf_counter()
llm.generate(dummy_prompts,