2024-02-24 12:28:55 +01:00
|
|
|
# Server tests
|
|
|
|
|
2024-11-26 16:20:18 +01:00
|
|
|
Python based server tests scenario using [pytest](https://docs.pytest.org/en/stable/).
|
2024-02-24 12:28:55 +01:00
|
|
|
|
|
|
|
Tests target GitHub workflows job runners with 4 vCPU.
|
|
|
|
|
2024-03-02 22:00:14 +01:00
|
|
|
Note: If the host architecture inference speed is faster than GitHub runners one, parallel scenario may randomly fail.
|
|
|
|
To mitigate it, you can increase values in `n_predict`, `kv_size`.
|
2024-02-24 12:28:55 +01:00
|
|
|
|
|
|
|
### Install dependencies
|
2024-03-02 22:00:14 +01:00
|
|
|
|
2024-02-24 12:28:55 +01:00
|
|
|
`pip install -r requirements.txt`
|
|
|
|
|
|
|
|
### Run tests
|
2024-03-02 22:00:14 +01:00
|
|
|
|
2024-02-24 12:28:55 +01:00
|
|
|
1. Build the server
|
2024-03-02 22:00:14 +01:00
|
|
|
|
2024-02-24 12:28:55 +01:00
|
|
|
```shell
|
|
|
|
cd ../../..
|
2024-06-13 01:41:52 +02:00
|
|
|
cmake -B build -DLLAMA_CURL=ON
|
|
|
|
cmake --build build --target llama-server
|
2024-02-24 12:28:55 +01:00
|
|
|
```
|
2024-03-02 22:00:14 +01:00
|
|
|
|
|
|
|
2. Start the test: `./tests.sh`
|
2024-02-24 12:28:55 +01:00
|
|
|
|
|
|
|
It's possible to override some scenario steps values with environment variables:
|
2024-03-02 22:00:14 +01:00
|
|
|
|
|
|
|
| variable | description |
|
|
|
|
|--------------------------|------------------------------------------------------------------------------------------------|
|
|
|
|
| `PORT` | `context.server_port` to set the listening port of the server during scenario, default: `8080` |
|
2024-06-13 01:41:52 +02:00
|
|
|
| `LLAMA_SERVER_BIN_PATH` | to change the server binary path, default: `../../../build/bin/llama-server` |
|
2024-11-26 16:20:18 +01:00
|
|
|
| `DEBUG` | to enable steps and server verbose mode `--verbose` |
|
2024-03-02 22:00:14 +01:00
|
|
|
| `N_GPU_LAYERS` | number of model layers to offload to VRAM `-ngl --n-gpu-layers` |
|
2024-02-24 12:28:55 +01:00
|
|
|
|
2024-11-26 16:20:18 +01:00
|
|
|
To run slow tests:
|
2024-03-02 22:00:14 +01:00
|
|
|
|
|
|
|
```shell
|
2024-11-26 16:20:18 +01:00
|
|
|
SLOW_TESTS=1 ./tests.sh
|
2024-03-02 22:00:14 +01:00
|
|
|
```
|
2024-02-24 12:28:55 +01:00
|
|
|
|
2024-11-26 16:20:18 +01:00
|
|
|
To run with stdout/stderr display in real time (verbose output, but useful for debugging):
|
2024-03-02 22:00:14 +01:00
|
|
|
|
|
|
|
```shell
|
2024-11-26 16:20:18 +01:00
|
|
|
DEBUG=1 ./tests.sh -s -v -x
|
2024-03-02 22:00:14 +01:00
|
|
|
```
|
2024-11-26 16:20:18 +01:00
|
|
|
|
2024-12-06 11:14:32 +01:00
|
|
|
Hint: You can compile and run test in single command, useful for local developement:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
cmake --build build -j --target llama-server && ./examples/server/tests/tests.sh
|
|
|
|
```
|
|
|
|
|
2024-11-26 16:20:18 +01:00
|
|
|
To see all available arguments, please refer to [pytest documentation](https://docs.pytest.org/en/stable/how-to/usage.html)
|