Skip to content

Commit d6da029

Browse files
committed
update
1 parent c04565c commit d6da029

6 files changed

Lines changed: 82 additions & 64 deletions

File tree

.github/workflows/pre-commit.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@ jobs:
2525
pip install -e ".[dev]"
2626
2727
- name: Run pre-commit
28+
env:
29+
SKIP: regenerate-templates
2830
run: |
2931
pre-commit run --all-files --show-diff-on-failure

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ repos:
3535
hooks:
3636
- id: prettier
3737
types_or: [yaml, json, markdown]
38-
exclude: ^(src/inference_endpoint/openai/openai_types_gen.py|src/inference_endpoint/openai/openapi.yaml|src/inference_endpoint/config/templates/)$
38+
exclude: ^(src/inference_endpoint/openai/openai_types_gen.py|src/inference_endpoint/openai/openapi.yaml|src/inference_endpoint/config/templates/)
3939

4040
- repo: local
4141
hooks:
@@ -53,7 +53,7 @@ repos:
5353
entry: python scripts/regenerate_templates.py
5454
language: system
5555
pass_filenames: false
56-
files: ^src/inference_endpoint/config/schema\.py
56+
files: ^(src/inference_endpoint/config/schema\.py|scripts/regenerate_templates\.py)$
5757

5858
- id: add-license-header
5959
name: Add license headers

scripts/regenerate_templates.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,26 +86,42 @@ def _clean(full: dict) -> dict:
8686
return out
8787

8888

89-
def main():
89+
def main(check_only: bool = False):
90+
"""Regenerate templates, or check they're up to date (--check flag)."""
91+
stale = False
9092
for name, overrides in _TEMPLATES.items():
9193
test_type = TestType.OFFLINE if name == "offline" else TestType.ONLINE
9294
try:
9395
base = BenchmarkConfig.create_default_config(test_type)
9496
cfg = base.with_updates(**overrides)
9597
except (CLIError, ValueError) as e:
96-
print(f" Skip: {name} ({e})")
98+
print(f" FAIL: {name} ({e})")
99+
stale = True
97100
continue
98101

