Skip to content

Commit 262ed1e

Browse files
authored
Merge pull request #547 from ROCm/upstream_merge_2025_05_15
Upstream merge 2025 05 15
2 parents c791a85 + ccd96e8 commit 262ed1e

File tree

843 files changed

+40634
-19412
lines changed

Some content is hidden

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

843 files changed

+40634
-19412
lines changed

.buildkite/check-wheel-size.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
# Note that we have 400 MiB quota, please use it wisely.
99
# See https://github.com/pypi/support/issues/3792 .
1010
# Please also sync the value with the one in Dockerfile.
11-
VLLM_MAX_SIZE_MB = int(os.environ.get('VLLM_MAX_SIZE_MB', 400))
11+
VLLM_MAX_SIZE_MB = int(os.environ.get("VLLM_MAX_SIZE_MB", 400))
1212

1313

1414
def print_top_10_largest_files(zip_file):
1515
"""Print the top 10 largest files in the given zip file."""
16-
with zipfile.ZipFile(zip_file, 'r') as z:
16+
with zipfile.ZipFile(zip_file, "r") as z:
1717
file_sizes = [(f, z.getinfo(f).file_size) for f in z.namelist()]
1818
file_sizes.sort(key=lambda x: x[1], reverse=True)
1919
for f, size in file_sizes[:10]:
@@ -28,14 +28,18 @@ def check_wheel_size(directory):
2828
wheel_path = os.path.join(root, file_name)
2929
wheel_size_mb = os.path.getsize(wheel_path) / (1024 * 1024)
3030
if wheel_size_mb > VLLM_MAX_SIZE_MB:
31-
print(f"Not allowed: Wheel {wheel_path} is larger "
32-
f"({wheel_size_mb:.2f} MB) than the limit "
33-
f"({VLLM_MAX_SIZE_MB} MB).")
31+
print(
32+
f"Not allowed: Wheel {wheel_path} is larger "
33+
f"({wheel_size_mb:.2f} MB) than the limit "
34+
f"({VLLM_MAX_SIZE_MB} MB)."
35+
)
3436
print_top_10_largest_files(wheel_path)
3537
return 1
3638
else:
37-
print(f"Wheel {wheel_path} is within the allowed size "
38-
f"({wheel_size_mb:.2f} MB).")
39+
print(
40+
f"Wheel {wheel_path} is within the allowed size "
41+
f"({wheel_size_mb:.2f} MB)."
42+
)
3943
return 0
4044

4145

@@ -45,4 +49,4 @@ def check_wheel_size(directory):
4549
sys.exit(1)
4650

4751
directory = sys.argv[1]
48-
sys.exit(check_wheel_size(directory))
52+
sys.exit(check_wheel_size(directory))

.buildkite/generate_index.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
print(f"Generated index.html for {args.wheel}")
2323
# cloudfront requires escaping the '+' character
2424
f.write(
25-
template.format(wheel=filename,
26-
wheel_html_escaped=filename.replace("+", "%2B")))
25+
template.format(wheel=filename, wheel_html_escaped=filename.replace("+", "%2B"))
26+
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# bash .buildkite/lm-eval-harness/run-lm-eval-gsm-vllm-baseline.sh -m RedHatAI/Llama-3.2-1B-Instruct-FP8 -b "auto" -l 1319 -f 5 -t 1
2+
model_name: "RedHatAI/Llama-3.2-1B-Instruct-FP8"
3+
tasks:
4+
- name: "gsm8k"
5+
metrics:
6+
- name: "exact_match,strict-match"
7+
value: 0.335
8+
- name: "exact_match,flexible-extract"
9+
value: 0.323
10+
limit: 1319
11+
num_fewshot: 5
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# bash .buildkite/lm-eval-harness/run-lm-eval-gsm-vllm-baseline.sh -m Qwen/Qwen2.5-1.5B-Instruct -b auto -l 1319 -f 5 -t 1
2+
model_name: "Qwen/Qwen2.5-1.5B-Instruct"
3+
tasks:
4+
- name: "gsm8k"
5+
metrics:
6+
- name: "exact_match,strict-match"
7+
value: 0.54
8+
- name: "exact_match,flexible-extract"
9+
value: 0.59
10+
limit: 1319
11+
num_fewshot: 5
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# bash .buildkite/lm-eval-harness/run-lm-eval-gsm-vllm-baseline.sh -m RedHatAI/Qwen2.5-VL-3B-Instruct-FP8-Dynamic -b auto -l 1319 -f 5 -t 1
2+
model_name: "RedHatAI/Qwen2.5-VL-3B-Instruct-FP8-Dynamic"
3+
tasks:
4+
- name: "gsm8k"
5+
metrics:
6+
- name: "exact_match,strict-match"
7+
value: 0.47
8+
- name: "exact_match,flexible-extract"
9+
value: 0.64
10+
limit: 1319
11+
num_fewshot: 5

