Skip to content

Commit 9685043

Browse files
author
Olivier Chafik
committed
Update scripts/fetch_server_test_models.py to new compact hf_repo syntax + switch Hermes models
1 parent 0c171f5 commit 9685043

File tree

2 files changed

+25
-16
lines changed

2 files changed

+25
-16
lines changed

examples/server/tests/unit/test_tool_call.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ def test_completion_with_required_tool_tiny_slow(template_name: str, tool: dict,
143143
(PYTHON_TOOL, "code", "bartowski/Phi-3.5-mini-instruct-GGUF:Q4_K_M", None),
144144
(TEST_TOOL, "success", "bartowski/Qwen2.5-7B-Instruct-GGUF:Q4_K_M", None),
145145
(PYTHON_TOOL, "code", "bartowski/Qwen2.5-7B-Instruct-GGUF:Q4_K_M", None),
146-
(TEST_TOOL, "success", "NousResearch/Hermes-2-Pro-Llama-3-8B-GGUF:Q4_K_M", ("NousResearch/Hermes-2-Pro-Llama-3-8B", "tool_use")),
147-
(PYTHON_TOOL, "code", "NousResearch/Hermes-2-Pro-Llama-3-8B-GGUF:Q4_K_M", ("NousResearch/Hermes-2-Pro-Llama-3-8B", "tool_use")),
148-
(TEST_TOOL, "success", "NousResearch/Hermes-3-Llama-3.1-8B-GGUF:Q4_K_M", ("NousResearch/Hermes-3-Llama-3.1-8B", "tool_use")),
149-
(PYTHON_TOOL, "code", "NousResearch/Hermes-3-Llama-3.1-8B-GGUF:Q4_K_M", ("NousResearch/Hermes-3-Llama-3.1-8B", "tool_use")),
146+
(TEST_TOOL, "success", "bartowski/Hermes-2-Pro-Llama-3-8B-GGUF:Q4_K_M", ("NousResearch/Hermes-2-Pro-Llama-3-8B", "tool_use")),
147+
(PYTHON_TOOL, "code", "bartowski/Hermes-2-Pro-Llama-3-8B-GGUF:Q4_K_M", ("NousResearch/Hermes-2-Pro-Llama-3-8B", "tool_use")),
148+
(TEST_TOOL, "success", "bartowski/Hermes-3-Llama-3.1-8B-GGUF:Q4_K_M", ("NousResearch/Hermes-3-Llama-3.1-8B", "tool_use")),
149+
(PYTHON_TOOL, "code", "bartowski/Hermes-3-Llama-3.1-8B-GGUF:Q4_K_M", ("NousResearch/Hermes-3-Llama-3.1-8B", "tool_use")),
150150
(TEST_TOOL, "success", "bartowski/Mistral-Nemo-Instruct-2407-GGUF:Q4_K_M", None),
151151
(PYTHON_TOOL, "code", "bartowski/Mistral-Nemo-Instruct-2407-GGUF:Q4_K_M", None),
152152
(TEST_TOOL, "success", "bartowski/functionary-small-v3.2-GGUF:Q8_0", ("meetkai/functionary-medium-v3.2", None)),
@@ -252,8 +252,8 @@ def test_completion_without_tool_call_slow(template_name: str, n_predict: int, t
252252
("bartowski/gemma-2-2b-it-GGUF:Q4_K_M", None),
253253
("bartowski/Phi-3.5-mini-instruct-GGUF:Q4_K_M", None),
254254
("bartowski/Qwen2.5-7B-Instruct-GGUF:Q4_K_M", None),
255-
("NousResearch/Hermes-2-Pro-Llama-3-8B-GGUF:Q4_K_M", ("NousResearch/Hermes-2-Pro-Llama-3-8B", "tool_use")),
256-
("NousResearch/Hermes-3-Llama-3.1-8B-GGUF:Q4_K_M", ("NousResearch/Hermes-3-Llama-3.1-8B", "tool_use")),
255+
("bartowski/Hermes-2-Pro-Llama-3-8B-GGUF:Q4_K_M", ("NousResearch/Hermes-2-Pro-Llama-3-8B", "tool_use")),
256+
("bartowski/Hermes-3-Llama-3.1-8B-GGUF:Q4_K_M", ("NousResearch/Hermes-3-Llama-3.1-8B", "tool_use")),
257257
("bartowski/Mistral-Nemo-Instruct-2407-GGUF:Q4_K_M", None),
258258
("bartowski/functionary-small-v3.2-GGUF:Q8_0", ("meetkai/functionary-medium-v3.2", None)),
259259
("bartowski/Llama-3.2-3B-Instruct-GGUF:Q4_K_M", ("meta-llama/Llama-3.2-3B-Instruct", None)),
@@ -301,8 +301,8 @@ def test_weather_tool_call(hf_repo: str, template_override: Tuple[str, str | Non
301301
(None, "bartowski/Llama-3.2-1B-Instruct-GGUF:Q4_K_M", ("meta-llama-Llama-3.2-3B-Instruct", None)),
302302
('{"code":"print("}', "bartowski/Llama-3.2-3B-Instruct-GGUF:Q4_K_M", ("meta-llama-Llama-3.2-3B-Instruct", None)),
303303
(None, "bartowski/Qwen2.5-7B-Instruct-GGUF:Q4_K_M", None),
304-
(None, "NousResearch/Hermes-2-Pro-Llama-3-8B:Q4_K_M", ("NousResearch/Hermes-2-Pro-Llama-3-8B", "tool_use")),
305-
(None, "NousResearch/Hermes-3-Llama-3.1-8B-GGUF:Q4_K_M", ("NousResearch-Hermes-3-Llama-3.1-8B", "tool_use")),
304+
(None, "bartowski/Hermes-2-Pro-Llama-3-8B-GGUF:Q4_K_M", ("NousResearch/Hermes-2-Pro-Llama-3-8B", "tool_use")),
305+
(None, "bartowski/Hermes-3-Llama-3.1-8B-GGUF:Q4_K_M", ("NousResearch-Hermes-3-Llama-3.1-8B", "tool_use")),
306306
(None, "bartowski/Mistral-Nemo-Instruct-2407-GGUF:Q4_K_M", None),
307307
# (None, "bartowski/DeepSeek-R1-Distill-Qwen-7B-GGUF:Q4_K_M", None),
308308
])

scripts/fetch_server_test_models.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
import os
1717
from typing import Generator
1818
from pydantic import BaseModel
19+
from typing import *
1920
import subprocess
2021

2122

2223
class HuggingFaceModel(BaseModel):
2324
hf_repo: str
24-
hf_file: str
25+
hf_file: Optional[str] = None
2526

2627
class Config:
2728
frozen = True
@@ -40,7 +41,7 @@ def collect_hf_model_test_parameters(test_file) -> Generator[HuggingFaceModel, N
4041
for dec in node.decorator_list:
4142
if isinstance(dec, ast.Call) and isinstance(dec.func, ast.Attribute) and dec.func.attr == 'parametrize':
4243
param_names = ast.literal_eval(dec.args[0]).split(",")
43-
if "hf_repo" not in param_names or "hf_file" not in param_names:
44+
if "hf_repo" not in param_names:
4445
continue
4546

4647
raw_param_values = dec.args[1]
@@ -49,15 +50,15 @@ def collect_hf_model_test_parameters(test_file) -> Generator[HuggingFaceModel, N
4950
continue
5051

5152
hf_repo_idx = param_names.index("hf_repo")
52-
hf_file_idx = param_names.index("hf_file")
53+
hf_file_idx = param_names.index("hf_file") if "hf_file" in param_names else None
5354

5455
for t in raw_param_values.elts:
5556
if not isinstance(t, ast.Tuple):
5657
logging.warning(f'Skipping non-tuple parametrize entry at {test_file}:{node.lineno}')
5758
continue
5859
yield HuggingFaceModel(
5960
hf_repo=ast.literal_eval(t.elts[hf_repo_idx]),
60-
hf_file=ast.literal_eval(t.elts[hf_file_idx]))
61+
hf_file=ast.literal_eval(t.elts[hf_file_idx]) if hf_file_idx is not None else None)
6162

6263

6364
if __name__ == '__main__':
@@ -80,14 +81,22 @@ def collect_hf_model_test_parameters(test_file) -> Generator[HuggingFaceModel, N
8081
'../build/bin/Release/llama-cli.exe' if os.name == 'nt' else '../build/bin/llama-cli'))
8182

8283
for m in models:
83-
if '<' in m.hf_repo or '<' in m.hf_file:
84+
if '<' in m.hf_repo or (m.hf_file is not None and '<' in m.hf_file):
8485
continue
85-
if '-of-' in m.hf_file:
86+
if m.hf_file is not None and '-of-' in m.hf_file:
8687
logging.warning(f'Skipping model at {m.hf_repo} / {m.hf_file} because it is a split file')
8788
continue
8889
logging.info(f'Using llama-cli to ensure model {m.hf_repo}/{m.hf_file} was fetched')
89-
cmd = [cli_path, '-hfr', m.hf_repo, '-hff', m.hf_file, '-n', '1', '-p', 'Hey', '--no-warmup', '--log-disable', '-no-cnv']
90-
if m.hf_file != 'tinyllamas/stories260K.gguf' and not m.hf_file.startswith('Mistral-Nemo'):
90+
cmd = [
91+
cli_path,
92+
'-hfr', m.hf_repo,
93+
*([] if m.hf_file is None else ['-hff', m.hf_file]),
94+
'-n', '1',
95+
'-p', 'Hey',
96+
'--no-warmup',
97+
'--log-disable',
98+
'-no-cnv']
99+
if m.hf_file != 'tinyllamas/stories260K.gguf' and 'Mistral-Nemo' not in m.hf_repo:
91100
cmd.append('-fa')
92101
try:
93102
subprocess.check_call(cmd)

0 commit comments

Comments
 (0)