https://github.com/bentoml/bentovllm
Self-host LLMs with vLLM and BentoML
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.5%) to scientific vocabulary
Keywords from Contributors
Repository
Self-host LLMs with vLLM and BentoML
Basic Info
Statistics
- Stars: 144
- Watchers: 8
- Forks: 17
- Open Issues: 3
- Releases: 0
Metadata Files
.github/README.md
Self-host LLMs with vLLM and BentoML
This repository contains a group of BentoML example projects, showing you how to serve and deploy open-source Large Language Models using vLLM, a high-throughput and memory-efficient inference engine. Every model directory contains the code to add OpenAI compatible endpoints to the BentoML Service.
💡 You can use these examples as bases for advanced code customization, such as custom model, inference logic or vLLM options. For simple LLM hosting with OpenAI compatible endpoints without writing any code, see OpenLLM.
See here for a full list of BentoML example projects.
The following is an example of serving one of the LLMs in this repository: Llama 3.1 8B Instruct.
Prerequisites
- If you want to test the Service locally, we recommend you use an Nvidia GPU with at least 16G VRAM.
- Gain access to the model in Hugging Face.
Install dependencies
```bash git clone https://github.com/bentoml/BentoVLLM.git cd BentoVLLM/llama3.1-8b-instruct
Recommend UV and Python 3.11
uv venv && uv pip install -r requirements.txt
export HF_TOKEN=
Run the BentoML Service
We have defined a BentoML Service in service.py. Run bentoml serve in your project directory to start the Service.
```bash $ bentoml serve .
2024-01-18T07:51:30+0800 [INFO] [cli] Starting production HTTP BentoServer from "service:VLLM" listening on http://localhost:3000 (Press CTRL+C to quit) INFO 01-18 07:51:40 modelrunner.py:501] Capturing the model for CUDA graphs. This may lead to unexpected consequences if the model is not static. To run the model in eager mode, set 'enforceeager=True' or use '--enforce-eager' in the CLI. INFO 01-18 07:51:40 modelrunner.py:505] CUDA graphs can take additional 1~3 GiB memory per GPU. If you are running out of memory, consider decreasing `gpumemoryutilization` or enforcing eager mode. INFO 01-18 07:51:46 modelrunner.py:547] Graph capturing finished in 6 secs. ```
The server is now active at http://localhost:3000. You can interact with it using the Swagger UI or in other different ways.
OpenAI-compatible endpoints
```python from openai import OpenAI
client = OpenAI(baseurl='http://localhost:3000/v1', apikey='na')
completion = client.chat.completions.create( model=client.models.list().data[0].id, messages=[ { "role": "user", "content": "Who are you? Please respond in pirate speak!" } ], stream=True, ) for chunk in completion: # Extract and print the content of the model's reply print(chunk.choices[0].delta.content or "", end="") ```
These OpenAI-compatible endpoints also support vLLM extra parameters. For example, you can force the chat completion output a JSON object by using the guided_json parameters:
```python from openai import OpenAI
client = OpenAI(baseurl='http://localhost:3000/v1', apikey='na')
json_schema = { "type": "object", "properties": { "city": {"type": "string"} } }
completion = client.chat.completions.create( model=client.models.list().data[0].id, messages=[ { "role": "user", "content": "What is the capital of France?" } ], extrabody=dict(guidedjson=json_schema), ) print(completion.choices[0].message.content) # will return something like: {"city": "Paris"} ```
All supported extra parameters are listed in vLLM documentation.
Note: If your Service is deployed with protected endpoints on BentoCloud, you need to set the environment variable OPENAI_API_KEY to your BentoCloud API key first.
bash
export OPENAI_API_KEY={YOUR_BENTOCLOUD_API_TOKEN}
You can then use the following line to replace the client in the above code snippet. Refer to Obtain the endpoint URL to retrieve the endpoint URL.
python
client = OpenAI(base_url='your_bentocloud_deployment_endpoint_url/v1')
For detailed explanations of the Service code, see vLLM inference.
Deploy to BentoCloud
After the Service is ready, you can deploy the application to BentoCloud for better management and scalability. Sign up if you haven't got a BentoCloud account.
Make sure you have logged in to BentoCloud.
bash
bentoml cloud login
Create a BentoCloud secret to store the required environment variable and reference it for deployment.
```bash bentoml secret create huggingface HFTOKEN=$HFTOKEN
bentoml deploy . --secret huggingface ```
Note: For custom deployment in your own infrastructure, use BentoML to generate an OCI-compliant image.
Featured models
In addition to Llama 3.1 8B Instruct, we also have examples for other models in the subdirectories of this repository:
| Model | Links | |-------|-------| | deepseek-prover-v2-671b | GitHub • Hugging Face | | deepseek-r1-671b | GitHub • Hugging Face | | deepseek-v3-671b | GitHub • Hugging Face | | devstral-small-2505 | GitHub • Hugging Face | | gemma3-4b-instruct | GitHub • Hugging Face | | gpt-oss-120b | GitHub • Hugging Face | | gpt-oss-20b | GitHub • Hugging Face | | jamba1.6-large | GitHub • Hugging Face | | jamba1.6-mini | GitHub • Hugging Face | | llama3.1-8b-instruct | GitHub • Hugging Face | | llama3.1-8b-kv-offloading | GitHub • Hugging Face | | llama3.2-3b-instruct | GitHub • Hugging Face | | llama3.3-70b-instruct | GitHub • Hugging Face | | llama4-17b-maverick-instruct | GitHub • Hugging Face | | llama4-17b-scout-instruct | GitHub • Hugging Face | | magistral-small-2506 | GitHub • Hugging Face | | mistral-small-3.1-24b-instruct-2503 | GitHub • Hugging Face | | phi4-14b | GitHub • Hugging Face | | phi4-14b-reasoning | GitHub • Hugging Face | | phi4-14b-reasoning-plus | GitHub • Hugging Face | | qwen3-235b-a22b | GitHub • Hugging Face | | qwen3-30b-a3b | GitHub • Hugging Face | | qwen3-8b | GitHub • Hugging Face | | qwen3-coder-480b-a35b | GitHub • Hugging Face | | r1-0528-qwen3-8b | GitHub • Hugging Face | | r1-distill-llama3.3-70b | GitHub • Hugging Face |
Owner
- Name: BentoML
- Login: bentoml
- Kind: organization
- Location: San Francisco
- Website: https://bentoml.com
- Twitter: bentomlai
- Repositories: 76
- Profile: https://github.com/bentoml
The most flexible way to serve AI models in production
GitHub Events
Total
- Issues event: 11
- Watch event: 63
- Delete event: 60
- Issue comment event: 37
- Push event: 294
- Pull request review comment event: 2
- Pull request review event: 15
- Pull request event: 119
- Fork event: 6
- Create event: 58
Last Year
- Issues event: 11
- Watch event: 63
- Delete event: 60
- Issue comment event: 37
- Push event: 294
- Pull request review comment event: 2
- Pull request review event: 15
- Pull request event: 119
- Fork event: 6
- Create event: 58
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Aaron Pham | c****t@a****z | 163 |
| Zhao Shenyang | d****v@z****m | 77 |
| Sherlock Xu | 6****3 | 15 |
| bojiang | b****_@o****m | 15 |
| Sean Sheng | s****g@g****m | 6 |
| Rick Zhou | r****u@g****m | 5 |
| xianxian.zhang | 1****l | 2 |
| Tianxin Dong | w****9@g****m | 1 |
| Frost Ming | m****g@g****m | 1 |
| Alex Liu | 8****1 | 1 |
| bojiang | b****b | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 13
- Total pull requests: 255
- Average time to close issues: 2 months
- Average time to close pull requests: 3 days
- Total issue authors: 10
- Total pull request authors: 13
- Average comments per issue: 1.38
- Average comments per pull request: 0.22
- Merged pull requests: 171
- Bot issues: 0
- Bot pull requests: 53
Past Year
- Issues: 5
- Pull requests: 149
- Average time to close issues: 11 days
- Average time to close pull requests: 1 day
- Issue authors: 3
- Pull request authors: 10
- Average comments per issue: 0.0
- Average comments per pull request: 0.32
- Merged pull requests: 78
- Bot issues: 0
- Bot pull requests: 52
Top Authors
Issue Authors
- aarnphm (2)
- ProVega (2)
- frei-x (2)
- EddyJens (1)
- Juhong-Namgung (1)
- OriAlpha (1)
- jackNhat (1)
- heartcored98 (1)
- Chasapas (1)
- FBR65 (1)
Pull Request Authors
- larme (108)
- dependabot[bot] (53)
- aarnphm (29)
- Sherlock113 (26)
- bojiang (13)
- rickzx (7)
- xianml (5)
- ssheng (3)
- frostming (3)
- FogDong (2)
- lycheel1 (2)
- ProVega (2)
- KunalParkhade (2)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- bentoml >=1.2.0rc1
- torch ==2.1.2
- transformers ==4.37.2
- vllm ==0.3.0