Skip to content

Commit c922656

Browse files
Merge pull request #3415 from anupras-mohapatra-arm/fixes
Refactoring vLLM LP and tweaking LP structure skill
2 parents fe66909 + 0eeb959 commit c922656

5 files changed

Lines changed: 64 additions & 46 deletions

File tree

.github/skills/learning-path-structure-review/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Use this skill when a Learning Path needs a structural review. Focus on whether
2929
- Prefer direct relevance, Arm Learning Paths, required tools, foundation knowledge, and logical next steps.
3030
- Avoid link piles that pull readers away from the task.
3131
6. Review recap and transition sections:
32-
- Include concise recap and forward-looking transition at major instructional boundaries.
32+
- Include concise recap and forward-looking transition at major instructional boundaries. Do not treat a transition sentence alone as a recap. Note the absence of a transition as a finding.
3333
- Use `what you've learned` for conceptual sections and `what you've accomplished` for task sections.
3434
- Avoid repeating earlier content verbatim.
3535
7. If the Learning Path demonstrates Arm-specific performance features, apply the performance integrity checks.

content/learning-paths/servers-and-cloud-computing/vllm/_index.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
---
2-
title: Build and Run vLLM on Arm Servers
2+
title: Build and run vLLM on Arm servers
3+
description: Build vLLM from source on an Arm Linux server, run batch inference with a Hugging Face model, and expose the model through an OpenAI-compatible API.
34

45
minutes_to_complete: 45
56

67
who_is_this_for: This is an introductory topic for software developers and AI engineers interested in learning how to use the vLLM library on Arm servers.
78

89
learning_objectives:
910
- Build vLLM from source on an Arm server.
10-
- Download a Qwen LLM from Hugging Face.
11+
- Use a Qwen LLM from Hugging Face.
1112
- Run local batch inference using vLLM.
1213
- Create and interact with an OpenAI-compatible server provided by vLLM on your Arm server.
1314

1415
prerequisites:
15-
- An [Arm-based instance](/learning-paths/servers-and-cloud-computing/csp/) from a cloud service provider, or a local Arm Linux computer with at least 8 CPUs and 16 GB RAM.
16+
- An [Arm-based Linux instance](/learning-paths/servers-and-cloud-computing/csp/) from a cloud service provider, or a local Arm Linux computer running Ubuntu 24.04 with at least 8 CPUs, 16 GB RAM, and 50 GB of disk storage.
17+
- A system that includes support for BFloat16.
1618

1719
author: Jason Andrews
1820

@@ -59,4 +61,3 @@ weight: 1 # _index.md always has weight of 1 to order corr
5961
layout: "learningpathall" # All files under learning paths have this same wrapper
6062
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content.
6163
---
62-

content/learning-paths/servers-and-cloud-computing/vllm/vllm-run.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Run batch inference using vLLM
3+
description: Use vLLM to load a Qwen model from Hugging Face and run batch inference prompts on an Arm server.
34
weight: 3
45

56
### FIXED, DO NOT MODIFY
@@ -8,27 +9,27 @@ layout: learningpathall
89

910
## Use a model from Hugging Face
1011

11-
vLLM is designed to work seamlessly with models from the Hugging Face Hub.
12+
vLLM is designed to work with models from the Hugging Face Hub.
1213

13-
The first time you run vLLM, it downloads the required model. This means that you do not have to explicitly download any models.
14+
The first time you run vLLM, it downloads the required model. You don't have to explicitly download any models.
1415

15-
If you want to use a model that requires you to request access or accept the terms, you need to log in to Hugging Face using a token.
16+
To use a model that requires you to request access or accept terms and conditions, log in to Hugging Face using a token:
1617

1718
```bash
1819
huggingface-cli login
1920
```
2021

