|
| 1 | +# VLLM OpenVINO |
| 2 | + |
| 3 | +## Requirements |
| 4 | + |
| 5 | +### Validated Hardware Requirements |
| 6 | +- **CPU:** 13th generation Intel Core processors or newer |
| 7 | +- **GPU:** Intel® Arc™ graphics |
| 8 | +- **RAM:** 32GB (may vary based on model size) |
| 9 | +- **Disk:** 128GB (may vary based on model size) |
| 10 | + |
| 11 | +## Quick Start |
| 12 | + |
| 13 | +### 1. Install Operating System |
| 14 | +Install the latest [Ubuntu 22.04 LTS Desktop](https://releases.ubuntu.com/jammy/). Refer to the [Ubuntu Desktop installation tutorial](https://ubuntu.com/tutorials/install-ubuntu-desktop#1-overview) if needed. |
| 15 | + |
| 16 | +### 2. Install GPU Driver (Optional) |
| 17 | +If you plan to use a GPU for inference, install the appropriate GPU driver: |
| 18 | +- **Intel® Arc™ A-Series Graphics:** [Installation Guide](https://github.com/intel/edge-developer-kit-reference-scripts/tree/main/gpu/arc/dg2) |
| 19 | +- **Intel® Data Center GPU Flex Series:** [Installation Guide](https://github.com/intel/edge-developer-kit-reference-scripts/tree/main/gpu/flex/ats) |
| 20 | + |
| 21 | +### 3. Set Up Docker |
| 22 | +Follow the instructions [here](https://docs.docker.com/engine/install/) to install Docker and Docker Compose. |
| 23 | + |
| 24 | +### 4. Build the OpenVINO VLLM Docker Image |
| 25 | +```bash |
| 26 | +docker build -t ov-vllm . |
| 27 | +``` |
| 28 | + |
| 29 | +### 5. Run the OpenVINO VLLM container |
| 30 | +By default, on the container launch, it |
| 31 | +* **CPU** |
| 32 | +```bash |
| 33 | +docker run -it --rm \ |
| 34 | + -p 8000:8000 \ |
| 35 | + -e DEFAULT_MODEL_ID=Qwen/Qwen2.5-7B-Instruct \ |
| 36 | + -e MODEL_PRECISION=int4 \ |
| 37 | + -e SERVED_MODEL_NAME=ov-vllm \ |
| 38 | + -e MAX_MODEL_LEN=2048 \ |
| 39 | + -e VLLM_OPENVINO_DEVICE=CPU \ |
| 40 | + -e VLLM_OPENVINO_KVCACHE_SPACE=8 \ |
| 41 | + -e VLLM_OPENVINO_CPU_KV_CACHE_PRECISION=u8 \ |
| 42 | + -e VLLM_OPENVINO_ENABLE_QUANTIZED_WEIGHTS=ON \ |
| 43 | + -v ./data:/usr/src/app/data \ |
| 44 | + ov-vllm |
| 45 | +``` |
| 46 | + |
| 47 | +* **GPU** |
| 48 | +```bash |
| 49 | +RENDER_GROUP_ID=$(getent group render | cut -d: -f3) |
| 50 | +docker run -it --rm \ |
| 51 | + --group-add $RENDER_GROUP_ID \ |
| 52 | + --device /dev/dri:/dev/dri \ |
| 53 | + -p 8000:8000 \ |
| 54 | + -e DEFAULT_MODEL_ID=Qwen/Qwen2.5-7B-Instruct \ |
| 55 | + -e MODEL_PRECISION=int4 \ |
| 56 | + -e SERVED_MODEL_NAME=ov-vllm \ |
| 57 | + -e MAX_MODEL_LEN=2048 \ |
| 58 | + -e GPU_MEMORY_UTILIZATION=0.9 \ |
| 59 | + -e VLLM_OPENVINO_DEVICE=GPU \ |
| 60 | + -e VLLM_OPENVINO_KVCACHE_SPACE=8 \ |
| 61 | + -e VLLM_OPENVINO_CPU_KV_CACHE_PRECISION=u8 \ |
| 62 | + -e VLLM_OPENVINO_ENABLE_QUANTIZED_WEIGHTS=ON \ |
| 63 | + -v ./data:/usr/src/app/data \ |
| 64 | + ov-vllm |
| 65 | +``` |
| 66 | + |
| 67 | +### 6. Test the OpenVINO VLLM with chat completion API |
| 68 | +```bash |
| 69 | +curl "http://localhost:8000/v1/chat/completions" \ |
| 70 | + -H "Content-Type: application/json" \ |
| 71 | + -d '{ |
| 72 | + "model": "ov-vllm", |
| 73 | + "messages": [ |
| 74 | + { |
| 75 | + "role": "system", |
| 76 | + "content": "You are a helpful assistant." |
| 77 | + }, |
| 78 | + { |
| 79 | + "role": "user", |
| 80 | + "content": "What is AI?" |
| 81 | + } |
| 82 | + ], |
| 83 | + "stream": true |
| 84 | + }' |
| 85 | +``` |
| 86 | + |
| 87 | + |
| 88 | +## FAQs |
| 89 | +### 1. How can I replace or use my own model? |
| 90 | +1. Convert the model into OpenVINO format. Refer to this [link](https://docs.openvino.ai/2024/learn-openvino/llm_inference_guide/genai-model-preparation.html) for more information. |
| 91 | +2. After the model convertion steps, place the model in the following following file structures. |
| 92 | +```bash |
| 93 | +. |
| 94 | +├── data |
| 95 | +│ └── ov_model |
| 96 | +│ ├── added_tokens.json |
| 97 | +│ ├── config.json |
| 98 | +│ ├── generation_config.json |
| 99 | +│ ├── merges.txt |
| 100 | +│ ├── openvino_model.bin |
| 101 | +│ ├── openvino_model.xml |
| 102 | +│ ├── special_tokens_map.json |
| 103 | +│ ├── tokenizer_config.json |
| 104 | +│ ├── tokenizer.json |
| 105 | +│ └── vocab.json |
| 106 | +├── Dockerfile |
| 107 | +├── entrypoint.sh |
| 108 | +└── README.md |
| 109 | +``` |
| 110 | + |
| 111 | +### 2. How can I change the default model after it has been run once? |
| 112 | +1. Delete the existing model located in `./data/ov_model`. |
| 113 | +```bash |
| 114 | +rm -rf ./data/ov_model |
| 115 | +``` |
| 116 | +2. Rerun the `docker run` command to load and quantize the new model. |
| 117 | + |
| 118 | +### 3. How can I avoid redownload the model everytime to convert and quantize the model? |
| 119 | +1. Mount the huggingface cache path into the container |
| 120 | +```bash |
| 121 | +-v $HOME/.cache/huggingface:/home/intel/.cache/huggingface |
| 122 | +``` |
0 commit comments