How do i get vLLM RUnning on my M2 Macs GPU instead of the CPU ?
- User
How do i get vLLM RUnning on my M2 Macs GPU instead of the CPU ?
Assistant
To run vLLM on your M2 Mac's GPU instead of the CPU, you'll need to follow these steps:
-
Install vLLM from source, as there are no pre-built wheels for Apple Silicon[3][5].
-
Ensure you have Xcode and Command Line Tools installed[5].
-
Clone the vLLM repository and install the CPU requirements:
git clone https://github.com/vllm-project/vllm.git cd vllm pip install -r requirements/cpu.txt- Install vLLM with the following command:
pip install -e .-
Install PyTorch with MPS (Metal Performance Shaders) support, which allows PyTorch to use the GPU on Apple Silicon[5].
-
When initializing the LLM, specify the device as 'mps':
from vllm import LLM llm = LLM(model="your_model_name", device='mps')It's important to note that while this setup will utilize the GPU on your M2 Mac, vLLM's performance may not be fully optimized for Apple Silicon[1][5]. The CPU implementation for macOS currently supports FP32 and FP16 datatypes[3].
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.