2122
Enter your Hugging Face token. You can generate a token from [Hugging Face Hub](https://huggingface.co/) by clicking your profile on the top right corner and selecting **Access Tokens**.
2223

23-
You also need to visit the Hugging Face link printed in the login output and accept the terms by clicking the **Agree and access repository** button or filling out the request-for-access form, depending on the model.
24+
Visit the Hugging Face link printed in the login output and accept the terms and conditions. Click the **Agree and access repository** button or fill out the request-for-access form, depending on the model.
2425

25-
To run batched inference without the need for a login, you can use the `Qwen/Qwen2.5-0.5B-Instruct` model.
26+
To run batched inference without logging in, use the `Qwen/Qwen2.5-0.5B-Instruct` model.
2627

2728
## Create a batch script
2829

29-
To run inference with multiple prompts, you can create a simple Python script to load a model and run the prompts.
30+
To run inference with multiple prompts, create a Python script to load a model and run the prompts.
3031

31-
Use a text editor to save the Python script below in a file called `batch.py`:
32+
Use a text editor to save the following Python script in a file called `batch.py`:
3233

3334
```python
3435
import json
@@ -137,4 +138,10 @@ Processed prompts: 100%|██████████████████
137138
}
138139
```
139140

140-
You can try with other prompts and models such as `meta-llama/Llama-3.2-1B`. Continue to learn how to set up an OpenAI-compatible server.
141+
## What you've accomplished and what's next
142+
143+
You've now created a Python batch inference script that loads the `Qwen/Qwen2.5-0.5B-Instruct` model from Hugging Face, configures `bfloat16` precision, and sends multiple prompts to vLLM.
144+
145+
You ran the script and confirmed that vLLM starts on the CPU backend, loads the model, processes the prompts, and returns generated text.
146+
147+
Next, you'll set up an OpenAI-compatible server so client applications can send requests to vLLM.

content/learning-paths/servers-and-cloud-computing/vllm/vllm-server.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
---
2-
title: Run an OpenAI-compatible server
2+
title: Run an OpenAI-compatible vLLM server
3+
description: Start a local vLLM OpenAI-compatible server on Arm Linux and send a chat completion request with curl.
34
weight: 4
45

56
### FIXED, DO NOT MODIFY
67
layout: learningpathall
78
---
89

9-
Instead of a batch run from Python, you can create an OpenAI-compatible server. This allows you to leverage the power of Large Language Models without relying on external APIs.
10+
## Create a local vLLM server compatible with OpenAI
11+
12+
To run Large Language Models (LLMs) without relying on external APIs, create an OpenAI-compatible server.
1013

1114
Running a local LLM offers several advantages:
1215

13-
* Cost-effective - it avoids the costs associated with using external APIs, especially for high-usage scenarios.
16+
* Cost-effectiveness - it avoids the costs associated with using external APIs, especially for high-usage scenarios.
1417
* Privacy - it keeps your data and prompts within your local environment, which enhances privacy and security.
15-
* Offline Capability - it enables operation without an internet connection, making it ideal for scenarios with limited or unreliable network access.
18+
* Offline capability - it enables operation without an internet connection, making it ideal for scenarios with limited or unreliable network access.
1619

17-
OpenAI compatibility means that you can reuse existing software which was designed to communicate with OpenAI and use it to communicate with your local vLLM service.
20+
OpenAI compatibility means that you can reuse existing software to communicate with your local vLLM service.
1821

1922
Run vLLM with the same `Qwen/Qwen2.5-0.5B-Instruct` model:
2023

2124
```bash
2225
python3 -m vllm.entrypoints.openai.api_server --model Qwen/Qwen2.5-0.5B-Instruct --dtype float16 --max-num-batched-tokens 32768
2326
```
2427

25-
The server output displays that it is ready for requests:
28+
The output is similar to:
2629

2730
```output
2831
INFO 12-12 22:54:40 cpu_executor.py:186] # CPU blocks: 21845
@@ -51,7 +54,7 @@ INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
5154

5255
You can submit requests to the server using the `curl` command.
5356

54-
For example, run the command below using another terminal on the same server:
57+
For example, run the following command using another terminal on the same server:
5558

5659
```bash
5760
curl http://0.0.0.0:8000/v1/chat/completions \
@@ -72,12 +75,16 @@ curl http://0.0.0.0:8000/v1/chat/completions \
7275
}'
7376
```
7477

75-
The server processes the request, and the output prints the results:
78+
The server processes the request, and the output is similar to:
7679

7780
```output
7881
"id":"chatcmpl-6677cb4263b34d18b436b9cb8c6a5a65","object":"chat.completion","created":1734044182,"model":"Qwen/Qwen2.5-0.5B-Instruct","choices":[{"index":0,"message":{"role":"assistant","content":"Certainly! Here is a simple \"Hello, World!\" program in C:\n\n```c\n#include <stdio.h>\n\nint main() {\n printf(\"Hello, World!\\n\");\n return 0;\n}\n```\n\nThis program defines a function called `main` which contains the body of the program. Inside the `main` function, it calls the `printf` function to display the text \"Hello, World!\" to the console. The `return 0` statement indicates that the program was successful and the program has ended.\n\nTo compile and run this program:\n\n1. Save the code above to a file named `hello.c`.\n2. Open a terminal or command prompt.\n3. Navigate to the directory where you saved the file.\n4. Compile the program using the following command:\n ```\n gcc hello.c -o hello\n ```\n5. Run the compiled program using the following command:\n ```\n ./hello\n ```\n Or simply type `hello` in the terminal.\n\nYou should see the output:\n\n```\nHello, World!\n```","tool_calls":[]},"logprobs":null,"finish_reason":"stop","stop_reason":null}],"usage":{"prompt_tokens":26,"total_tokens":241,"completion_tokens":215,"prompt_tokens_details":null},"prompt_logprobs":null}
7982
```
8083

81-
There are many other experiments you can try. Most Hugging Face models have a **Use this model** button on the top-right of the model card with the instructions for vLLM. You can now use these instructions on your Arm Linux computer.
84+
## What you've accomplished
85+
86+
You've now set up a local OpenAI-compatible server and tested sending requests to the server.
87+
88+
You can use the instructions in this Learning Path to experiment with other models on your Arm Linux computer. Most Hugging Face models include a **Use this model** button with instructions for vLLM.
8289

8390
You can also try out OpenAI-compatible chat clients to connect to the served model.
Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: Build a vLLM from Source Code
2+
title: Build a vLLM from source code on Arm Linux
3+
description: Prepare an Arm Ubuntu server for vLLM by checking BFloat16 support, installing dependencies, and building the CPU backend from source.
34
weight: 2
45

56
### FIXED, DO NOT MODIFY
@@ -8,35 +9,33 @@ layout: learningpathall
89

910
## Before you begin
1011

11-
To follow the instructions for this Learning Path, you will need an Arm server running Ubuntu 24.04 LTS with at least 8 cores, 16GB of RAM, and 50GB of disk storage. You also need a system which supports BFloat16.
12+
[Virtual Large Language Model (vLLM)](https://github.com/vllm-project/vllm) is a fast and easy-to-use library for inference and model serving.
1213

13-
To check if your system includes BFloat16, use the `lscpu` command:
14+
You can use vLLM in batch mode, or by running an OpenAI-compatible server.
15+
16+
In this Learning Path, you'll learn how to build vLLM from source and run inference on an Arm-based server.
17+
18+
Start by checking if your system includes BFloat16 using the `lscpu` command:
1419

1520
```console
1621
lscpu | grep bf16
1722
```
1823

19-
If the `Flags` are printed, you have a processor with BFloat16.
24+
If you have a processor with BFloat16, the output is similar to:
2025

2126
```output
2227
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
2328
```
2429

25-
If the result is blank, you do not have a processor with BFloat16.
30+
If the output is blank, you don't have a processor with BFloat16.
2631

27-
BFloat16 provides improved performance and smaller memory footprint with the same dynamic range. You might experience a drop in model inference accuracy with BFloat16, but the impact is acceptable for the majority of applications.
32+
BFloat16 provides improved performance and smaller memory footprint with the same dynamic range. You might experience a drop in model inference accuracy with BFloat16, but the tradeoff is acceptable for the majority of applications.
2833

29-
The instructions have been tested on an AWS Graviton3 `m7g.2xlarge` instance.
34+
The instructions in this Learning Path have been tested on an AWS Graviton3 `m7g.2xlarge` instance.
3035

31-
## What is vLLM?
36+
## Install dependencies to build vLLM
3237

33-
[vLLM](https://github.com/vllm-project/vllm) stands for Virtual Large Language Model, and is a fast and easy-to-use library for inference and model serving.
34-
35-
You can use vLLM in batch mode, or by running an OpenAI-compatible server.
36-
37-
In this Learning Path, you will learn how to build vLLM from source and run inference on an Arm-based server, highlighting its effectiveness.
38-
39-
### What software do I need to install to build vLLM?
38+
After validating that your system supports BFloat16, install vLLM dependencies.
4039

4140
First, ensure your system is up-to-date and install the required tools and libraries:
4241

@@ -45,16 +44,16 @@ sudo apt-get update -y
4544
sudo apt-get install -y curl ccache git wget vim numactl gcc g++ python3 python3-pip python3-venv python-is-python3 libtcmalloc-minimal4 libnuma-dev ffmpeg libsm6 libxext6 libgl1 libssl-dev pkg-config
4645
```
4746