99-
path = TEMPLATES_DIR / f"{name}_template.yaml"
100-
path.write_text(
101-
yaml.dump(
102-
_clean(cfg.model_dump(mode="json")),
103-
default_flow_style=False,
104-
sort_keys=False,
105-
)
102+
expected = yaml.dump(
103+
_clean(cfg.model_dump(mode="json")),
104+
default_flow_style=False,
105+
sort_keys=False,
106106
)
107-
print(f" Generated: {path.name}")
107+
path = TEMPLATES_DIR / f"{name}_template.yaml"
108+
109+
if check_only:
110+
current = path.read_text() if path.exists() else ""
111+
if current != expected:
112+
print(f" STALE: {path.name}")
113+
stale = True
114+
else:
115+
print(f" OK: {path.name}")
116+
else:
117+
path.write_text(expected)
118+
print(f" Generated: {path.name}")
119+
120+
if stale:
121+
raise SystemExit(1)
108122

109123

110124
if __name__ == "__main__":
111-
main()
125+
import sys
126+
127+
main(check_only="--check" in sys.argv)

src/inference_endpoint/config/templates/concurrency_template.yaml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
name: online_benchmark
2-
version: "1.0"
2+
version: '1.0'
33
type: online
44
model_params:
5-
name: "<MODEL_NAME eg: meta-llama/Llama-3.1-8B-Instruct>"
5+
name: '<MODEL_NAME eg: meta-llama/Llama-3.1-8B-Instruct>'
66
temperature: 0.7
77
top_k: null
88
top_p: 0.9
99
repetition_penalty: null
1010
max_new_tokens: 1024
1111
osl_distribution: null
12-
streaming: "on"
12+
streaming: 'on'
1313
datasets:
14-
- name: perf-test
15-
type: performance
16-
path: "<DATASET_PATH eg: tests/datasets/dummy_1k.jsonl>"
17-
format: null
18-
samples: 1000
19-
eval_method: null
20-
parser:
21-
prompt: text_input
22-
accuracy_config: null
14+
- name: perf-test
15+
type: performance
16+
path: '<DATASET_PATH eg: tests/datasets/dummy_1k.jsonl>'
17+
format: null
18+
samples: 1000
19+
eval_method: null
20+
parser:
21+
prompt: text_input
22+
accuracy_config: null
2323
settings:
2424
runtime:
2525
min_duration_ms: 600000
@@ -55,13 +55,13 @@ settings:
5555
worker_gc_mode: relaxed
5656
metrics:
5757
collect:
58-
- throughput
59-
- latency
60-
- ttft
61-
- tpot
58+
- throughput
59+
- latency
60+
- ttft
61+
- tpot
6262
endpoint_config:
6363
endpoints:
64-
- "<ENDPOINT_URL eg: http://localhost:8000>"
64+
- '<ENDPOINT_URL eg: http://localhost:8000>'
6565
api_key: null
6666
api_type: openai
6767
report_dir: null

src/inference_endpoint/config/templates/offline_template.yaml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
name: offline_benchmark
2-
version: "1.0"
2+
version: '1.0'
33
type: offline
44
model_params:
5-
name: "<MODEL_NAME eg: meta-llama/Llama-3.1-8B-Instruct>"
5+
name: '<MODEL_NAME eg: meta-llama/Llama-3.1-8B-Instruct>'
66
temperature: 0.7
77
top_k: null
88
top_p: 0.9
99
repetition_penalty: null
1010
max_new_tokens: 1024
1111
osl_distribution: null
12-
streaming: "off"
12+
streaming: 'off'
1313
datasets:
14-
- name: perf-test
15-
type: performance
16-
path: "<DATASET_PATH eg: tests/datasets/dummy_1k.jsonl>"
17-
format: null
18-
samples: 1000
19-
eval_method: null
20-
parser:
21-
prompt: text_input
22-
accuracy_config: null
14+
- name: perf-test
15+
type: performance
16+
path: '<DATASET_PATH eg: tests/datasets/dummy_1k.jsonl>'
17+
format: null
18+
samples: 1000
19+
eval_method: null
20+
parser:
21+
prompt: text_input
22+
accuracy_config: null
2323
settings:
2424
runtime:
2525
min_duration_ms: 600000
@@ -55,13 +55,13 @@ settings:
5555
worker_gc_mode: relaxed
5656
metrics:
5757
collect:
58-
- throughput
59-
- latency
60-
- ttft
61-
- tpot
58+
- throughput
59+
- latency
60+
- ttft
61+
- tpot
6262
endpoint_config:
6363
endpoints:
64-
- "<ENDPOINT_URL eg: http://localhost:8000>"
64+
- '<ENDPOINT_URL eg: http://localhost:8000>'
6565
api_key: null
6666
api_type: openai
6767
report_dir: null

src/inference_endpoint/config/templates/online_template.yaml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
name: online_benchmark
2-
version: "1.0"
2+
version: '1.0'
33
type: online
44
model_params:
5-
name: "<MODEL_NAME eg: meta-llama/Llama-3.1-8B-Instruct>"
5+
name: '<MODEL_NAME eg: meta-llama/Llama-3.1-8B-Instruct>'
66
temperature: 0.7
77
top_k: null
88
top_p: 0.9
99
repetition_penalty: null
1010
max_new_tokens: 1024
1111
osl_distribution: null
12-
streaming: "on"
12+
streaming: 'on'
1313
datasets:
14-
- name: perf-test
15-
type: performance
16-
path: "<DATASET_PATH eg: tests/datasets/dummy_1k.jsonl>"
17-
format: null
18-
samples: 1000
19-
eval_method: null
20-
parser:
21-
prompt: text_input
22-
accuracy_config: null
14+
- name: perf-test
15+
type: performance
16+
path: '<DATASET_PATH eg: tests/datasets/dummy_1k.jsonl>'
17+
format: null
18+
samples: 1000
19+
eval_method: null
20+
parser:
21+
prompt: text_input
22+
accuracy_config: null
2323
settings:
2424
runtime:
2525
min_duration_ms: 600000
@@ -55,13 +55,13 @@ settings:
5555
worker_gc_mode: relaxed
5656
metrics:
5757
collect:
58-
- throughput
59-
- latency
60-
- ttft
61-
- tpot
58+
- throughput
59+
- latency
60+
- ttft
61+
- tpot
6262
endpoint_config:
6363
endpoints:
64-
- "<ENDPOINT_URL eg: http://localhost:8000>"
64+
- '<ENDPOINT_URL eg: http://localhost:8000>'
6565
api_key: null
6666
api_type: openai
6767
report_dir: null

0 commit comments

Comments
 (0)