Skip to content

Commit 217c9e4

Browse files
committed
no cache_prompt for some tests
1 parent 71fc0f1 commit 217c9e4

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

examples/server/tests/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ It's possible to override some scenario steps values with environment variables:
2929
|--------------------------|------------------------------------------------------------------------------------------------|
3030
| `PORT` | `context.server_port` to set the listening port of the server during scenario, default: `8080` |
3131
| `LLAMA_SERVER_BIN_PATH` | to change the server binary path, default: `../../../build/bin/llama-server` |
32-
| `DEBUG` | "ON" to enable steps and server verbose mode `--verbose` |
32+
| `DEBUG` | to enable steps and server verbose mode `--verbose` |
3333
| `N_GPU_LAYERS` | number of model layers to offload to VRAM `-ngl --n-gpu-layers` |
3434

3535
To run slow tests:
@@ -41,7 +41,7 @@ SLOW_TESTS=1 ./tests.sh
4141
To run with stdout/stderr display in real time (verbose output, but useful for debugging):
4242

4343
```shell
44-
./tests.sh -s -v -x
44+
DEBUG=1 ./tests.sh -s -v -x
4545
```
4646

4747
To see all available arguments, please refer to [pytest documentation](https://docs.pytest.org/en/stable/how-to/usage.html)

examples/server/tests/unit/test_completion.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def test_consistent_result_same_seed(n_slots: int):
6262
"prompt": "I believe the meaning of life is",
6363
"seed": 42,
6464
"temperature": 1.0,
65+
"cache_prompt": False,
6566
})
6667
if last_res is not None:
6768
assert res.body["content"] == last_res.body["content"]
@@ -79,6 +80,7 @@ def test_different_result_different_seed(n_slots: int):
7980
"prompt": "I believe the meaning of life is",
8081
"seed": seed,
8182
"temperature": 1.0,
83+
"cache_prompt": False,
8284
})
8385
if last_res is not None:
8486
assert res.body["content"] != last_res.body["content"]
@@ -97,6 +99,7 @@ def test_consistent_result_different_batch_size(n_batch: int, temperature: float
9799
"prompt": "I believe the meaning of life is",
98100
"seed": 42,
99101
"temperature": temperature,
102+
"cache_prompt": False,
100103
})
101104
if last_res is not None:
102105
assert res.body["content"] == last_res.body["content"]

examples/server/tests/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ class ServerProcess:
7474
process: subprocess.Popen | None = None
7575

7676
def __init__(self):
77-
pass
77+
if "N_GPU_LAYERS" in os.environ:
78+
self.n_gpu_layer = int(os.environ["N_GPU_LAYERS"])
79+
if "DEBUG" in os.environ:
80+
self.debug = True
81+
if "PORT" in os.environ:
82+
self.server_port = int(os.environ["PORT"])
7883

7984
def start(self, timeout_seconds: int = 10) -> None:
8085
if "LLAMA_SERVER_BIN_PATH" in os.environ:

0 commit comments

Comments
 (0)