48-
Next, install Rust. For more information, see the [Rust install guide](/install-guides/rust/).
47+
Next, install Rust. For installation steps, see the [Rust install guide](/install-guides/rust/).
4948

5049
```bash
5150
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
5251
source "$HOME/.cargo/env"
5352
```
5453

55-
Four environment variables are required. You can enter these at the command line or add them to your `$HOME/.bashrc` file and source the file.
54+
Next, set up required environment variables. You can either enter the variables at the command line or add them to your `$HOME/.bashrc` file and source the file.
5655

57-
To add them at the command line, use the following:
56+
To add the environment variables at the command line, run:
5857

5958
```bash
6059
export CCACHE_DIR=/home/ubuntu/.cache/ccache
@@ -72,14 +71,14 @@ source env/bin/activate
7271

7372
Your command-line prompt is prefixed by `(env)`, which indicates that you are in the Python virtual environment.
7473

75-
Now update Pip and install Python packages:
74+
Now update `pip` and install Python packages:
7675

7776
```bash
7877
pip install --upgrade pip
7978
pip install py-cpuinfo
8079
```
8180

82-
### How do I download vLLM and build it?
81+
## Download and build vLLM
8382

8483
First, clone the vLLM repository from GitHub:
8584

@@ -90,9 +89,9 @@ git checkout releases/v0.11.0
9089
```
9190

9291
{{% notice Note %}}
93-
The Git checkout specifies a specific hash known to work for this example.
92+
The Git checkout specifies a version known to work for this example.
9493

95-
Omit this command to use the latest code on the main branch.
94+
Omit this checkout command to use the latest code on the main branch.
9695
{{% /notice %}}
9796

9897
Install the Python packages for vLLM:
@@ -102,7 +101,7 @@ pip install -r requirements/build.txt
102101
pip install -v -r requirements/cpu.txt
103102
```
104103

105-
Build vLLM using Pip:
104+
Build vLLM using `pip`:
106105

107106
```bash
108107
VLLM_TARGET_DEVICE=cpu python3 setup.py bdist_wheel
@@ -116,4 +115,8 @@ rm -rf dist
116115
cd ..
117116
```
118117

119-
You are now ready to download a large language model (LLM) and run vLLM.
118+
## What you've accomplished and what's next
119+
120+
You've now verified BFloat16 support, installed the build dependencies, configured the required environment variables, and built vLLM from source for the CPU backend.
121+
122+
Next, you'll use vLLM with a Hugging Face model to run batch inference on your Arm server.

0 commit comments

Comments
 (0)