vec-inf 0.4.1__py3-none-any.whl → 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vec_inf/README.md +3 -3
- vec_inf/cli/_cli.py +227 -325
- vec_inf/cli/_helper.py +400 -0
- vec_inf/cli/_utils.py +26 -135
- vec_inf/cli/_vars.py +32 -0
- vec_inf/client/__init__.py +31 -0
- vec_inf/client/_client_vars.py +213 -0
- vec_inf/client/_exceptions.py +37 -0
- vec_inf/client/_helper.py +674 -0
- vec_inf/client/_slurm_script_generator.py +179 -0
- vec_inf/client/_utils.py +287 -0
- vec_inf/client/api.py +302 -0
- vec_inf/client/config.py +128 -0
- vec_inf/client/models.py +225 -0
- vec_inf/client/slurm_vars.py +49 -0
- vec_inf/{models → config}/README.md +30 -12
- vec_inf/config/models.yaml +1300 -0
- vec_inf-0.6.0.dist-info/METADATA +193 -0
- vec_inf-0.6.0.dist-info/RECORD +25 -0
- vec_inf/launch_server.sh +0 -145
- vec_inf/models/models.csv +0 -85
- vec_inf/multinode_vllm.slurm +0 -124
- vec_inf/vllm.slurm +0 -59
- vec_inf-0.4.1.dist-info/METADATA +0 -121
- vec_inf-0.4.1.dist-info/RECORD +0 -16
- {vec_inf-0.4.1.dist-info → vec_inf-0.6.0.dist-info}/WHEEL +0 -0
- {vec_inf-0.4.1.dist-info → vec_inf-0.6.0.dist-info}/entry_points.txt +0 -0
- {vec_inf-0.4.1.dist-info → vec_inf-0.6.0.dist-info}/licenses/LICENSE +0 -0
vec_inf-0.4.1.dist-info/METADATA
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: vec-inf
|
|
3
|
-
Version: 0.4.1
|
|
4
|
-
Summary: Efficient LLM inference on Slurm clusters using vLLM.
|
|
5
|
-
Author-email: Marshall Wang <marshall.wang@vectorinstitute.ai>
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
License-File: LICENSE
|
|
8
|
-
Requires-Python: <3.11,>=3.10
|
|
9
|
-
Requires-Dist: click>=8.1.0
|
|
10
|
-
Requires-Dist: numpy>=1.24.0
|
|
11
|
-
Requires-Dist: polars>=1.15.0
|
|
12
|
-
Requires-Dist: requests>=2.31.0
|
|
13
|
-
Requires-Dist: rich>=13.7.0
|
|
14
|
-
Provides-Extra: dev
|
|
15
|
-
Requires-Dist: cupy-cuda12x==12.1.0; extra == 'dev'
|
|
16
|
-
Requires-Dist: ray>=2.40.0; extra == 'dev'
|
|
17
|
-
Requires-Dist: vllm-nccl-cu12<2.19,>=2.18; extra == 'dev'
|
|
18
|
-
Requires-Dist: vllm>=0.7.2; extra == 'dev'
|
|
19
|
-
Description-Content-Type: text/markdown
|
|
20
|
-
|
|
21
|
-
# Vector Inference: Easy inference on Slurm clusters
|
|
22
|
-
|
|
23
|
-
----------------------------------------------------
|
|
24
|
-
|
|
25
|
-
[](https://github.com/VectorInstitute/vector-inference/actions/workflows/code_checks.yml)
|
|
26
|
-
[](https://github.com/VectorInstitute/vector-inference/actions/workflows/docs_build.yml)
|
|
27
|
-
[](https://codecov.io/github/VectorInstitute/vector-inference)
|
|
28
|
-

|
|
29
|
-
|
|
30
|
-
This repository provides an easy-to-use solution to run inference servers on [Slurm](https://slurm.schedmd.com/overview.html)-managed computing clusters using [vLLM](https://docs.vllm.ai/en/latest/). **All scripts in this repository runs natively on the Vector Institute cluster environment**. To adapt to other environments, update [`launch_server.sh`](vec_inf/launch_server.sh), [`vllm.slurm`](vec_inf/vllm.slurm), [`multinode_vllm.slurm`](vec_inf/multinode_vllm.slurm) and [`models.csv`](vec_inf/models/models.csv) accordingly.
|
|
31
|
-
|
|
32
|
-
## Installation
|
|
33
|
-
If you are using the Vector cluster environment, and you don't need any customization to the inference server environment, run the following to install package:
|
|
34
|
-
```bash
|
|
35
|
-
pip install vec-inf
|
|
36
|
-
```
|
|
37
|
-
Otherwise, we recommend using the provided [`Dockerfile`](Dockerfile) to set up your own environment with the package
|
|
38
|
-
|
|
39
|
-
## Launch an inference server
|
|
40
|
-
### `launch` command
|
|
41
|
-
We will use the Llama 3.1 model as example, to launch an OpenAI compatible inference server for Meta-Llama-3.1-8B-Instruct, run:
|
|
42
|
-
```bash
|
|
43
|
-
vec-inf launch Meta-Llama-3.1-8B-Instruct
|
|
44
|
-
```
|
|
45
|
-
You should see an output like the following:
|
|
46
|
-
|
|
47
|
-
<img width="600" alt="launch_img" src="https://github.com/user-attachments/assets/ab658552-18b2-47e0-bf70-e539c3b898d5">
|
|
48
|
-
|
|
49
|
-
The model would be launched using the [default parameters](vec_inf/models/models.csv), you can override these values by providing additional parameters, use `--help` to see the full list. You can also launch your own customized model as long as the model architecture is [supported by vLLM](https://docs.vllm.ai/en/stable/models/supported_models.html), and make sure to follow the instructions below:
|
|
50
|
-
* Your model weights directory naming convention should follow `$MODEL_FAMILY-$MODEL_VARIANT`.
|
|
51
|
-
* Your model weights directory should contain HF format weights.
|
|
52
|
-
* The following launch parameters will conform to default value if not specified: `--max-num-seqs`, `--partition`, `--data-type`, `--venv`, `--log-dir`, `--model-weights-parent-dir`, `--pipeline-parallelism`, `--enforce-eager`. All other launch parameters need to be specified for custom models.
|
|
53
|
-
* Example for setting the model weights parent directory: `--model-weights-parent-dir /h/user_name/my_weights`.
|
|
54
|
-
* For other model launch parameters you can reference the default values for similar models using the [`list` command ](#list-command).
|
|
55
|
-
|
|
56
|
-
### `status` command
|
|
57
|
-
You can check the inference server status by providing the Slurm job ID to the `status` command:
|
|
58
|
-
```bash
|
|
59
|
-
vec-inf status 13014393
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
You should see an output like the following:
|
|
63
|
-
|
|
64
|
-
<img width="400" alt="status_img" src="https://github.com/user-attachments/assets/7385b9ca-9159-4ca9-bae2-7e26d80d9747">
|
|
65
|
-
|
|
66
|
-
There are 5 possible states:
|
|
67
|
-
|
|
68
|
-
* **PENDING**: Job submitted to Slurm, but not executed yet. Job pending reason will be shown.
|
|
69
|
-
* **LAUNCHING**: Job is running but the server is not ready yet.
|
|
70
|
-
* **READY**: Inference server running and ready to take requests.
|
|
71
|
-
* **FAILED**: Inference server in an unhealthy state. Job failed reason will be shown.
|
|
72
|
-
* **SHUTDOWN**: Inference server is shutdown/cancelled.
|
|
73
|
-
|
|
74
|
-
Note that the base URL is only available when model is in `READY` state, and if you've changed the Slurm log directory path, you also need to specify it when using the `status` command.
|
|
75
|
-
|
|
76
|
-
### `metrics` command
|
|
77
|
-
Once your server is ready, you can check performance metrics by providing the Slurm job ID to the `metrics` command:
|
|
78
|
-
```bash
|
|
79
|
-
vec-inf metrics 13014393
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
And you will see the performance metrics streamed to your console, note that the metrics are updated with a 10-second interval.
|
|
83
|
-
|
|
84
|
-
<img width="400" alt="metrics_img" src="https://github.com/user-attachments/assets/e5ff2cd5-659b-4c88-8ebc-d8f3fdc023a4">
|
|
85
|
-
|
|
86
|
-
### `shutdown` command
|
|
87
|
-
Finally, when you're finished using a model, you can shut it down by providing the Slurm job ID:
|
|
88
|
-
```bash
|
|
89
|
-
vec-inf shutdown 13014393
|
|
90
|
-
|
|
91
|
-
> Shutting down model with Slurm Job ID: 13014393
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### `list` command
|
|
95
|
-
You call view the full list of available models by running the `list` command:
|
|
96
|
-
```bash
|
|
97
|
-
vec-inf list
|
|
98
|
-
```
|
|
99
|
-
<img width="940" alt="list_img" src="https://github.com/user-attachments/assets/8cf901c4-404c-4398-a52f-0486f00747a3">
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
You can also view the default setup for a specific supported model by providing the model name, for example `Meta-Llama-3.1-70B-Instruct`:
|
|
103
|
-
```bash
|
|
104
|
-
vec-inf list Meta-Llama-3.1-70B-Instruct
|
|
105
|
-
```
|
|
106
|
-
<img width="400" alt="list_model_img" src="https://github.com/user-attachments/assets/30e42ab7-dde2-4d20-85f0-187adffefc3d">
|
|
107
|
-
|
|
108
|
-
`launch`, `list`, and `status` command supports `--json-mode`, where the command output would be structured as a JSON string.
|
|
109
|
-
|
|
110
|
-
## Send inference requests
|
|
111
|
-
Once the inference server is ready, you can start sending in inference requests. We provide example scripts for sending inference requests in [`examples`](examples) folder. Make sure to update the model server URL and the model weights location in the scripts. For example, you can run `python examples/inference/llm/completions.py`, and you should expect to see an output like the following:
|
|
112
|
-
> {"id":"cmpl-c08d8946224747af9cce9f4d9f36ceb3","object":"text_completion","created":1725394970,"model":"Meta-Llama-3.1-8B-Instruct","choices":[{"index":0,"text":" is a question that many people may wonder. The answer is, of course, Ottawa. But if","logprobs":null,"finish_reason":"length","stop_reason":null}],"usage":{"prompt_tokens":8,"total_tokens":28,"completion_tokens":20}}
|
|
113
|
-
|
|
114
|
-
**NOTE**: For multimodal models, currently only `ChatCompletion` is available, and only one image can be provided for each prompt.
|
|
115
|
-
|
|
116
|
-
## SSH tunnel from your local device
|
|
117
|
-
If you want to run inference from your local device, you can open a SSH tunnel to your cluster environment like the following:
|
|
118
|
-
```bash
|
|
119
|
-
ssh -L 8081:172.17.8.29:8081 username@v.vectorinstitute.ai -N
|
|
120
|
-
```
|
|
121
|
-
Where the last number in the URL is the GPU number (gpu029 in this case). The example provided above is for the vector cluster, change the variables accordingly for your environment
|
vec_inf-0.4.1.dist-info/RECORD
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
vec_inf/README.md,sha256=dxX0xKfwLioG0mJ2YFv5JJ5q1m5NlWBrVBOap1wuHfQ,624
|
|
2
|
-
vec_inf/__init__.py,sha256=bHwSIz9lebYuxIemni-lP0h3gwJHVbJnwExQKGJWw_Q,23
|
|
3
|
-
vec_inf/find_port.sh,sha256=bGQ6LYSFVSsfDIGatrSg5YvddbZfaPL0R-Bjo4KYD6I,1088
|
|
4
|
-
vec_inf/launch_server.sh,sha256=WJ7HyOEbknxe7zjF388qgnTqoapl90cUrjsIJQChidc,4714
|
|
5
|
-
vec_inf/multinode_vllm.slurm,sha256=ymyteZWWspNDL0yBjhPNMZRd18Jepbw28HRw0EDuXYY,4201
|
|
6
|
-
vec_inf/vllm.slurm,sha256=64jg8t9FHp4IH5Jc_Vrk0XwSSIrpN4Xjwko6GO7cDXQ,1894
|
|
7
|
-
vec_inf/cli/__init__.py,sha256=5XIvGQCOnaGl73XMkwetjC-Ul3xuXGrWDXdYJ3aUzvU,27
|
|
8
|
-
vec_inf/cli/_cli.py,sha256=3LZ7RbJsQ3mxHWTtt-34uQNCZ7G9HaJifyfTQw33zuI,14330
|
|
9
|
-
vec_inf/cli/_utils.py,sha256=t_zFDEomSP9eDvad85GlJIFQ7Kl5ZXOxbgbkfMZ3DwA,4802
|
|
10
|
-
vec_inf/models/README.md,sha256=JpQCg5taBuQp4sLmasK7YPjFMZritOAKlfPpEJsOpeQ,16602
|
|
11
|
-
vec_inf/models/models.csv,sha256=xYrNykRu5HabsUjj4bdRI63YuGgCJSZ-ti_nIjuGPCY,11557
|
|
12
|
-
vec_inf-0.4.1.dist-info/METADATA,sha256=yFvkCgCVpYzuZZJmD22BlTYQeTMk8gD6gmYagyTUyog,7375
|
|
13
|
-
vec_inf-0.4.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
14
|
-
vec_inf-0.4.1.dist-info/entry_points.txt,sha256=uNRXjCuJSR2nveEqD3IeMznI9oVI9YLZh5a24cZg6B0,49
|
|
15
|
-
vec_inf-0.4.1.dist-info/licenses/LICENSE,sha256=mq8zeqpvVSF1EsxmydeXcokt8XnEIfSofYn66S2-cJI,1073
|
|
16
|
-
vec_inf-0.4.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|