Quick: Deploy with vLLM

In this tutorial, we will deploy a vLLM endpoint in a few easy steps. vLLM has become one of the leading libraries for LLM-serving and inference, supporting many architectures and models that use them.

Model Weights

vLLM depends on the model weights being fetched from Hugging Face.

In this tutorial we are loading deepseek-ai/deepseek-llm-7b-chat model from Hugging Face.

You will also require the User Access Token in order to fetch the weights. You can obtain the Access Token in your Hugging Face account by clicking the Profile icon (top right corner) and selecting Access Tokens.

For deploying the vLLM endpoint, the READ permissions are sufficient.

Hugging Face Access Tokens panel

Create the Deployment

In this tutorial, we will deploy deepseek-ai/deepseek-llm-7b-chat on a General Compute (24 GB VRAM) GPU type. For larger models, you may need to choose one of the other GPU types we offer.

  1. Log in to the DataCrunch cloud dashboard, and go to Containers -> New deployment. Name your deployment and select the Compute Type.

  2. We will be using the official vLLM Docker container, set Container Image to docker.io/vllm/vllm-openai

  3. Toggle on the Public location for your image

  4. Select the Tag to deploy

  5. Set the Exposed HTTP port to 8000

  6. Set the Healthcheck port to 8000

  7. Set the Healthcheck path to /health

  8. Toggle Start Command on

  9. Add the following parameters to CMD: --model deepseek-ai/deepseek-llm-7b-chat --gpu-memory-utilization 0.9

  10. Add your Hugging Face User Access Token to the Environment Variables as HF_TOKEN

  11. Deploy container

(You can leave the Scaling options to their default values.)

That's it you should now have a running deployment!

Connect to the Endpoint

Before you can connect to the endpoint, you will need to generate an authentication token, by going to Keys -> Inference API Keys, and click Create.

The base endpoint URL for your deployment is in the Containers API section in the top left of the screen.

Test Request

Below is an example cURL command for running your test request:

Notice the added subpath /v1/chat/completions to the base endpoint URL

curl -X POST <YOUR_CONTAINERS_API_URL>/v1/chat/completions \
--header 'Authorization: Bearer <YOUR_INFERENCE_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
        "model": "deepseek-ai/deepseek-llm-7b-chat",
        "messages": [
          { "role": "system", "content": "You are a helpful writer assistant." },
          { "role": "user", "content": "What is deep learning?" }
        ],
        "stream": false
    }'

Example Response

You should see a response that looks like this:

{
   "id": "chatcmpl-97e62d475c0f42d390d5a816a3219793",
   "object": "chat.completion",
   "created": 1739436716,
   "model": "deepseek-ai/deepseek-llm-7b-chat",
   "choices": [
      {
         "index": 0,
         "message": {
            "role": "assistant",
            "reasoning_content": null,
            "content": "Deep learning is a subset of machine learning that uses artificial neural networks with multiple layers toLearn about the input data itself. This is called a deep neural network. Deep learning has made significant progress in the field of artificial intelligence, especially in image and speech recognition, natural language processing, and other areas. The most widely used frameworks for deep learning are TensorFlow and Keras. In deep learning, a deep neural network is trained on large amounts of data through a supervised or unsupervised learning process.",
            "tool_calls": [
               
            ]
         },
         "logprobs": null,
         "finish_reason": "stop",
         "stop_reason": null
      }
   ],
   "usage":{
      "prompt_tokens": 21,
      "total_tokens": 120,
      "completion_tokens": 99,
      "prompt_tokens_details": null
   },
   "prompt_logprobs": null
}

Last updated

Was this helpful?