.buildkite/lm-eval-harness/configs/models-large.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Meta-Llama-3-70B-Instruct.yaml
33
Mixtral-8x7B-Instruct-v0.1.yaml
44
Qwen2-57B-A14-Instruct.yaml
55
DeepSeek-V2-Lite-Chat.yaml
6+
Meta-Llama-3-8B-QQQ.yaml
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
Meta-Llama-3-8B-Instruct.yaml
2-
Meta-Llama-3-8B-Instruct-FP8-compressed-tensors.yaml
1+
Qwen2.5-1.5B-Instruct.yaml
32
Meta-Llama-3.2-1B-Instruct-INT8-compressed-tensors.yaml
43
Meta-Llama-3-8B-Instruct-INT8-compressed-tensors-asym.yaml
54
Meta-Llama-3-8B-Instruct-nonuniform-compressed-tensors.yaml
6-
Meta-Llama-3-8B-Instruct-Channelwise-compressed-tensors.yaml
5+
Qwen2.5-VL-3B-Instruct-FP8-dynamic.yaml
76
Qwen1.5-MoE-W4A16-compressed-tensors.yaml
8-
Qwen2-1.5B-Instruct-INT8-compressed-tensors.yaml
9-
Qwen2-1.5B-Instruct-FP8W8.yaml
10-
Meta-Llama-3-8B-QQQ.yaml
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
from pathlib import Path
3+
4+
import pytest
5+
6+
7+
def pytest_addoption(parser):
8+
parser.addoption(
9+
"--config-list-file",
10+
action="store",
11+
help="Path to the file listing model config YAMLs (one per line)",
12+
)
13+
parser.addoption(
14+
"--tp-size",
15+
action="store",
16+
default="1",
17+
help="Tensor parallel size to use for evaluation",
18+
)
19+
20+
21+
@pytest.fixture(scope="session")
22+
def config_list_file(pytestconfig, config_dir):
23+
rel_path = pytestconfig.getoption("--config-list-file")
24+
return config_dir / rel_path
25+
26+
27+
@pytest.fixture(scope="session")
28+
def tp_size(pytestconfig):
29+
return pytestconfig.getoption("--tp-size")
30+
31+
32+
def pytest_generate_tests(metafunc):
33+
if "config_filename" in metafunc.fixturenames:
34+
rel_path = metafunc.config.getoption("--config-list-file")
35+
config_list_file = Path(rel_path).resolve()
36+
config_dir = config_list_file.parent
37+
with open(config_list_file, encoding="utf-8") as f:
38+
configs = [
39+
config_dir / line.strip()
40+
for line in f
41+
if line.strip() and not line.startswith("#")
42+
]
43+
metafunc.parametrize("config_filename", configs)

.buildkite/lm-eval-harness/run-tests.sh

Lines changed: 0 additions & 59 deletions
This file was deleted.

.buildkite/lm-eval-harness/test_lm_eval_correctness.py

