You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-23Lines changed: 14 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# Vector Inference: Easy inference on Slurm clusters
2
-
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, and can be easily adapted to other environments.
2
+
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 the config files in the `models` folder and the environment variables in the model launching scripts accordingly.
3
3
4
4
## Installation
5
-
If you are using the Vector cluster environment, and you don't need any customization to the inference server environment, all you need to do is run `pip install vllm-nccl-cu12` and go to the next section. Otherwise, you might need up to 10GB of storage to setup your own virtual environment. The following steps needs to be run only once for each user.
5
+
If you are using the Vector cluster environment, and you don't need any customization to the inference server environment, you can go to the next section as we have a default container environment in place. Otherwise, you might need up to 10GB of storage to setup your own virtual environment. The following steps needs to be run only once for each user.
6
6
7
7
1. Setup the virtual environment for running inference servers, run
8
8
```bash
@@ -29,7 +29,7 @@ pip install vllm-flash-attn
29
29
## Launch an inference server
30
30
We will use the Llama 3 model as example, to launch an inference server for Llama 3 8B, run
31
31
```bash
32
-
bash models/llama3/launch_server.sh
32
+
bash src/launch_server.sh --model-family llama3
33
33
```
34
34
You should see an output like the following:
35
35
> Job Name: vLLM/Meta-Llama-3-8B
@@ -44,35 +44,26 @@ You should see an output like the following:
44
44
45
45
If you want to use your own virtual environment, you can run this instead:
46
46
```bash
47
-
bash models/llama3/launch_server.sh -e$(poetry env info --path)
47
+
bash src/launch_server.sh --model-family llama3 --venv$(poetry env info --path)
48
48
```
49
-
By default, the `launch_server.sh` script in Llama 3 folder uses the 8B variant, you can switch to other variants with the `-v` flag, and make sure to change the requested resource accordingly. More information about the flags and customizations can be found in the [`models`](models) folder. The inference server is compatible with the OpenAI `Completion` and `ChatCompletion` API. You can inspect the Slurm output files to check the inference server status.
49
+
By default, the `launch_server.sh` script is set to use the 8B variant for Llama 3 based on the config file in `models/llama3` folder, you can switch to other variants with the `--model-variant` argument, and make sure to change the requested resource accordingly. More information about the flags and customizations can be found in the [`models`](models) folder. The inference server is compatible with the OpenAI `Completion` and `ChatCompletion` API. You can inspect the Slurm output files to check the inference server status.
50
50
51
51
Here is a more complicated example that launches a model variant using multiple nodes, say we want to launch Mixtral 8x22B, run
The default partition for Mixtral models is a40, and we need 8 a40 GPUs to load Mixtral 8x22B, so we requested 2 a40 nodes with 4 GPUs per node. You should see an output like the following:
56
-
> Number of nodes set to: 2
57
-
>
58
-
> Number of GPUs set to: 4
59
-
>
60
-
> Model variant set to: 8x22B-v0.1
61
-
>
62
-
> Job Name: vLLM/Mixtral-8x22B-v0.1
63
-
>
64
-
> Partition: a40
65
-
>
66
-
> Generic Resource Scheduling: gpu:8
67
-
>
68
-
> Data Type: auto
69
-
>
70
-
> Submitted batch job 12430232
71
60
72
61
## Send inference requests
73
-
Once the inference server is ready, you can start sending in inference requests. We provide example [Python](examples/inference.py) and [Bash](examples/inference.sh)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. You can run either `python examples/inference.py` or `bash examples/inference.sh`, and you should expect to see an output like the following:
62
+
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:
74
63
> {"id":"cmpl-bdf43763adf242588af07af88b070b62","object":"text_completion","created":2983960,"model":"/model-weights/Llama-2-7b-hf","choices":[{"index":0,"text":"\nCanada is close to the actual continent of North America. Aside from the Arctic islands","logprobs":null,"finish_reason":"length"}],"usage":{"prompt_tokens":8,"total_tokens":28,"completion_tokens":20}}
75
64
65
+
**NOTE**: For multimodal models, currently only `ChatCompletion` is available, and only one image can be provided for each prompt.
66
+
76
67
## SSH tunnel from your local device
77
68
If you want to run inference from your local device, you can open a SSH tunnel to your cluster environment like the following:
`inference.py`: Python example of sending inference requests to inference server using OpenAI API, make sure to install OpenAI API in your environment.
3
-
4
-
`inference.sh`: Bash example of sending inference requests to inference server, supports JSON mode
5
-
6
-
`logits.py`: Python example of getting logits from hosted model.
2
+
-[`inference`](inference): Examples for sending inference requests
3
+
-[`llm/chat_completions.py`](inference/llm/chat_completions.py): Python example of sending chat completion requests to OpenAI compatible server
4
+
-[`llm/completions.py`](inference/llm/completions.py): Python example of sending completion requests to OpenAI compatible server
5
+
-[`llm/completions.sh`](inference/llm/completions.sh): Bash example of sending completion requests to OpenAI compatible server, supports JSON mode
6
+
-[`vlm/vision_completions.py`](inference/vlm/vision_completions.py): Python example of sending chat completion requests with image attached to prompt to OpenAI compatible server for vision language models
7
+
-[`logits`](logits): Example for logits generation
8
+
-[`logits.py`](logits/logits.py): Python example of getting logits from hosted model.
0 commit comments