tool-call
: update scripts/fetch_server_test_models.py
This commit is contained in:
parent
b825440c81
commit
aefac1e5cb
2 changed files with 22 additions and 4 deletions
|
@ -62,3 +62,10 @@ After changing logic in `steps.py`, ensure that `@bug` and `@wrong_usage` scenar
|
||||||
```shell
|
```shell
|
||||||
./tests.sh --no-skipped --tags bug,wrong_usage || echo "should failed but compile"
|
./tests.sh --no-skipped --tags bug,wrong_usage || echo "should failed but compile"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Some tests (especially `@slow` ones) require model downloads. Since this can time out the tests, you can pre-download them in the cache ahead of time with:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
pip install -r examples/server/tests/requirements.txt
|
||||||
|
python scripts/fetch_server_test_models.py
|
||||||
|
```
|
||||||
|
|
|
@ -9,12 +9,13 @@
|
||||||
python scripts/fetch_server_test_models.py
|
python scripts/fetch_server_test_models.py
|
||||||
( cd examples/server/tests && ./tests.sh --tags=slow )
|
( cd examples/server/tests && ./tests.sh --tags=slow )
|
||||||
'''
|
'''
|
||||||
import os
|
|
||||||
from behave.parser import Parser
|
from behave.parser import Parser
|
||||||
import glob
|
import glob
|
||||||
import re
|
import os
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
class HuggingFaceModel(BaseModel):
|
class HuggingFaceModel(BaseModel):
|
||||||
|
@ -60,8 +61,18 @@ cli_path = os.environ.get(
|
||||||
os.path.dirname(__file__),
|
os.path.dirname(__file__),
|
||||||
'../build/bin/Release/llama-cli.exe' if os.name == 'nt' else '../build/bin/llama-cli'))
|
'../build/bin/Release/llama-cli.exe' if os.name == 'nt' else '../build/bin/llama-cli'))
|
||||||
|
|
||||||
for m in models:
|
for m in sorted(list(models), key=lambda m: m.hf_repo):
|
||||||
if '<' in m.hf_repo or '<' in m.hf_file:
|
if '<' in m.hf_repo or '<' in m.hf_file:
|
||||||
continue
|
continue
|
||||||
|
if '-of-' in m.hf_file:
|
||||||
|
print(f'# Skipping model at {m.hf_repo} / {m.hf_file} because it is a split file', file=sys.stderr)
|
||||||
|
continue
|
||||||
print(f'# Ensuring model at {m.hf_repo} / {m.hf_file} is fetched')
|
print(f'# Ensuring model at {m.hf_repo} / {m.hf_file} is fetched')
|
||||||
subprocess.check_call([cli_path, '-hfr', m.hf_repo, '-hff', m.hf_file, '-fa', '-n', '1', '-p', 'Hey', '--no-warmup'])
|
cmd = [cli_path, '-hfr', m.hf_repo, '-hff', m.hf_file, '-n', '1', '-p', 'Hey', '--no-warmup', '--log-disable']
|
||||||
|
if m.hf_file != 'tinyllamas/stories260K.gguf':
|
||||||
|
cmd.append('-fa')
|
||||||
|
try:
|
||||||
|
subprocess.check_call(cmd)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
print(f'# Failed to fetch model at {m.hf_repo} / {m.hf_file} with command:\n {" ".join(cmd)}', file=sys.stderr)
|
||||||
|
exit(1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue