Skip to content

Add mlperf benchmark scripts in-tree. #148

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

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 20 additions & 0 deletions benchmarks/mixtral_offline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CACHE_LENGTH=1024
INPUT_SIZE=512
OUTPUT_SIZE=1024
BATCH_SIZE=512
CHECKPOINT_PATH=mlperf/data/mixtral-instruct-quantized/

pushd ..
python -m benchmarks.run_offline \
--model_name=mixtral \
--batch_size=$BATCH_SIZE \
--max_cache_length=$CACHE_LENGTH \
--max_decode_length=$OUTPUT_SIZE \
--context_length=$INPUT_SIZE \
--checkpoint_path=$CHECKPOINT_PATH/model.safetensors \
--tokenizer_path=$CHECKPOINT_PATH/tokenizer.model \
--quantize_weights=1 \
--quantize_type=int8_per_channel \
--quantize_kv_cache=1 \
--profiling_output=/mnt/disks/hanq/mixtral-profiles
popd
14 changes: 12 additions & 2 deletions benchmarks/run_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,20 @@ def main(argv):
jax.profiler.stop_trace()

print("prefill ", prefill_times)
print("decode", sum(dec_times) / 10)
avg_decode_times = sum(dec_times[2:]) / len(dec_times[2:])
print("decode", avg_decode_times)

prefill_times_ms = {k: v * 1000 for k, v in prefill_times.items()}
decode_time_ms = sum(dec_times) * 1000 / 10 / FLAGS.batch_size
decode_time_ms = sum(dec_times[2:]) * 1000 / 8

largest_prefill = max(prefill_times.items())
print("MAX tokens:", FLAGS.batch_size / avg_decode_times)

time2 = (FLAGS.batch_size * FLAGS.max_decode_length) / (
FLAGS.batch_size * largest_prefill[1]
+ FLAGS.max_decode_length * avg_decode_times
)
print("MAX tokens 2:", time2)

sharegpt_path = FLAGS.sharegpt_path
if sharegpt_path:
Expand Down
31 changes: 31 additions & 0 deletions mlperf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Run MLPerf tests

NOTE: currently only tried with mixtral;
and only tried with offline benchmark

# How to run

### 1. Install

```
./install.sh
```

### 2. Start server

```
./start_server.sh
```

### 3. Warm up the server

```
python warmup.py
```

### 4. Run the benchmark, now it runs offline mode

```
./benchmark_run.sh
```

Loading
Loading