Lines changed: 23 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,67 +3,52 @@
33
LM eval harness on model to compare vs HF baseline computed offline.
44
Configs are found in configs/$MODEL.yaml
55
6-
* export LM_EVAL_TEST_DATA_FILE=configs/Meta-Llama-3-70B-Instruct.yaml
7-
* export LM_EVAL_TP_SIZE=4
8-
* pytest -s test_lm_eval_correctness.py
6+
pytest -s -v test_lm_eval_correctness.py \
7+
--config-list-file=configs/models-small.txt \
8+
--tp-size=1
99
"""
1010

11-
import os
12-
from pathlib import Path
13-
1411
import lm_eval
15-
import numpy
16-
import pytest
12+
import numpy as np
1713
import yaml
1814

1915
RTOL = 0.08
20-
TEST_DATA_FILE = os.environ.get(
21-
"LM_EVAL_TEST_DATA_FILE",
22-
".buildkite/lm-eval-harness/configs/Meta-Llama-3-8B-Instruct.yaml")
23-
24-
TP_SIZE = os.environ.get("LM_EVAL_TP_SIZE", 1)
25-
2616

27-
def launch_lm_eval(eval_config):
28-
trust_remote_code = eval_config.get('trust_remote_code', False)
29-
30-
model_args = f"pretrained={eval_config['model_name']}," \
31-
f"tensor_parallel_size={TP_SIZE}," \
32-
f"add_bos_token=true," \
33-
f"trust_remote_code={trust_remote_code}"
3417

18+
def launch_lm_eval(eval_config, tp_size):
19+
trust_remote_code = eval_config.get("trust_remote_code", False)
20+
model_args = (
21+
f"pretrained={eval_config['model_name']},"
22+
f"tensor_parallel_size={tp_size},"
23+
f"enforce_eager=true,"
24+
f"add_bos_token=true,"
25+
f"trust_remote_code={trust_remote_code}"
26+
)
3527
results = lm_eval.simple_evaluate(
3628
model="vllm",
3729
model_args=model_args,
3830
tasks=[task["name"] for task in eval_config["tasks"]],
3931
num_fewshot=eval_config["num_fewshot"],
4032
limit=eval_config["limit"],
41-
batch_size="auto")
42-
33+
batch_size="auto",
34+
)
4335
return results
4436

4537

46-
def test_lm_eval_correctness():
47-
eval_config = yaml.safe_load(
48-
Path(TEST_DATA_FILE).read_text(encoding="utf-8"))
49-
50-
if eval_config[
51-
"model_name"] == "nm-testing/Meta-Llama-3-70B-Instruct-FBGEMM-nonuniform": #noqa: E501
52-
pytest.skip("FBGEMM is currently failing on main.")
38+
def test_lm_eval_correctness_param(config_filename, tp_size):
39+
eval_config = yaml.safe_load(config_filename.read_text(encoding="utf-8"))
5340

54-
# Launch eval requests.
55-
results = launch_lm_eval(eval_config)
41+
results = launch_lm_eval(eval_config, tp_size)
5642

57-
# Confirm scores match ground truth.
5843
success = True
5944
for task in eval_config["tasks"]:
6045
for metric in task["metrics"]:
6146
ground_truth = metric["value"]
6247
measured_value = results["results"][task["name"]][metric["name"]]
63-
print(f'{task["name"]} | {metric["name"]}: '
64-
f'ground_truth={ground_truth} | measured={measured_value}')
65-
success = success and numpy.isclose(
66-
ground_truth, measured_value, rtol=RTOL)
48+
print(
49+
f"{task['name']} | {metric['name']}: "
50+
f"ground_truth={ground_truth} | measured={measured_value}"
51+
)
52+
success = success and np.isclose(ground_truth, measured_value, rtol=RTOL)
6753

68-
# Assert at the end, print all scores even on failure for debugging.
6954
assert success

0 commit comments

Comments
 (0)