This repository provides an easy-to-use solution to run inference servers on Slurm-managed computing clusters using vLLM. This package runs natively on the Vector Institute cluster environments. To adapt to other environments, follow the instructions in Installation.
NOTE: Supported models on Killarney are tracked here
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:
pip install vec-inf
Otherwise, we recommend using the provided Dockerfile
to set up your own environment with the package. The latest image has vLLM
version 0.10.1.1
.
If you'd like to use vec-inf
on your own Slurm cluster, you would need to update the configuration files, there are 3 ways to do it:
- Clone the repository and update the
environment.yaml
and themodels.yaml
file invec_inf/config
, then install from source by runningpip install .
. - The package would try to look for cached configuration files in your environment before using the default configuration. The default cached configuration directory path points to
/model-weights/vec-inf-shared
, you would need to create anenvironment.yaml
and amodels.yaml
following the format of these files invec_inf/config
. - The package would also look for an enviroment variable
VEC_INF_CONFIG_DIR
. You can put yourenvironment.yaml
andmodels.yaml
in a directory of your choice and set the enviroment variableVEC_INF_CONFIG_DIR
to point to that location.
Vector Inference provides 2 user interfaces, a CLI and an API
The launch
command allows users to deploy a model as a slurm job. If the job successfully launches, a URL endpoint is exposed for the user to send requests for inference.
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:
vec-inf launch Meta-Llama-3.1-8B-Instruct
You should see an output like the following:

NOTE: On Vector Killarney Cluster environment, the following fields are required:
--account
,-A
: The Slurm account, this argument can be set to default by setting environment variableVEC_INF_ACCOUNT
.--work-dir
,-D
: A working directory other than your home directory, this argument can be set to default by seeting environment variableVEC_INF_WORK_DIR
.
Models that are already supported by vec-inf
would be launched using the cached configuration (set in slurm_vars.py) or default configuration. You can override these values by providing additional parameters. Use vec-inf launch --help
to see the full list of parameters that can be overriden. You can also launch your own custom model as long as the model architecture is supported by vLLM. For detailed instructions on how to customize your model launch, check out the launch
command section in User Guide
batch-launch
: Launch multiple model inference servers at once, currently ONLY single node models supported,status
: Check the model status by providing its Slurm job ID.metrics
: Streams performance metrics to the console.shutdown
: Shutdown a model by providing its Slurm job ID.list
: List all available model names, or view the default/cached configuration of a specific model.cleanup
: Remove old log directories, use--help
to see the supported filters. Use--dry-run
to preview what would be deleted.
For more details on the usage of these commands, refer to the User Guide
Example:
>>> from vec_inf.api import VecInfClient
>>> client = VecInfClient()
>>> # Assume VEC_INF_ACCOUNT and VEC_INF_WORK_DIR is set
>>> response = client.launch_model("Meta-Llama-3.1-8B-Instruct")
>>> job_id = response.slurm_job_id
>>> status = client.get_status(job_id)
>>> if status.status == ModelStatus.READY:
... print(f"Model is ready at {status.base_url}")
>>> client.shutdown_model(job_id)
For details on the usage of the API, refer to the API Reference
With every model launch, a Slurm script will be generated dynamically based on the job and model configuration. Once the Slurm job is queued, the generated Slurm script will be moved to the log directory for reproducibility, located at $log_dir/$model_family/$model_name.$slurm_job_id/$model_name.$slurm_job_id.slurm
. In the same directory you can also find a JSON file with the same name that captures the launch configuration, and will have an entry of server URL once the server is ready.
Once the inference server is ready, you can start sending in inference requests. We provide example scripts for sending inference requests in 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/chat_completions.py
, and you should expect to see an output like the following:
{
"id":"chatcmpl-387c2579231948ffaf66cdda5439d3dc",
"choices": [
{
"finish_reason":"stop",
"index":0,
"logprobs":null,
"message": {
"content":"Arrr, I be Captain Chatbeard, the scurviest chatbot on the seven seas! Ye be wantin' to know me identity, eh? Well, matey, I be a swashbucklin' AI, here to provide ye with answers and swappin' tales, savvy?",
"role":"assistant",
"function_call":null,
"tool_calls":[],
"reasoning_content":null
},
"stop_reason":null
}
],
"created":1742496683,
"model":"Meta-Llama-3.1-8B-Instruct",
"object":"chat.completion",
"system_fingerprint":null,
"usage": {
"completion_tokens":66,
"prompt_tokens":32,
"total_tokens":98,
"prompt_tokens_details":null
},
"prompt_logprobs":null
}
NOTE: Certain models don't adhere to OpenAI's chat template, e.g. Mistral family. For these models, you can either change your prompt to follow the model's default chat template or provide your own chat template via --chat-template: TEMPLATE_PATH
.
If you want to run inference from your local device, you can open a SSH tunnel to your cluster environment like the following:
ssh -L 8081:172.17.8.29:8081 username@v.vectorinstitute.ai -N
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