Compare commits

...
196 Commits
Author SHA1 Message Date
Marut PandyaandGitHub 7aa17463d3 Merge pull request #200 from runpod-workers/release/0.10.0
chore(release): 0.10.0
2025-08-11 15:33:51 -07:00
Marut PandyaandGitHub 72a643dd0c Merge pull request #207 from JhennerTigreros/main
Update requirements and engine creation to support new 0.10.0 vLLM version
2025-08-09 09:08:19 -07:00
Marut PandyaandGitHub 15f569f970 Merge pull request #208 from runpod-workers/revert-202-feat/proper-deployment
[Revert]"feat: added dev & release workflows; added conventions to support AI IDE"
2025-08-09 09:06:53 -07:00
Marut PandyaandGitHub 2f2bd4c749 Revert "feat: added dev & release workflows; added conventions to support AI IDE" 2025-08-09 09:01:52 -07:00
Jhenner Tigreros fb0c030797 fix initialization on openaiservingmodels 2025-08-07 16:40:06 -05:00
Jhenner Tigreros 8b02a703b4 fix issues 2025-08-07 15:59:43 -05:00
Jhenner Tigreros d8863139d6 add model to test 2025-08-07 15:28:02 -05:00
Jhenner TigrerosandGitHub f5a063956e Fix requirements.txt to support gpt-oss models 2025-08-07 15:13:37 -05:00
Marut PandyaandGitHub 18748fd73e Merge pull request #202 from runpod-workers/feat/proper-deployment
feat: added dev & release workflows; added conventions to support AI IDE
2025-08-04 17:13:47 -07:00
Tim Pietrusky 0133c23be8 ci: added manual workflow trigger for releases 2025-08-04 09:58:23 +02:00
Tim Pietrusky a129cff47d docs: use "version" instead of actual version, so that people can check the releases 2025-07-31 12:03:17 +02:00
Tim Pietrusky 30f2c4630e refactor: use correct version 2025-07-31 12:02:46 +02:00
Tim Pietrusky b98636e432 feat: added "dev" and "release" workflows; removed "vllm-base-image" as it's not needed 2025-07-28 16:40:20 +02:00
pandyamarut 185205c750 chore(release): 0.10.0
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-07-25 10:18:06 -07:00
pandyamarut b948e530a1 chore(release): 0.10.0
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-07-25 10:17:50 -07:00
Marut PandyaandGitHub 4f22d6f107 Merge pull request #193 from runpod-workers/release/0.9.1
chore(release): v0.9.1
2025-06-26 13:23:33 -07:00
pandyamarut 8839689132 chore(release): v0.9.1
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-06-26 11:06:23 -07:00
Marut PandyaandGitHub 5ddc2326cd Merge pull request #191 from runpod-workers/feat/0.9.1
feat: update to 0.9.1 & added CONFIG_FORMAT to run magistral
2025-06-26 10:17:54 -07:00
Tim Pietrusky 46a3300cbb chore: reverted changeds to only focus on vllm update 2025-06-20 14:56:39 +02:00
Tim Pietrusky 1e9a731380 Fix Mistral tokenizer initialization: let vLLM handle tokenizer for mistral models 2025-06-14 15:31:56 +02:00
Tim Pietrusky c47e649a24 Add CONFIG_FORMAT environment variable support 2025-06-14 15:12:46 +02:00
Tim Pietrusky 7192bcaeef Trigger build automatically on feat/0.9.1 branch 2025-06-14 13:49:22 +02:00
Tim Pietrusky 8665ffb78d Revert workflow back to original configuration 2025-06-14 13:47:16 +02:00
Tim Pietrusky 57431b30ad Fix workflow: use standard GitHub runners and actions 2025-06-14 13:42:46 +02:00
Tim Pietrusky 437a84c77a ci: added workflow to build the image 2025-06-14 13:31:36 +02:00
Tim Pietrusky a4062fc488 feat: update to 0.9.1 2025-06-14 13:31:27 +02:00
Marut PandyaandGitHub 9631407c1d Merge pull request #189 from runpod-workers/hf-mm
add multi modal env var
2025-06-10 17:03:18 -07:00
pandyamarut 1a93932ab2 add multi modal env var
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-06-10 17:02:42 -07:00
Marut PandyaandGitHub 4c6c88c3b9 Merge pull request #188 from WorstDev01/add-mm-limit-parameter
Add multimodal limit parameter support
2025-06-10 14:59:21 -07:00
WorstDev01 a58a76783d Add multimodal limit parameter support
- Updated convert_limit_mm_per_prompt to handle multiple types
- Added limit_mm_per_prompt parameter for image and video limits

Note: Consider adjusting default values - perhaps image limit > 1 or video=1
2025-06-10 23:36:47 +02:00
Marut PandyaandGitHub 26919c8849 Merge pull request #185 from runpod-workers/up-0.9.0
Version upgrade
2025-06-05 12:00:05 -07:00
pandyamarut 70cd1c8113 update vllm version 0.9.0
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-06-05 11:59:15 -07:00
Marut PandyaandGitHub deeff579f8 Merge pull request #183 from SorenDreano/fix/model_name_in_local_args
remove requirements for MODEL_NAME in local_model_args.json
2025-06-04 12:45:00 -07:00
Soren Dreano 11f96a09d7 remove requirements for MODEL_NAME in local_model_args.json
We want to use the same local_model_args.json for multiple models
which have different names. It would be very convenient to only
have a single local_args file and not have to create it every time

A warning should be enough for users
2025-05-23 17:59:19 +02:00
Marut PandyaandGitHub 23e8ecf85b Merge pull request #169 from RedHitMark/main
fix lora and multi-lora
2025-05-14 16:25:26 -07:00
Marut PandyaandGitHub 6db2c44d3b Update Dockerfile 2025-05-09 09:27:54 -07:00
Marut PandyaandGitHub 9b7ca4d0b0 Update tests.json 2025-05-08 17:12:59 -07:00
Marut PandyaandGitHub 2a4eaf0356 Merge pull request #182 from runpod-workers/up-0.8.5
update vllm
2025-05-08 11:40:23 -07:00
pandyamarut ba19cc97bf update vllm
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-05-08 11:34:58 -07:00
Marut PandyaandGitHub 6075f2c590 Merge pull request #181 from runpod-workers/revert-177-main
Revert "fix: added back limit_mm_per_prompt to engine args"
2025-05-07 12:31:15 -07:00
Marut PandyaandGitHub a9786a2481 Revert "fix: added back limit_mm_per_prompt to engine args" 2025-05-07 12:29:33 -07:00
Marut PandyaandGitHub 0b6bc7a2be Update tests.json 2025-05-07 11:14:50 -07:00
Marut PandyaandGitHub d0ab58ee17 Merge pull request #180 from muhsinking/patch-1
Update README.md table to fix table of contents links
2025-05-03 21:02:37 -07:00
Marut PandyaandGitHub 4e474c41c8 Merge pull request #177 from aleksandar-babic/main
fix: added back limit_mm_per_prompt to engine args
2025-05-03 21:01:58 -07:00
Mo KingandGitHub e9d13c155e Update README.md to fix table of contents links to environment variable sections
Separates environment variables into multiple tables, so that the table of contents will correctly jump to the appropriate section when clicked.
2025-04-30 12:45:54 -04:00
Marut PandyaandGitHub e807342e90 Merge pull request #178 from runpod-workers/up-0.8.4
update vllm
2025-04-21 13:15:03 -07:00
pandyamarut f33e8d2bcd update vllm
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-04-21 13:14:32 -07:00
Marut PandyaandGitHub 6b64bb93bd Merge pull request #147 from mohamednaji7/BitsAndBytes
completing the "bitsandbytes" option - based on  https://docs.vllm.ai/en/stable/quantization/bnb.html
2025-04-21 11:39:53 -07:00
Aleksandar Babic a53cf777ff chore: added limit_mm_per_prompt to worker config 2025-04-21 10:14:05 -04:00
Aleksandar Babic cfc258674b chore: added trailing comma to the final arg 2025-04-21 10:06:08 -04:00
Aleksandar Babic 8beafed06b fix: added back limit_mm_per_prompt to engine args 2025-04-21 10:02:46 -04:00
Marut PandyaandGitHub d77c53c3b7 Merge pull request #175 from runpod-workers/up-0.8.3
update vllm
2025-04-07 11:58:03 -07:00
pandyamarut 3d067cd472 update vllm
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-04-07 11:54:57 -07:00
Marut PandyaandGitHub f1360ccae7 Merge pull request #173 from KAJdev/patch-1
Update hub.json
2025-04-03 14:52:06 -07:00
Marut PandyaandGitHub 96f1b86126 Merge pull request #174 from KAJdev/patch-2
Update tests.json
2025-04-03 10:14:49 -07:00
Ezekiel WotringandGitHub 3a095f3e10 Update tests.json 2025-04-03 09:10:01 -08:00
Ezekiel WotringandGitHub 7cf7f3e4e6 Update hub.json 2025-04-03 09:04:28 -08:00
Marut PandyaandGitHub 4395d0c67b Update hub.json 2025-04-03 08:10:28 -07:00
Marut PandyaandGitHub 5864fa6843 Update hub.json 2025-03-31 15:55:35 -07:00
Marut PandyaandGitHub 067f0bc173 Update tests.json 2025-03-31 15:49:31 -07:00
Marut PandyaandGitHub 0869068e7c Create tests.json 2025-03-31 15:32:06 -07:00
Marut PandyaandGitHub 19f25b17de Update hub.json 2025-03-31 15:14:40 -07:00
Marut PandyaandGitHub 70aa748c30 Update hub.json 2025-03-31 15:14:24 -07:00
Marut PandyaandGitHub da3e5f524b Merge pull request #171 from runpod-workers/update
update vllm 0.8.2
2025-03-26 15:56:04 -07:00
pandyamarut acbdf63de8 update vllm 0.8.2
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-03-26 15:55:30 -07:00
RedHitMark 084d000324 fix lora and multi-lora 2025-03-14 21:45:09 +01:00
Hailong YangandGitHub fa31d9663d Update README.md 2025-03-11 22:24:22 -04:00
Marut PandyaandGitHub b8fb313483 Merge pull request #168 from runpod-workers/wc-up
update worker config
2025-03-11 12:23:22 -07:00
pandyamarut 9635daf336 update worker config
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-03-11 12:22:53 -07:00
Marut PandyaandGitHub fb4e700090 Merge pull request #166 from KAJdev/patch-1
Create hub.json
2025-03-10 12:14:47 -07:00
Marut PandyaandGitHub d4872ed9c8 Merge pull request #167 from runpod-workers/rachfop-patch-1
Update requirements.txt
2025-03-10 12:13:47 -07:00
Patrick RachfordandGitHub b2eef50c3b Update requirements.txt
Use the latest runpod version from here:
https://github.com/runpod/runpod-python/releases/tag/1.7.7
2025-03-10 08:46:28 -07:00
Ezekiel WotringandGitHub 8005bcc1a8 fix description 2025-03-07 13:22:34 -09:00
Ezekiel WotringandGitHub aa7b00ddda Create hub.json 2025-03-07 13:20:52 -09:00
Marut PandyaandGitHub dc6f3239bd Update README.md 2025-02-24 18:39:14 -08:00
Marut PandyaandGitHub f9d0fcb78c Merge pull request #165 from runpod-workers/hfix
[HF]: set default max_token size
2025-02-24 17:24:50 -08:00
pandyamarut 99b952e55e set default max_token size
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-02-24 17:22:44 -08:00
Marut PandyaandGitHub 389fad7952 Merge pull request #164 from runpod-workers/up-0.7.3
update vllm
2025-02-24 15:08:02 -08:00
pandyamarut 56dc4ad075 update vllm
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-02-24 15:01:45 -08:00
Marut PandyaandGitHub 6dcf39e159 Merge pull request #161 from runpod-workers/revert-157-m-c
Revert "Enabling model caching."
2025-02-18 14:33:27 -08:00
Marut PandyaandGitHub 2b1d618287 Revert "Enabling model caching." 2025-02-18 10:45:47 -08:00
Marut PandyaandGitHub d7e9c49fe4 Merge pull request #160 from runpod-workers/up-0.7.2
update vllm
2025-02-11 13:59:18 -08:00
pandyamarut c9791f1163 update vllm
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-02-11 13:27:57 -08:00
Marut PandyaandGitHub 6fc770415d Merge pull request #157 from runpod-workers/m-c
Enabling model caching.
2025-02-06 11:52:19 -08:00
Mohamed NagyandGitHub 04288240f6 updating the . in ['awq', 'squeezellm', 'gptq'. 'bitsandbytes'] for the QUNATIZATION row 2025-02-02 14:58:48 +02:00
Marut PandyaandGitHub 9e8d9196b0 Merge pull request #154 from runpod-workers/fx-eng
update engine.py
2025-01-28 21:40:26 -08:00
pandyamarut 30dd7c1eb5 update engine.py
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-01-28 21:40:00 -08:00
Marut PandyaandGitHub aa7c37ffb0 Merge pull request #152 from runpod-workers/fix0.7.0-1
update oai serving classes
2025-01-28 20:58:40 -08:00
pandyamarut dc8c88027a update serving classes
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-01-28 20:58:07 -08:00
Marut PandyaandGitHub a948e90caa Merge pull request #151 from runpod-workers/fix0.7.0
dynamic lora loading
2025-01-28 19:02:59 -08:00
pandyamarut c703254f71 dynamic lora loading
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-01-28 19:00:57 -08:00
Marut PandyaandGitHub 2747106403 Merge pull request #150 from runpod-workers/up-0.7.0
update vllm 0.7.0
2025-01-28 14:27:37 -08:00
pandyamarut 91ed30e9a2 update readme
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-01-28 14:21:33 -08:00
pandyamarut fcbfe84f63 update vllm 0.7.0
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2025-01-28 14:18:10 -08:00
Marut PandyaandGitHub 610429df23 Merge pull request #143 from sihamouda/main
Add limit_mm_per_prompt engine argument for multimodels input
2025-01-27 16:41:47 -08:00
Hailong Yang a578c6df23 update docker file 2025-01-26 23:28:27 -05:00
Mohamed NagyandGitHub 9299f43b8b solving "typing_extensions" compatibility with "bitsandbytes"
```
2025-01-22 18:04:01 [INFO] > [stage-0 5/8] RUN --mount=type=cache,target=/root/.cache/pip python3 -m pip install --upgrade pip && python3 -m pip install --upgrade -r /requirements.txt:
2025-01-22 18:04:01 [INFO] #13 8.904
2025-01-22 18:04:01 [INFO] #13 8.904 The conflict is caused by:
2025-01-22 18:04:01 [INFO] #13 8.904 The user requested typing-extensions==4.7.1
2025-01-22 18:04:01 [INFO] #13 8.904 bitsandbytes 0.45.0 depends on typing_extensions>=4.8.0
```
2025-01-22 18:06:46 +02:00
mohamednaji7 131c17569f correct access to "args" dictionary 2025-01-21 22:33:28 +02:00
mohamednaji7 8882f6d50b adding 'bitsandbytes' to QUANTIZATION 2025-01-21 14:46:40 +02:00
mohamednaji7 331bc30101 adding 'bitsandbytes' option 2025-01-21 14:08:37 +02:00
mohamednaji7 a27f72a33a inforce args.quantization for bnb load_froamt 2025-01-21 14:01:32 +02:00
mohamednaji7 7167985f23 including bitsandbytes "src:https://docs.vllm.ai/en/stable/quantization/bnb.html" 2025-01-21 13:49:36 +02:00
sihamouda 0e3359a70e add engine argument for multimodels input 2025-01-19 02:44:39 +01:00
Marut PandyaandGitHub 3f0a20d28e Merge pull request #141 from runpod-workers/main
Rebase
2025-01-02 20:49:48 -08:00
pandyamarut 8e3c26be14 update worker-config
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-12-30 17:41:10 -08:00
pandyamarut 66ea8b1110 update engine
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-12-30 17:13:03 -08:00
Marut PandyaandGitHub a3d432afdf Merge pull request #140 from runpod-workers/nw-updte
upgrade vllm version
2024-12-30 15:23:44 -08:00
pandyamarut 06c2bb1715 upgrade vllm version
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-12-30 15:20:11 -08:00
Marut PandyaandGitHub d2e355eae9 Merge pull request #137 from kldzj/fix-tool-calling
fix: openai tool calling
2024-12-15 20:50:47 -08:00
kldzj b7787d8ca8 fix: remove unused import 2024-12-06 16:29:06 +01:00
kldzj b1fca5d257 fix: move tool flags away from engine args 2024-12-06 16:07:23 +01:00
kldzj 3e86d16892 fix: openai tool calling 2024-12-06 13:08:48 +01:00
Marut PandyaandGitHub d9f54ce76a Update README.md 2024-11-29 16:30:45 -08:00
Marut PandyaandGitHub 149da95cd0 Merge pull request #133 from kldzj/tool-calling
feat: add tool calling flags
2024-11-29 16:29:56 -08:00
Marut PandyaandGitHub 0a89394f1d Update worker-config.json 2024-11-29 16:29:33 -08:00
Nikolai Kolodziej 8df7f41f1d fix: set empty tool_call_parser to None 2024-11-24 06:55:43 +01:00
Nikolai Kolodziej 4d7b8c03c0 feat: tool calling flags 2024-11-24 06:51:41 +01:00
pandyamarut 6c6bf50379 update env
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-11-22 15:14:57 -08:00
pandyamarut 27a2ee5754 add model cache
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-11-22 13:11:12 -08:00
Marut PandyaandGitHub 2df915a145 Merge pull request #132 from runpod-workers/wc-uo
update worker-config
2024-11-20 14:54:45 -08:00
pandyamarut aadc025849 update worker-config
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-11-20 14:42:56 -08:00
Marut PandyaandGitHub 8b4a49073d Merge pull request #131 from runpod-workers/up-0.6.4
[Core]Update vllm-0.6.4
2024-11-20 10:37:46 -08:00
pandyamarut 4e10641d69 update vllm
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-11-19 12:14:04 -08:00
Marut PandyaandGitHub 6e8696c12a Merge pull request #121 from sven-knoblauch/lora-modules
add changes for lora adapter support and /v1/models endpoint
2024-10-31 15:07:02 -04:00
Marut PandyaandGitHub b49e81a75a Merge pull request #126 from runpod-workers/up-wc-1
update worker-config
2024-10-15 17:52:13 -07:00
pandyamarut 65932f85e1 update worker-config
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-10-15 17:47:58 -07:00
Marut PandyaandGitHub 94840cfbbb Update README.md 2024-10-15 17:38:31 -07:00
Marut PandyaandGitHub ce47c41f4a Merge pull request #125 from runpod-workers/up-0.6.3
update vllm
2024-10-15 17:04:20 -07:00
pandyamarut c03ecc42fe update vllm
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-10-15 16:49:41 -07:00
Dean QuiñanolaandGitHub ae56b9f43d Merge pull request #123 from runpod-workers/dependency-update-refactored 2024-10-13 20:23:33 -07:00
Dean QuiñanolaandGitHub 891699be1e Merge pull request #124 from runpod-workers/readme-correction 2024-10-13 20:23:05 -07:00
Dean QuiñanolaandGitHub c28aa02576 Update README.md
v1.5.0 not v15
2024-10-12 17:11:59 -07:00
Dean QuiñanolaandGitHub eba20c0704 Update CI-runpod_dep.yml
Dependency has changed to `runpod~=<version>` and not `runpod==<version>`
2024-10-12 16:47:31 -07:00
Sven Knoblauch 677a01e8f3 update code for case of no lora adapter 2024-10-09 14:51:33 +02:00
Sven Knoblauch 5cd12ba331 add changes for lora adapter support and /v1/models endpoint 2024-10-09 11:01:12 +02:00
Dean QuiñanolaandGitHub 850c686538 Merge pull request #120 from runpod-workers/runpod-v1.7-and-up
Update requirements.txt to support runpod-python 1.7.*
2024-10-08 10:52:20 -07:00
Dean QuiñanolaandGitHub de2876e659 Update requirements.txt 2024-10-08 10:48:10 -07:00
Marut PandyaandGitHub d3ee3236c0 Merge pull request #118 from runpod-workers/up-wc
update worker-config
2024-10-01 11:23:02 -07:00
pandyamarut 0781e93054 update worker-config
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-10-01 11:21:27 -07:00
Marut PandyaandGitHub 251e807012 Update README.md 2024-10-01 11:17:30 -07:00
Marut PandyaandGitHub 29346769ed Merge pull request #117 from runpod-workers/up-0.6.2
update vllm
2024-10-01 11:05:40 -07:00
pandyamarut 1420091588 update vll
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-09-27 19:23:50 -07:00
Marut PandyaandGitHub d46adeaee9 Merge pull request #110 from runpod-workers/up-0.6.1
update vllm v0.6.1
2024-09-16 15:12:50 -07:00
pandyamarut 5c0dca44bd update
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-09-16 15:01:21 -07:00
pandyamarut cc301ac123 update
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-09-16 15:00:01 -07:00
pandyamarut 2ac6a0108f update vllm v0.6.0
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-09-16 14:55:40 -07:00
Marut PandyaandGitHub b1554ea10f Merge pull request #109 from runpod-workers/0.5.5-update
[Update] Docs, bug fix.
2024-09-06 12:36:09 -07:00
pandyamarut 0d794a3914 fix
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-09-06 12:26:09 -07:00
pandyamarut 3dad3a754c update vllm
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-09-06 12:21:34 -07:00
Marut PandyaandGitHub 44cef385df Merge pull request #108 from runpod-workers/cmpl-htf
[Bug]fix oai completion api error
2024-09-06 11:06:33 -07:00
pandyamarut 814f50af38 fix oai completion api error
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-09-06 11:03:47 -07:00
Marut PandyaandGitHub f3a530b7fe Merge pull request #107 from runpod-workers/pandyamarut-patch-1
Update README.md
2024-08-28 23:32:48 -07:00
Marut PandyaandGitHub cdf78e7c89 Update README.md 2024-08-28 23:32:36 -07:00
Marut PandyaandGitHub ab40d9c9a8 Merge pull request #106 from runpod-workers/up-0.5.5
update vllm version 0.5.5
2024-08-28 23:31:15 -07:00
pandyamarut 3293245c81 update tags
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-08-28 23:28:39 -07:00
pandyamarut 5e1c8c8128 update vllm version 0.5.5
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-08-28 22:46:45 -07:00
Marut PandyaandGitHub 286d6ba702 Merge pull request #102 from carlson-svg/main
Add human readable worker-config.json
2024-08-26 20:22:47 -07:00
carlson-svg 8d734f8340 Merge branch 'add-worker-config' 2024-08-26 01:25:09 -07:00
carlson-svg 4fa4a8e0e6 added to worker config docs to table of contents + added side note 2024-08-26 01:20:18 -07:00
carlson-svg 39ce8a64c0 initial documentation for worker-config.json 2024-08-22 15:40:54 -07:00
carlson-svg 825ef25b60 changed to minimumCudaVersion to camel case 2024-08-21 12:47:48 -07:00
carlson-svg 1e9aeb6e8f adding "minimum_cuda_version" to each version 2024-08-21 12:44:45 -07:00
carlson-svg e6172dddd4 took out space in imageName from version 0.5.4 2024-08-19 15:17:20 -07:00
carlson-svg 21a1e138b4 updated version of human readable config 2024-08-18 23:57:19 -07:00
carlson-svg a40e7803ee converted to human readable format 2024-08-18 23:24:40 -07:00
CarlsonandGitHub 5e245793bc Merge pull request #1 from carlson-svg/add-worker-config
v0 worker-config
2024-08-13 20:43:47 -07:00
Marut PandyaandGitHub 2111c9e7a5 Update README.md 2024-08-12 21:02:43 -07:00
carlson-svg 0ae11ea6df v0 worker-config 2024-08-09 15:10:08 -07:00
Marut PandyaandGitHub 7f46582949 Merge pull request #96 from runpod-workers/rel-v0.5.4
update vllm version 0.5.4
2024-08-09 15:01:16 -07:00
Marut PandyaandGitHub 571ef2b805 Update README.md 2024-08-09 14:58:46 -07:00
pandyamarut 967eaba573 change to float
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-08-09 14:41:07 -07:00
Marut PandyaandGitHub eb75a3ac03 Merge pull request #95 from runpod-workers/runpod-package-update
Update runpod package version
2024-08-09 12:04:25 -07:00
pandyamarut 9cb9336cf5 update vllm version 0.5.4
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-08-09 12:01:42 -07:00
pandyamarutandGitHub 6a15a9e750 Update package version 2024-08-07 22:38:37 +00:00
Marut PandyaandGitHub f023f57217 Update README.md 2024-08-07 15:38:26 -07:00
Marut PandyaandGitHub 673597fd46 Update README.md 2024-08-07 15:32:23 -07:00
Marut PandyaandGitHub c50543ebd9 Update README.md 2024-08-07 15:30:33 -07:00
Marut PandyaandGitHub 17a2d844ec Merge pull request #93 from runpod-workers/up-rdme
Update README.md
2024-08-05 14:36:39 -07:00
pandyamarut 3498e99b2f update
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-08-05 14:33:56 -07:00
pandyamarut 5da96ce9a6 update
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-08-05 14:26:56 -07:00
Marut PandyaandGitHub e32626ca9d Update README.md 2024-08-05 14:19:38 -07:00
Marut PandyaandGitHub 37d140aba6 Update docker-bake.hcl 2024-08-02 16:53:59 -07:00
Marut PandyaandGitHub 66ed2a2a5f Merge pull request #90 from runpod-workers/pandyamarut-patch-1
Update README.md
2024-08-02 16:03:18 -07:00
pandyamarut e846ecae9d update readme
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-08-02 14:13:55 -07:00
Marut PandyaandGitHub 9f066be620 Update README.md 2024-08-02 13:29:18 -07:00
Marut PandyaandGitHub 8a010c3804 Merge pull request #82 from runpod-workers/any-arg-and-refactor
Allow any vLLM engine args as env vars, Update vLLM, refactor
2024-08-01 15:28:11 -07:00
pandyamarut 14cacd55fe update docker
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-07-31 18:44:46 -07:00
Marut PandyaandGitHub e1b41795f7 Update README.md 2024-07-31 12:46:34 -07:00
Marut PandyaandGitHub 0814d76654 Update README.md 2024-07-30 17:09:01 -07:00
pandyamarut f3534a4ea7 fix openai compat
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-07-27 15:49:45 -07:00
Marut PandyaandGitHub b61ea5ea46 Delete test.py 2024-07-26 17:32:16 -07:00
pandyamarut 0f8657e58d update env default args
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-07-26 16:52:51 -07:00
pandyamarut bd96b5e0de update v0.5.3.post1
Signed-off-by: pandyamarut <pandyamarut@gmail.com>
2024-07-25 21:29:45 -07:00
alpayariyak 5bd6f3a75e 0.5.3, any vllm arg as env var, refactor and fixes, moving away from building separate image from vLLM fork 2024-07-25 12:41:48 -07:00
alpayariyak a08d83f600 Allow any vLLM engine args as env vars, refactor 2024-07-02 19:44:01 +00:00
alpayariyak 0e1e38326a Fix deprecated max_context_len_to_capture engine argument 2024-06-13 17:48:05 +00:00
18 changed files with 3291 additions and 448 deletions
+27 -10
View File
@@ -19,32 +19,49 @@ jobs:
- name: Check for new package version and update - name: Check for new package version and update
run: | run: |
# Get current version echo "Fetching the current runpod version from requirements.txt..."
current_version=$(grep -oP 'runpod==\K[^"]+' ./builder/requirements.txt)
# Get new version # Get current version, allowing both == and ~= in the search pattern
current_version=$(grep -oP 'runpod[~=]{1,2}\K[^"]+' ./builder/requirements.txt)
echo "Current version: $current_version"
# Extract major and minor from current version
current_major_minor=$(echo $current_version | cut -d. -f1,2)
echo "Current major.minor: $current_major_minor"
echo "Fetching the latest runpod version from PyPI..."
# Get new version from PyPI
new_version=$(curl -s https://pypi.org/pypi/runpod/json | jq -r .info.version) new_version=$(curl -s https://pypi.org/pypi/runpod/json | jq -r .info.version)
echo "NEW_VERSION_ENV=$new_version" >> $GITHUB_ENV echo "NEW_VERSION_ENV=$new_version" >> $GITHUB_ENV
echo "New version: $new_version"
# Extract major and minor from new version
new_major_minor=$(echo $new_version | cut -d. -f1,2)
echo "New major.minor: $new_major_minor"
if [ -z "$new_version" ]; then if [ -z "$new_version" ]; then
echo "Failed to fetch the new version." echo "ERROR: Failed to fetch the new version from PyPI."
exit 1 exit 1
fi fi
# Check if the version is already up-to-date # Check if the major or minor version is different
if [ "$current_version" = "$new_version" ]; then if [ "$current_major_minor" = "$new_major_minor" ]; then
echo "The package version is already up-to-date." echo "No update needed. The new version ($new_major_minor) is within the allowed range (~= $current_major_minor)."
exit 0 exit 0
fi fi
# Update requirements.txt echo "New major/minor detected ($new_major_minor). Updating requirements.txt..."
sed -i "s/runpod==.*/runpod==$new_version/" ./builder/requirements.txt
# Update requirements.txt, preserving the existing constraint type (~= or ==)
sed -i "s/runpod[~=][^ ]*/runpod~=$new_version/" ./builder/requirements.txt
echo "requirements.txt has been updated."
- name: Create Pull Request - name: Create Pull Request
uses: peter-evans/create-pull-request@v3 uses: peter-evans/create-pull-request@v3
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update package version commit-message: Update runpod package version
title: Update runpod package version title: Update runpod package version
body: The package version has been updated to ${{ env.NEW_VERSION_ENV }} body: The package version has been updated to ${{ env.NEW_VERSION_ENV }}
branch: runpod-package-update branch: runpod-package-update
+1016
View File
File diff suppressed because it is too large Load Diff
+32
View File
@@ -0,0 +1,32 @@
{
"tests": [
{
"name": "basic_inference_test",
"input": {
"prompt": "Write a short poem about artificial intelligence."
},
"timeout": 30000
}
],
"config": {
"gpuTypeId": "NVIDIA GeForce RTX 4090",
"gpuCount": 1,
"env": [
{
"key": "MODEL_NAME",
"value": "facebook/opt-350m"
}
],
"allowedCudaVersions": [
"12.7",
"12.6",
"12.5",
"12.4",
"12.3",
"12.2",
"12.1",
"12.0",
"11.7"
]
}
}
+11 -11
View File
@@ -1,16 +1,20 @@
ARG WORKER_CUDA_VERSION=11.8.0 FROM nvidia/cuda:12.1.0-base-ubuntu22.04
ARG BASE_IMAGE_VERSION=1.0.0
FROM runpod/worker-vllm:base-${BASE_IMAGE_VERSION}-cuda${WORKER_CUDA_VERSION} AS vllm-base
RUN apt-get update -y \ RUN apt-get update -y \
&& apt-get install -y python3-pip && apt-get install -y python3-pip
RUN ldconfig /usr/local/cuda-12.1/compat/
# Install Python dependencies # Install Python dependencies
COPY builder/requirements.txt /requirements.txt COPY builder/requirements.txt /requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip \ RUN --mount=type=cache,target=/root/.cache/pip \
python3 -m pip install --upgrade pip && \ python3 -m pip install --upgrade pip && \
python3 -m pip install --upgrade -r /requirements.txt python3 -m pip install --upgrade -r /requirements.txt
# Install vLLM (switching back to pip installs since issues that required building fork are fixed and space optimization is not as important since caching) and FlashInfer
RUN python3 -m pip install vllm==0.10.0 && \
python3 -m pip install flashinfer -i https://flashinfer.ai/whl/cu121/torch2.3
# Setup for Option 2: Building the Image with the Model included # Setup for Option 2: Building the Image with the Model included
ARG MODEL_NAME="" ARG MODEL_NAME=""
ARG TOKENIZER_NAME="" ARG TOKENIZER_NAME=""
@@ -28,23 +32,19 @@ ENV MODEL_NAME=$MODEL_NAME \
HF_DATASETS_CACHE="${BASE_PATH}/huggingface-cache/datasets" \ HF_DATASETS_CACHE="${BASE_PATH}/huggingface-cache/datasets" \
HUGGINGFACE_HUB_CACHE="${BASE_PATH}/huggingface-cache/hub" \ HUGGINGFACE_HUB_CACHE="${BASE_PATH}/huggingface-cache/hub" \
HF_HOME="${BASE_PATH}/huggingface-cache/hub" \ HF_HOME="${BASE_PATH}/huggingface-cache/hub" \
HF_HUB_ENABLE_HF_TRANSFER=1 HF_HUB_ENABLE_HF_TRANSFER=0
ENV PYTHONPATH="/:/vllm-workspace" ENV PYTHONPATH="/:/vllm-workspace"
COPY src/download_model.py /download_model.py
COPY src /src
RUN --mount=type=secret,id=HF_TOKEN,required=false \ RUN --mount=type=secret,id=HF_TOKEN,required=false \
if [ -f /run/secrets/HF_TOKEN ]; then \ if [ -f /run/secrets/HF_TOKEN ]; then \
export HF_TOKEN=$(cat /run/secrets/HF_TOKEN); \ export HF_TOKEN=$(cat /run/secrets/HF_TOKEN); \
fi && \ fi && \
if [ -n "$MODEL_NAME" ]; then \ if [ -n "$MODEL_NAME" ]; then \
python3 /download_model.py; \ python3 /src/download_model.py; \
fi fi
# Add source files
COPY src /src
# Remove download_model.py
RUN rm /download_model.py
# Start the handler # Start the handler
CMD ["python3", "/src/handler.py"] CMD ["python3", "/src/handler.py"]
+217 -106
View File
@@ -18,8 +18,9 @@ Deploy OpenAI-Compatible Blazing-Fast LLM Endpoints powered by the [vLLM](https:
### 1. UI for Deploying vLLM Worker on RunPod console: ### 1. UI for Deploying vLLM Worker on RunPod console:
![Demo of Deploying vLLM Worker on RunPod console with new UI](media/ui_demo.gif) ![Demo of Deploying vLLM Worker on RunPod console with new UI](media/ui_demo.gif)
### 2. Worker vLLM `1.0.0` with vLLM `0.4.2` now available under `stable` tags ### 2. Worker vLLM `v2.7.0` with vLLM `0.9.1` now available under `stable` tags
Update 1.0.0 is now available, use the image tag `runpod/worker-vllm:stable-cuda12.1.0` or `runpod/worker-vllm:stable-cuda11.8.0`.
Update v2.7.0 is now available, use the image tag `runpod/worker-v1-vllm:v2.7.0stable-cuda12.1.0`.
### 3. OpenAI-Compatible [Embedding Worker](https://github.com/runpod-workers/worker-infinity-embedding) Released ### 3. OpenAI-Compatible [Embedding Worker](https://github.com/runpod-workers/worker-infinity-embedding) Released
Deploy your own OpenAI-compatible Serverless Endpoint on RunPod with multiple embedding models and fast inference for RAG and more! Deploy your own OpenAI-compatible Serverless Endpoint on RunPod with multiple embedding models and fast inference for RAG and more!
@@ -37,9 +38,8 @@ Worker vLLM is now cached on all RunPod machines, resulting in near-instant depl
- [Environment Variables](#environment-variables) - [Environment Variables](#environment-variables)
- [LLM Settings](#llm-settings) - [LLM Settings](#llm-settings)
- [Tokenizer Settings](#tokenizer-settings) - [Tokenizer Settings](#tokenizer-settings)
- [Tensor Parallelism (Multi-GPU) Settings](#tensor-parallelism-multi-gpu-settings) - [System and Parallelism Settings](#system-and-parallelism-settings)
- [System Settings](#system-settings) - [Streaming Batch Size Settings](#streaming-batch-size-settings)
- [Streaming Batch Size](#streaming-batch-size)
- [OpenAI Settings](#openai-settings) - [OpenAI Settings](#openai-settings)
- [Serverless Settings](#serverless-settings) - [Serverless Settings](#serverless-settings)
- [Option 2: Build Docker Image with Model Inside](#option-2-build-docker-image-with-model-inside) - [Option 2: Build Docker Image with Model Inside](#option-2-build-docker-image-with-model-inside)
@@ -52,12 +52,15 @@ Worker vLLM is now cached on all RunPod machines, resulting in near-instant depl
- [Modifying your OpenAI Codebase to use your deployed vLLM Worker](#modifying-your-openai-codebase-to-use-your-deployed-vllm-worker) - [Modifying your OpenAI Codebase to use your deployed vLLM Worker](#modifying-your-openai-codebase-to-use-your-deployed-vllm-worker)
- [OpenAI Request Input Parameters](#openai-request-input-parameters) - [OpenAI Request Input Parameters](#openai-request-input-parameters)
- [Chat Completions](#chat-completions) - [Chat Completions](#chat-completions)
- [Completions](#completions)
- [Examples: Using your RunPod endpoint with OpenAI](#examples-using-your-runpod-endpoint-with-openai) - [Examples: Using your RunPod endpoint with OpenAI](#examples-using-your-runpod-endpoint-with-openai)
- [Usage: standard](#non-openai-usage) - [Usage: standard](#non-openai-usage)
- [Input Request Parameters](#input-request-parameters) - [Input Request Parameters](#input-request-parameters)
- [Text Input Formats](#text-input-formats) - [Text Input Formats](#text-input-formats)
- [Sampling Parameters](#sampling-parameters) - [Sampling Parameters](#sampling-parameters)
- [Worker Config](#worker-config)
- [Writing your worker-config.json](#writing-your-worker-configjson)
- [Example of schema](#example-of-schema)
- [Example of versions](#example-of-versions)
# Setting up the Serverless Worker # Setting up the Serverless Worker
@@ -78,8 +81,7 @@ Below is a summary of the available RunPod Worker images, categorized by image s
| CUDA Version | Stable Image Tag | Development Image Tag | Note | | CUDA Version | Stable Image Tag | Development Image Tag | Note |
|--------------|-----------------------------------|-----------------------------------|----------------------------------------------------------------------| |--------------|-----------------------------------|-----------------------------------|----------------------------------------------------------------------|
| 11.8.0 | `runpod/worker-vllm:stable-cuda11.8.0` | `runpod/worker-vllm:dev-cuda11.8.0` | Available on all RunPod Workers without additional selection needed. | | 12.1.0 | `runpod/worker-v1-vllm:v2.7.0stable-cuda12.1.0` | `runpod/worker-v1-vllm:v2.7.0dev-cuda12.1.0` | When creating an Endpoint, select CUDA Version 12.3, 12.2 and 12.1 in the filter. |
| 12.1.0 | `runpod/worker-vllm:stable-cuda12.1.0` | `runpod/worker-vllm:dev-cuda12.1.0` | When creating an Endpoint, select CUDA Version 12.3, 12.2 and 12.1 in the filter. |
@@ -88,48 +90,123 @@ Below is a summary of the available RunPod Worker images, categorized by image s
#### Prerequisites #### Prerequisites
- RunPod Account - RunPod Account
#### Environment Variables/Settings #### Environment Variables
> Note: `0` is equivalent to `False` and `1` is equivalent to `True` for boolean values. > Note: `0` is equivalent to `False` and `1` is equivalent to `True` for boolean as int values.
| Name | Default | Type/Choices | Description | #### LLM Settings
|-------------------------------------|----------------------|-------------------------------------------|-------------| | `Name` | `Default` | `Type/Choices` | `Description` |
**LLM Settings** |-------------------------------------------|-----------------------|--------------------------------------------|---------------|
| `MODEL_NAME`**\*** | - | `str` | Hugging Face Model Repository (e.g., `openchat/openchat-3.5-1210`). | | `MODEL_NAME` | 'facebook/opt-125m' | `str` | Name or path of the Hugging Face model to use. |
| `MODEL_REVISION` | `None` | `str` |Model revision(branch) to load. | | `TOKENIZER` | None | `str` | Name or path of the Hugging Face tokenizer to use. |
| `MAX_MODEL_LEN` | Model's maximum | `int` |Maximum number of tokens for the engine to handle per request. | | `SKIP_TOKENIZER_INIT` | False | `bool` | Skip initialization of tokenizer and detokenizer. |
| `BASE_PATH` | `/runpod-volume` | `str` |Storage directory for Huggingface cache and model. Utilizes network storage if attached when pointed at `/runpod-volume`, which will have only one worker download the model once, which all workers will be able to load. If no network volume is present, creates a local directory within each worker. | | `TOKENIZER_MODE` | 'auto' | ['auto', 'slow'] | The tokenizer mode. |
| `LOAD_FORMAT` | `auto` | `str` |Format to load model in. | | `TRUST_REMOTE_CODE` | `False` | `bool` | Trust remote code from Hugging Face. |
| `DOWNLOAD_DIR` | None | `str` | Directory to download and load the weights. |
| `LOAD_FORMAT` | 'auto' | `str` | The format of the model weights to load. |
| `HF_TOKEN` | - | `str` | Hugging Face token for private and gated models.| | `HF_TOKEN` | - | `str` | Hugging Face token for private and gated models.|
| `QUANTIZATION` | `None` | `awq`, `squeezellm`, `gptq` |Quantization of given model. The model must already be quantized. | | `DTYPE` | 'auto' | ['auto', 'half', 'float16', 'bfloat16', 'float', 'float32'] | Data type for model weights and activations. |
| `TRUST_REMOTE_CODE` | `0` | boolean as `int` |Trust remote code for Hugging Face models. Can help with Mixtral 8x7B, Quantized models, and unusual models/architectures. | `KV_CACHE_DTYPE` | 'auto' | ['auto', 'fp8'] | Data type for KV cache storage. |
| `SEED` | `0` | `int` |Sets random seed for operations. | | `QUANTIZATION_PARAM_PATH` | None | `str` | Path to the JSON file containing the KV cache scaling factors. |
| `KV_CACHE_DTYPE` | `auto` | `auto`, `fp8` |Data type for kv cache storage. Uses `DTYPE` if set to `auto`. | | `MAX_MODEL_LEN` | None | `int` | Model context length. |
| `DTYPE` | `auto` | `auto`, `half`, `float16`, `bfloat16`, `float`, `float32` |Sets datatype/precision for model weights and activations. | | `GUIDED_DECODING_BACKEND` | 'outlines' | ['outlines', 'lm-format-enforcer'] | Which engine will be used for guided decoding by default. |
**Tokenizer Settings** | `DISTRIBUTED_EXECUTOR_BACKEND` | None | ['ray', 'mp'] | Backend to use for distributed serving. |
| `WORKER_USE_RAY` | False | `bool` | Deprecated, use --distributed-executor-backend=ray. |
| `PIPELINE_PARALLEL_SIZE` | 1 | `int` | Number of pipeline stages. |
| `TENSOR_PARALLEL_SIZE` | 1 | `int` | Number of tensor parallel replicas. |
| `MAX_PARALLEL_LOADING_WORKERS` | None | `int` | Load model sequentially in multiple batches. |
| `RAY_WORKERS_USE_NSIGHT` | False | `bool` | If specified, use nsight to profile Ray workers. |
| `ENABLE_PREFIX_CACHING` | False | `bool` | Enables automatic prefix caching. |
| `DISABLE_SLIDING_WINDOW` | False | `bool` | Disables sliding window, capping to sliding window size. |
| `USE_V2_BLOCK_MANAGER` | False | `bool` | Use BlockSpaceMangerV2. |
| `NUM_LOOKAHEAD_SLOTS` | 0 | `int` | Experimental scheduling config necessary for speculative decoding. |
| `SEED` | 0 | `int` | Random seed for operations. |
| `NUM_GPU_BLOCKS_OVERRIDE` | None | `int` | If specified, ignore GPU profiling result and use this number of GPU blocks. |
| `MAX_NUM_BATCHED_TOKENS` | None | `int` | Maximum number of batched tokens per iteration. |
| `MAX_NUM_SEQS` | 256 | `int` | Maximum number of sequences per iteration. |
| `MAX_LOGPROBS` | 20 | `int` | Max number of log probs to return when logprobs is specified in SamplingParams. |
| `DISABLE_LOG_STATS` | False | `bool` | Disable logging statistics. |
| `QUANTIZATION` | None | ['awq', 'squeezellm', 'gptq', 'bitsandbytes'] | Method used to quantize the weights. |
| `ROPE_SCALING` | None | `dict` | RoPE scaling configuration in JSON format. |
| `ROPE_THETA` | None | `float` | RoPE theta. Use with rope_scaling. |
| `TOKENIZER_POOL_SIZE` | 0 | `int` | Size of tokenizer pool to use for asynchronous tokenization. |
| `TOKENIZER_POOL_TYPE` | 'ray' | `str` | Type of tokenizer pool to use for asynchronous tokenization. |
| `TOKENIZER_POOL_EXTRA_CONFIG` | None | `dict` | Extra config for tokenizer pool. |
| `ENABLE_LORA` | False | `bool` | If True, enable handling of LoRA adapters. |
| `MAX_LORAS` | 1 | `int` | Max number of LoRAs in a single batch. |
| `MAX_LORA_RANK` | 16 | `int` | Max LoRA rank. |
| `LORA_EXTRA_VOCAB_SIZE` | 256 | `int` | Maximum size of extra vocabulary for LoRA adapters. |
| `LORA_DTYPE` | 'auto' | ['auto', 'float16', 'bfloat16', 'float32'] | Data type for LoRA. |
| `LONG_LORA_SCALING_FACTORS` | None | `tuple` | Specify multiple scaling factors for LoRA adapters. |
| `MAX_CPU_LORAS` | None | `int` | Maximum number of LoRAs to store in CPU memory. |
| `FULLY_SHARDED_LORAS` | False | `bool` | Enable fully sharded LoRA layers. |
| `LORA_MODULES`| `[]`| `list[dict]`| Add lora adapters from Hugging Face `[{"name": "xx", "path": "xxx/xxxx", "base_model_name": "xxx/xxxx"}`|
| `SCHEDULER_DELAY_FACTOR` | 0.0 | `float` | Apply a delay before scheduling next prompt. |
| `ENABLE_CHUNKED_PREFILL` | False | `bool` | Enable chunked prefill requests. |
| `SPECULATIVE_MODEL` | None | `str` | The name of the draft model to be used in speculative decoding. |
| `NUM_SPECULATIVE_TOKENS` | None | `int` | The number of speculative tokens to sample from the draft model. |
| `SPECULATIVE_DRAFT_TENSOR_PARALLEL_SIZE` | None | `int` | Number of tensor parallel replicas for the draft model. |
| `SPECULATIVE_MAX_MODEL_LEN` | None | `int` | The maximum sequence length supported by the draft model. |
| `SPECULATIVE_DISABLE_BY_BATCH_SIZE` | None | `int` | Disable speculative decoding if the number of enqueue requests is larger than this value. |
| `NGRAM_PROMPT_LOOKUP_MAX` | None | `int` | Max size of window for ngram prompt lookup in speculative decoding. |
| `NGRAM_PROMPT_LOOKUP_MIN` | None | `int` | Min size of window for ngram prompt lookup in speculative decoding. |
| `SPEC_DECODING_ACCEPTANCE_METHOD` | 'rejection_sampler' | ['rejection_sampler', 'typical_acceptance_sampler'] | Specify the acceptance method for draft token verification in speculative decoding. |
| `TYPICAL_ACCEPTANCE_SAMPLER_POSTERIOR_THRESHOLD` | None | `float` | Set the lower bound threshold for the posterior probability of a token to be accepted. |
| `TYPICAL_ACCEPTANCE_SAMPLER_POSTERIOR_ALPHA` | None | `float` | A scaling factor for the entropy-based threshold for token acceptance. |
| `MODEL_LOADER_EXTRA_CONFIG` | None | `dict` | Extra config for model loader. |
| `PREEMPTION_MODE` | None | `str` | If 'recompute', the engine performs preemption-aware recomputation. If 'save', the engine saves activations into the CPU memory as preemption happens. |
| `PREEMPTION_CHECK_PERIOD` | 1.0 | `float` | How frequently the engine checks if a preemption happens. |
| `PREEMPTION_CPU_CAPACITY` | 2 | `float` | The percentage of CPU memory used for the saved activations. |
| `DISABLE_LOGGING_REQUEST` | False | `bool` | Disable logging requests. |
| `MAX_LOG_LEN` | None | `int` | Max number of prompt characters or prompt ID numbers being printed in log. |
#### Tokenizer Settings
| `Name` | `Default` | `Type/Choices` | `Description` |
|-------------------------------------------|-----------------------|--------------------------------------------|---------------|
| `TOKENIZER_NAME` | `None` | `str` |Tokenizer repository to use a different tokenizer than the model's default. | | `TOKENIZER_NAME` | `None` | `str` |Tokenizer repository to use a different tokenizer than the model's default. |
| `TOKENIZER_REVISION` | `None` | `str` |Tokenizer revision to load. | | `TOKENIZER_REVISION` | `None` | `str` |Tokenizer revision to load. |
| `CUSTOM_CHAT_TEMPLATE` | `None` | `str` of single-line jinja template |Custom chat jinja template. [More Info](https://huggingface.co/docs/transformers/chat_templating) | | `CUSTOM_CHAT_TEMPLATE` | `None` | `str` of single-line jinja template |Custom chat jinja template. [More Info](https://huggingface.co/docs/transformers/chat_templating) |
**System, GPU, and Tensor Parallelism(Multi-GPU) Settings**
#### System and Parallelism Settings
| `Name` | `Default` | `Type/Choices` | `Description` |
|-------------------------------------------|-----------------------|--------------------------------------------|---------------|
| `GPU_MEMORY_UTILIZATION` | `0.95` | `float` |Sets GPU VRAM utilization. | | `GPU_MEMORY_UTILIZATION` | `0.95` | `float` |Sets GPU VRAM utilization. |
| `MAX_PARALLEL_LOADING_WORKERS` | `None` | `int` |Load model sequentially in multiple batches, to avoid RAM OOM when using tensor parallel and large models. | | `MAX_PARALLEL_LOADING_WORKERS` | `None` | `int` |Load model sequentially in multiple batches, to avoid RAM OOM when using tensor parallel and large models. |
| `BLOCK_SIZE` | `16` | `8`, `16`, `32` |Token block size for contiguous chunks of tokens. | | `BLOCK_SIZE` | `16` | `8`, `16`, `32` |Token block size for contiguous chunks of tokens. |
| `SWAP_SPACE` | `4` | `int` |CPU swap space size (GiB) per GPU. | | `SWAP_SPACE` | `4` | `int` |CPU swap space size (GiB) per GPU. |
| `ENFORCE_EAGER` | `0` | boolean as `int` |Always use eager-mode PyTorch. If False(`0`), will use eager mode and CUDA graph in hybrid for maximal performance and flexibility. | | `ENFORCE_EAGER` | False | `bool` |Always use eager-mode PyTorch. If False(`0`), will use eager mode and CUDA graph in hybrid for maximal performance and flexibility. |
| `MAX_CONTEXT_LEN_TO_CAPTURE` | `8192` | `int` |Maximum context length covered by CUDA graphs. When a sequence has context length larger than this, we fall back to eager mode.| | `MAX_SEQ_LEN_TO_CAPTURE` | `8192` | `int` |Maximum context length covered by CUDA graphs. When a sequence has context length larger than this, we fall back to eager mode.|
| `DISABLE_CUSTOM_ALL_REDUCE` | `0` | `int` |Enables or disables custom all reduce. | | `DISABLE_CUSTOM_ALL_REDUCE` | `0` | `int` |Enables or disables custom all reduce. |
**Streaming Batch Size Settings**:
#### Streaming Batch Size Settings
The way this works is that the first request will have a batch size of `DEFAULT_MIN_BATCH_SIZE`, and each subsequent request will have a batch size of `previous_batch_size * DEFAULT_BATCH_SIZE_GROWTH_FACTOR`. This will continue until the batch size reaches `DEFAULT_BATCH_SIZE`. E.g. for the default values, the batch sizes will be `1, 3, 9, 27, 50, 50, 50, ...`. You can also specify this per request, with inputs `max_batch_size`, `min_batch_size`, and `batch_size_growth_factor`. This has nothing to do with vLLM's internal batching, but rather the number of tokens sent in each HTTP request from the worker
| `Name` | `Default` | `Type/Choices` | `Description` |
|-------------------------------------------|-----------------------|--------------------------------------------|---------------|
| `DEFAULT_BATCH_SIZE` | `50` | `int` |Default and Maximum batch size for token streaming to reduce HTTP calls. | | `DEFAULT_BATCH_SIZE` | `50` | `int` |Default and Maximum batch size for token streaming to reduce HTTP calls. |
| `DEFAULT_MIN_BATCH_SIZE` | `1` | `int` |Batch size for the first request, which will be multiplied by the growth factor every subsequent request. | | `DEFAULT_MIN_BATCH_SIZE` | `1` | `int` |Batch size for the first request, which will be multiplied by the growth factor every subsequent request. |
| `DEFAULT_BATCH_SIZE_GROWTH_FACTOR` | `3` | `float` |Growth factor for dynamic batch size. | | `DEFAULT_BATCH_SIZE_GROWTH_FACTOR` | `3` | `float` |Growth factor for dynamic batch size. |
The way this works is that the first request will have a batch size of `DEFAULT_MIN_BATCH_SIZE`, and each subsequent request will have a batch size of `previous_batch_size * DEFAULT_BATCH_SIZE_GROWTH_FACTOR`. This will continue until the batch size reaches `DEFAULT_BATCH_SIZE`. E.g. for the default values, the batch sizes will be `1, 3, 9, 27, 50, 50, 50, ...`. You can also specify this per request, with inputs `max_batch_size`, `min_batch_size`, and `batch_size_growth_factor`. This has nothing to do with vLLM's internal batching, but rather the number of tokens sent in each HTTP request from the worker |
**OpenAI Settings** #### OpenAI Settings
| `Name` | `Default` | `Type/Choices` | `Description` |
|-------------------------------------------|-----------------------|--------------------------------------------|---------------|
| `RAW_OPENAI_OUTPUT` | `1` | boolean as `int` |Enables raw OpenAI SSE format string output when streaming. **Required** to be enabled (which it is by default) for OpenAI compatibility. | | `RAW_OPENAI_OUTPUT` | `1` | boolean as `int` |Enables raw OpenAI SSE format string output when streaming. **Required** to be enabled (which it is by default) for OpenAI compatibility. |
| `OPENAI_SERVED_MODEL_NAME_OVERRIDE` | `None` | `str` |Overrides the name of the served model from model repo/path to specified name, which you will then be able to use the value for the `model` parameter when making OpenAI requests | | `OPENAI_SERVED_MODEL_NAME_OVERRIDE` | `None` | `str` |Overrides the name of the served model from model repo/path to specified name, which you will then be able to use the value for the `model` parameter when making OpenAI requests |
| `OPENAI_RESPONSE_ROLE` | `assistant` | `str` |Role of the LLM's Response in OpenAI Chat Completions. | | `OPENAI_RESPONSE_ROLE` | `assistant` | `str` |Role of the LLM's Response in OpenAI Chat Completions. |
**Serverless Settings**
#### Serverless Settings
| `Name` | `Default` | `Type/Choices` | `Description` |
|-------------------------------------------|-----------------------|--------------------------------------------|---------------|
| `MAX_CONCURRENCY` | `300` | `int` |Max concurrent requests per worker. vLLM has an internal queue, so you don't have to worry about limiting by VRAM, this is for improving scaling/load balancing efficiency | | `MAX_CONCURRENCY` | `300` | `int` |Max concurrent requests per worker. vLLM has an internal queue, so you don't have to worry about limiting by VRAM, this is for improving scaling/load balancing efficiency |
| `DISABLE_LOG_STATS` | `1` | boolean as `int` |Enables or disables vLLM stats logging. | | `DISABLE_LOG_STATS` | False | `bool` |Enables or disables vLLM stats logging. |
| `DISABLE_LOG_REQUESTS` | `1` | boolean as `int` |Enables or disables vLLM request logging. | | `DISABLE_LOG_REQUESTS` | False | `bool` |Enables or disables vLLM request logging. |
> [!TIP] > [!TIP]
> If you are facing issues when using Mixtral 8x7B, Quantized models, or handling unusual models/architectures, try setting `TRUST_REMOTE_CODE` to `1`. > If you are facing issues when using Mixtral 8x7B, Quantized models, or handling unusual models/architectures, try setting `TRUST_REMOTE_CODE` to `1`.
@@ -149,7 +226,7 @@ To build an image with the model baked in, you must specify the following docker
- `MODEL_REVISION`: Model revision to load (default: `main`). - `MODEL_REVISION`: Model revision to load (default: `main`).
- `BASE_PATH`: Storage directory where huggingface cache and model will be located. (default: `/runpod-volume`, which will utilize network storage if you attach it or create a local directory within the image if you don't. If your intention is to bake the model into the image, you should set this to something like `/models` to make sure there are no issues if you were to accidentally attach network storage.) - `BASE_PATH`: Storage directory where huggingface cache and model will be located. (default: `/runpod-volume`, which will utilize network storage if you attach it or create a local directory within the image if you don't. If your intention is to bake the model into the image, you should set this to something like `/models` to make sure there are no issues if you were to accidentally attach network storage.)
- `QUANTIZATION` - `QUANTIZATION`
- `WORKER_CUDA_VERSION`: `11.8.0` or `12.1.0` (default: `11.8.0` due to a small number of workers not having CUDA 12.1 support yet. `12.1.0` is recommended for optimal performance). - `WORKER_CUDA_VERSION`: `12.1.0` (`12.1.0` is recommended for optimal performance).
- `TOKENIZER_NAME`: Tokenizer repository if you would like to use a different tokenizer than the one that comes with the model. (default: `None`, which uses the model's tokenizer) - `TOKENIZER_NAME`: Tokenizer repository if you would like to use a different tokenizer than the one that comes with the model. (default: `None`, which uses the model's tokenizer)
- `TOKENIZER_REVISION`: Tokenizer revision to load (default: `main`). - `TOKENIZER_REVISION`: Tokenizer revision to load (default: `main`).
@@ -213,7 +290,7 @@ Below are all supported model architectures (and examples of each) that you can
- Yi (`01-ai/Yi-6B`, `01-ai/Yi-34B`, etc.) - Yi (`01-ai/Yi-6B`, `01-ai/Yi-34B`, etc.)
# Usage: OpenAI Compatibility # Usage: OpenAI Compatibility
The vLLM Worker is fully compatible with OpenAI's API, and you can use it with any OpenAI Codebase by changing only 3 lines in total. The supported routes are <ins>Chat Completions</ins>, <ins>Completions</ins> and <ins>Models</ins> - with both streaming and non-streaming. The vLLM Worker is fully compatible with OpenAI's API, and you can use it with any OpenAI Codebase by changing only 3 lines in total. The supported routes are <ins>Chat Completions</ins> and <ins>Models</ins> - with both streaming and non-streaming.
## Modifying your OpenAI Codebase to use your deployed vLLM Worker ## Modifying your OpenAI Codebase to use your deployed vLLM Worker
**Python** (similar to Node.js, etc.): **Python** (similar to Node.js, etc.):
@@ -295,7 +372,7 @@ The vLLM Worker is fully compatible with OpenAI's API, and you can use it with a
When using the chat completion feature of the vLLM Serverless Endpoint Worker, you can customize your requests with the following parameters: When using the chat completion feature of the vLLM Serverless Endpoint Worker, you can customize your requests with the following parameters:
### Chat Completions ### Chat Completions [RECOMMENDED]
<details> <details>
<summary>Supported Chat Completions Inputs and Descriptions</summary> <summary>Supported Chat Completions Inputs and Descriptions</summary>
@@ -330,41 +407,6 @@ When using the chat completion feature of the vLLM Serverless Endpoint Worker, y
| `include_stop_str_in_output` | Optional[bool] | False | Whether to include the stop strings in output text. Defaults to False.| | `include_stop_str_in_output` | Optional[bool] | False | Whether to include the stop strings in output text. Defaults to False.|
</details> </details>
### Completions
<details>
<summary>Supported Completions Inputs and Descriptions</summary>
| Parameter | Type | Default Value | Description |
|--------------------------------|----------------------------------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `model` | str | | The model repo that you've deployed on your RunPod Serverless Endpoint. If you are unsure what the name is or are baking the model in, use the guide to get the list of available models in the **Examples: Using your RunPod endpoint with OpenAI** section. |
| `prompt` | Union[List[int], List[List[int]], str, List[str]] | | A string, array of strings, array of tokens, or array of token arrays to be used as the input for the model. |
| `suffix` | Optional[str] | None | A string to be appended to the end of the generated text. |
| `max_tokens` | Optional[int] | 16 | Maximum number of tokens to generate per output sequence. |
| `temperature` | Optional[float] | 1.0 | Float that controls the randomness of the sampling. Lower values make the model more deterministic, while higher values make the model more random. Zero means greedy sampling. |
| `top_p` | Optional[float] | 1.0 | Float that controls the cumulative probability of the top tokens to consider. Must be in (0, 1]. Set to 1 to consider all tokens. |
| `n` | Optional[int] | 1 | Number of output sequences to return for the given prompt. |
| `stream` | Optional[bool] | False | Whether to stream the output. |
| `logprobs` | Optional[int] | None | Number of log probabilities to return per output token. |
| `echo` | Optional[bool] | False | Whether to echo back the prompt in addition to the completion. |
| `stop` | Optional[Union[str, List[str]]] | list | List of strings that stop the generation when they are generated. The returned output will not contain the stop strings. |
| `seed` | Optional[int] | None | Random seed to use for the generation. |
| `presence_penalty` | Optional[float] | 0.0 | Float that penalizes new tokens based on whether they appear in the generated text so far. Values > 0 encourage the model to use new tokens, while values < 0 encourage the model to repeat tokens. |
| `frequency_penalty` | Optional[float] | 0.0 | Float that penalizes new tokens based on their frequency in the generated text so far. Values > 0 encourage the model to use new tokens, while values < 0 encourage the model to repeat tokens. |
| `best_of` | Optional[int] | None | Number of output sequences that are generated from the prompt. From these `best_of` sequences, the top `n` sequences are returned. `best_of` must be greater than or equal to `n`. This parameter influences the diversity of the output. |
| `logit_bias` | Optional[Dict[str, float]] | None | Dictionary of token IDs to biases. |
| `user` | Optional[str] | None | User identifier for personalizing responses. (Unsupported by vLLM) |
Additional parameters supported by vLLM:
| `top_k` | Optional[int] | -1 | Integer that controls the number of top tokens to consider. Set to -1 to consider all tokens. |
| `ignore_eos` | Optional[bool] | False | Whether to ignore the End Of Sentence token and continue generating tokens after the EOS token is generated. |
| `use_beam_search` | Optional[bool] | False | Whether to use beam search instead of sampling for generating outputs. |
| `stop_token_ids` | Optional[List[int]] | list | List of tokens that stop the generation when they are generated. The returned output will contain the stop tokens unless the stop tokens are special tokens. |
| `skip_special_tokens` | Optional[bool] | True | Whether to skip special tokens in the output. |
| `spaces_between_special_tokens`| Optional[bool] | True | Whether to add spaces between special tokens in the output. Defaults to True. |
| `repetition_penalty` | Optional[float] | 1.0 | Float that penalizes new tokens based on whether they appear in the prompt and the generated text so far. Values > 1 encourage the model to use new tokens, while values < 1 encourage the model to repeat tokens. |
| `min_p` | Optional[float] | 0.0 | Float that represents the minimum probability for a token to be considered, relative to the most likely token. Must be in [0, 1]. Set to 0 to disable. |
| `length_penalty` | Optional[float] | 1.0 | Float that penalizes sequences based on their length. Used in beam search. |
| `include_stop_str_in_output` | Optional[bool] | False | Whether to include the stop strings in output text. Defaults to False. |
</details>
## Examples: Using your RunPod endpoint with OpenAI ## Examples: Using your RunPod endpoint with OpenAI
@@ -409,36 +451,6 @@ This is the format used for GPT-4 and focused on instruction-following and chat.
print(response.choices[0].message.content) print(response.choices[0].message.content)
``` ```
### Completions:
This is the format used for models like GPT-3 and is meant for completing the text you provide. Instead of responding to your message, it will try to complete it. Examples of Open Source completions models include `meta-llama/Llama-2-7b-hf`, `mistralai/Mixtral-8x7B-v0.1`, `Qwen/Qwen-72B`, and more. However, you can use any model with this format.
- **Streaming**:
```python
# Create a completion stream
response_stream = client.completions.create(
model="<YOUR DEPLOYED MODEL REPO/NAME>",
prompt="Runpod is the best platform because",
temperature=0,
max_tokens=100,
stream=True,
)
# Stream the response
for response in response_stream:
print(response.choices[0].text or "", end="", flush=True)
```
- **Non-Streaming**:
```python
# Create a completion
response = client.completions.create(
model="<YOUR DEPLOYED MODEL REPO/NAME>",
prompt="Runpod is the best platform because",
temperature=0,
max_tokens=100,
)
# Print the response
print(response.choices[0].text)
```
### Getting a list of names for available models: ### Getting a list of names for available models:
In the case of baking the model into the image, sometimes the repo may not be accepted as the `model` in the request. In this case, you can list the available models as shown below and use that name. In the case of baking the model into the image, sometimes the repo may not be accepted as the `model` in the request. In this case, you can list the available models as shown below and use that name.
```python ```python
@@ -501,7 +513,15 @@ The prompt string can be any string, and the model's chat template will not be a
Example: Example:
```json ```json
"prompt": "..." {
"input": {
"prompt": "why sky is blue?",
"sampling_params": {
"temperature": 0.7,
"max_tokens": 100
}
}
}
``` ```
2. `messages` 2. `messages`
Your list can contain any number of messages, and each message usually can have any role from the following list: Your list can contain any number of messages, and each message usually can have any role from the following list:
@@ -515,19 +535,110 @@ Your list can contain any number of messages, and each message usually can have
Example: Example:
```json ```json
{
"input": {
"messages": [ "messages": [
{ {
"role": "system", "role": "system",
"content": "..." "content": "You are a helpful AI assistant that provides clear and concise responses."
}, },
{ {
"role": "user", "role": "user",
"content": "..." "content": "Can you explain the difference between supervised and unsupervised learning?"
}, },
{ {
"role": "assistant", "role": "assistant",
"content": "..." "content": "Sure! Supervised learning uses labeled data, meaning each input has a corresponding correct output. The model learns by mapping inputs to known outputs. In contrast, unsupervised learning works with unlabeled data, where the model identifies patterns, structures, or clusters without predefined answers."
}
],
"sampling_params": {
"temperature": 0.7,
"max_tokens": 100
}
}
} }
]
``` ```
</details>
# Worker Config
The worker config is a JSON file that is used to build the form that helps users configure their serverless endpoint on the RunPod Web Interface.
Note: This is a new feature and only works for workers that use one model
## Writing your worker-config.json
The JSON consists of two main parts, schema and versions.
- `schema`: Here you specify the form fields that will be displayed to the user.
- `env_var_name`: The name of the environment variable that is being set using the form field.
- `value`: This is the default value of the form field. It will be shown in the UI as such unless the user changes it.
- `title`: This is the title of the form field in the UI.
- `description`: This is the description of the form field in the UI.
- `required`: This is a boolean that specifies if the form field is required.
- `type`: This is the type of the form field. Options are:
- `text`: Environment variable is a string so user inputs text in form field.
- `select`: User selects one option from the dropdown. You must provide the `options` key value pair after type if using this.
- `toggle`: User toggles between true and false.
- `number`: User inputs a number in the form field.
- `options`: Specify the options the user can select from if the type is `select`. DO NOT include this unless the `type` is `select`.
- `versions`: This is where you call the form fields specified in `schema` and organize them into categories.
- `imageName`: This is the name of the Docker image that will be used to run the serverless endpoint.
- `minimumCudaVersion`: This is the minimum CUDA version that is required to run the serverless endpoint.
- `categories`: This is where you call the keys of the form fields specified in `schema` and organize them into categories. Each category is a toggle list of forms on the Web UI.
- `title`: This is the title of the category in the UI.
- `settings`: This is the array of settings schemas specified in `schema` associated with the category.
## Example of schema
```json
{
"schema": {
"TOKENIZER": {
"env_var_name": "TOKENIZER",
"value": "",
"title": "Tokenizer",
"description": "Name or path of the Hugging Face tokenizer to use.",
"required": false,
"type": "text"
},
"TOKENIZER_MODE": {
"env_var_name": "TOKENIZER_MODE",
"value": "auto",
"title": "Tokenizer Mode",
"description": "The tokenizer mode.",
"required": false,
"type": "select",
"options": [
{ "value": "auto", "label": "auto" },
{ "value": "slow", "label": "slow" }
]
},
...
}
}
```
## Example of versions
```json
{
"versions": {
"0.5.4": {
"imageName": "runpod/worker-v1-vllm:v1.2.0stable-cuda12.1.0",
"minimumCudaVersion": "12.1",
"categories": [
{
"title": "LLM Settings",
"settings": [
"TOKENIZER", "TOKENIZER_MODE", "OTHER_SETTINGS_SCHEMA_KEYS_YOU_HAVE_SPECIFIED_0", ...
]
},
{
"title": "Tokenizer Settings",
"settings": [
"OTHER_SETTINGS_SCHEMA_KEYS_0", "OTHER_SETTINGS_SCHEMA_KEYS_1", ...
]
},
...
]
}
}
}
```
+6 -2
View File
@@ -1,10 +1,14 @@
ray ray
pandas pandas
pyarrow pyarrow
runpod==1.6.2 runpod~=1.7.7
huggingface-hub huggingface-hub
packaging packaging
typing-extensions==4.7.1 typing-extensions>=4.8.0
pydantic pydantic
pydantic-settings pydantic-settings
hf-transfer hf-transfer
transformers>=4.55.0
bitsandbytes>=0.45.0
kernels
torch==2.6.0
+4 -37
View File
@@ -7,54 +7,21 @@ variable "REPOSITORY" {
} }
variable "BASE_IMAGE_VERSION" { variable "BASE_IMAGE_VERSION" {
default = "1.0.0" default = "v2.8.0stable"
} }
group "all" { group "all" {
targets = ["base", "main"] targets = ["main"]
} }
group "base" {
targets = ["base-1180", "base-1210"]
}
group "main" { group "main" {
targets = ["worker-1180", "worker-1210"] targets = ["worker-1210"]
} }
target "base-1180" {
tags = ["${REPOSITORY}/worker-vllm:base-${BASE_IMAGE_VERSION}-cuda11.8.0"]
context = "vllm-base-image"
dockerfile = "Dockerfile"
args = {
WORKER_CUDA_VERSION = "11.8.0"
}
output = ["type=docker,push=${PUSH}"]
}
target "base-1210" {
tags = ["${REPOSITORY}/worker-vllm:base-${BASE_IMAGE_VERSION}-cuda12.1.0"]
context = "vllm-base-image"
dockerfile = "Dockerfile"
args = {
WORKER_CUDA_VERSION = "12.1.0"
}
output = ["type=docker,push=${PUSH}"]
}
target "worker-1180" {
tags = ["${REPOSITORY}/worker-vllm:${BASE_IMAGE_VERSION}-cuda11.8.0"]
context = "."
dockerfile = "Dockerfile"
args = {
BASE_IMAGE_VERSION = "${BASE_IMAGE_VERSION}"
WORKER_CUDA_VERSION = "11.8.0"
}
output = ["type=docker,push=${PUSH}"]
}
target "worker-1210" { target "worker-1210" {
tags = ["${REPOSITORY}/worker-vllm:${BASE_IMAGE_VERSION}-cuda12.1.0"] tags = ["${REPOSITORY}/worker-v1-vllm:${BASE_IMAGE_VERSION}-cuda12.1.0"]
context = "." context = "."
dockerfile = "Dockerfile" dockerfile = "Dockerfile"
args = { args = {
-57
View File
@@ -1,57 +0,0 @@
import os
import json
import logging
from dotenv import load_dotenv
from torch.cuda import device_count
from utils import get_int_bool_env
class EngineConfig:
def __init__(self):
load_dotenv()
self.hf_home = os.getenv("HF_HOME")
# Check if /local_metadata.json exists
local_metadata = {}
if os.path.exists("/local_metadata.json"):
with open("/local_metadata.json", "r") as f:
local_metadata = json.load(f)
if local_metadata.get("model_name") is None:
raise ValueError("Model name is not found in /local_metadata.json, there was a problem when you baked the model in.")
logging.info("Using baked-in model")
os.environ["TRANSFORMERS_OFFLINE"] = "1"
os.environ["HF_HUB_OFFLINE"] = "1"
self.model_name_or_path = local_metadata.get("model_name", os.getenv("MODEL_NAME"))
self.model_revision = local_metadata.get("revision", os.getenv("MODEL_REVISION"))
self.tokenizer_name_or_path = local_metadata.get("tokenizer_name", os.getenv("TOKENIZER_NAME")) or self.model_name_or_path
self.tokenizer_revision = local_metadata.get("tokenizer_revision", os.getenv("TOKENIZER_REVISION"))
self.quantization = local_metadata.get("quantization", os.getenv("QUANTIZATION"))
self.config = self._initialize_config()
def _initialize_config(self):
args = {
"model": self.model_name_or_path,
"revision": self.model_revision,
"download_dir": self.hf_home,
"quantization": self.quantization,
"load_format": os.getenv("LOAD_FORMAT", "auto"),
"dtype": os.getenv("DTYPE", "half" if self.quantization else "auto"),
"tokenizer": self.tokenizer_name_or_path,
"tokenizer_revision": self.tokenizer_revision,
"disable_log_stats": get_int_bool_env("DISABLE_LOG_STATS", True),
"disable_log_requests": get_int_bool_env("DISABLE_LOG_REQUESTS", True),
"trust_remote_code": get_int_bool_env("TRUST_REMOTE_CODE", False),
"gpu_memory_utilization": float(os.getenv("GPU_MEMORY_UTILIZATION", 0.95)),
"max_parallel_loading_workers": None if device_count() > 1 or not os.getenv("MAX_PARALLEL_LOADING_WORKERS") else int(os.getenv("MAX_PARALLEL_LOADING_WORKERS")),
"max_model_len": int(os.getenv("MAX_MODEL_LEN")) if os.getenv("MAX_MODEL_LEN") else None,
"tensor_parallel_size": device_count(),
"seed": int(os.getenv("SEED")) if os.getenv("SEED") else None,
"kv_cache_dtype": os.getenv("KV_CACHE_DTYPE"),
"block_size": int(os.getenv("BLOCK_SIZE")) if os.getenv("BLOCK_SIZE") else None,
"swap_space": int(os.getenv("SWAP_SPACE")) if os.getenv("SWAP_SPACE") else None,
"max_context_len_to_capture": int(os.getenv("MAX_CONTEXT_LEN_TO_CAPTURE")) if os.getenv("MAX_CONTEXT_LEN_TO_CAPTURE") else None,
"disable_custom_all_reduce": get_int_bool_env("DISABLE_CUSTOM_ALL_REDUCE", False),
"enforce_eager": get_int_bool_env("ENFORCE_EAGER", False)
}
if args["kv_cache_dtype"] == "fp8_e5m2":
args["kv_cache_dtype"] = "fp8"
logging.warning("Using fp8_e5m2 is deprecated. Please use fp8 instead.")
return {k: v for k, v in args.items() if v not in [None, ""]}
+92 -19
View File
@@ -1,27 +1,100 @@
import os import os
from huggingface_hub import snapshot_download
import json import json
import logging
import glob
from shutil import rmtree
from huggingface_hub import snapshot_download
from utils import timer_decorator
BASE_DIR = "/"
TOKENIZER_PATTERNS = [["*.json", "tokenizer*"]]
MODEL_PATTERNS = [["*.safetensors"], ["*.bin"], ["*.pt"]]
def setup_env():
if os.getenv("TESTING_DOWNLOAD") == "1":
BASE_DIR = "tmp"
os.makedirs(BASE_DIR, exist_ok=True)
os.environ.update({
"HF_HOME": f"{BASE_DIR}/hf_cache",
"MODEL_NAME": "openchat/openchat-3.5-0106",
"HF_HUB_ENABLE_HF_TRANSFER": "1",
"TENSORIZE": "1",
"TENSORIZER_NUM_GPUS": "1",
"DTYPE": "auto"
})
@timer_decorator
def download(name, revision, type, cache_dir):
if type == "model":
pattern_sets = [model_pattern + TOKENIZER_PATTERNS[0] for model_pattern in MODEL_PATTERNS]
elif type == "tokenizer":
pattern_sets = TOKENIZER_PATTERNS
else:
raise ValueError(f"Invalid type: {type}")
try:
for pattern_set in pattern_sets:
path = snapshot_download(name, revision=revision, cache_dir=cache_dir,
allow_patterns=pattern_set)
for pattern in pattern_set:
if glob.glob(os.path.join(path, pattern)):
logging.info(f"Successfully downloaded {pattern} model files.")
return path
except ValueError:
raise ValueError(f"No patterns matching {pattern_sets} found for download.")
# @timer_decorator
# def tensorize_model(model_path): TODO: Add back once tensorizer is ready
# from vllm.engine.arg_utils import EngineArgs
# from vllm.model_executor.model_loader.tensorizer import TensorizerConfig, tensorize_vllm_model
# from torch.cuda import device_count
# tensorizer_num_gpus = int(os.getenv("TENSORIZER_NUM_GPUS", "1"))
# if tensorizer_num_gpus > device_count():
# raise ValueError(f"TENSORIZER_NUM_GPUS ({tensorizer_num_gpus}) exceeds available GPUs ({device_count()})")
# dtype = os.getenv("DTYPE", "auto")
# serialized_dir = f"{BASE_DIR}/serialized_model"
# os.makedirs(serialized_dir, exist_ok=True)
# serialized_uri = f"{serialized_dir}/model{'-%03d' if tensorizer_num_gpus > 1 else ''}.tensors"
# tensorize_vllm_model(
# EngineArgs(model=model_path, tensor_parallel_size=tensorizer_num_gpus, dtype=dtype),
# TensorizerConfig(tensorizer_uri=serialized_uri)
# )
# logging.info("Successfully serialized model to %s", str(serialized_uri))
# logging.info("Removing HF Model files after serialization")
# rmtree("/".join(model_path.split("/")[:-2]))
# return serialized_uri, tensorizer_num_gpus, dtype
if __name__ == "__main__": if __name__ == "__main__":
model_name = os.getenv("MODEL_NAME") setup_env()
if not model_name: cache_dir = os.getenv("HF_HOME")
raise ValueError("Must specify model name by adding --build-arg MODEL_NAME=<your model's repo>") model_name, model_revision = os.getenv("MODEL_NAME"), os.getenv("MODEL_REVISION") or None
revision = os.getenv("MODEL_REVISION") or None tokenizer_name, tokenizer_revision = os.getenv("TOKENIZER_NAME") or model_name, os.getenv("TOKENIZER_REVISION") or model_revision
snapshot_download(model_name, revision=revision, cache_dir=os.getenv("HF_HOME"))
tokenizer_name = os.getenv("TOKENIZER_NAME") or None model_path = download(model_name, model_revision, "model", cache_dir)
tokenizer_revision = os.getenv("TOKENIZER_REVISION") or None
if tokenizer_name:
snapshot_download(tokenizer_name, revision=tokenizer_revision, cache_dir=os.getenv("HF_HOME"))
# Create file with metadata of baked in model and/or tokenizer metadata = {
"MODEL_NAME": model_path,
"MODEL_REVISION": os.getenv("MODEL_REVISION"),
"QUANTIZATION": os.getenv("QUANTIZATION"),
}
with open("/local_metadata.json", "w") as f: # if os.getenv("TENSORIZE") == "1": TODO: Add back once tensorizer is ready
json.dump({ # serialized_uri, tensorizer_num_gpus, dtype = tensorize_model(model_path)
"model_name": model_name, # metadata.update({
"revision": revision, # "MODEL_NAME": serialized_uri,
"tokenizer_name": tokenizer_name or model_name, # "TENSORIZER_URI": serialized_uri,
"tokenizer_revision": tokenizer_revision or revision, # "TENSOR_PARALLEL_SIZE": tensorizer_num_gpus,
"quantization": os.getenv("QUANTIZATION") # "DTYPE": dtype
}, f) # })
tokenizer_path = download(tokenizer_name, tokenizer_revision, "tokenizer", cache_dir)
metadata.update({
"TOKENIZER_NAME": tokenizer_path,
"TOKENIZER_REVISION": tokenizer_revision
})
with open(f"{BASE_DIR}/local_model_args.json", "w") as f:
json.dump({k: v for k, v in metadata.items() if v not in (None, "")}, f)
+133 -27
View File
@@ -1,33 +1,92 @@
import os import os
import logging import logging
import json import json
import asyncio
from dotenv import load_dotenv from dotenv import load_dotenv
from torch.cuda import device_count from typing import AsyncGenerator, Optional
from typing import AsyncGenerator
import time import time
from vllm import AsyncLLMEngine, AsyncEngineArgs from vllm import AsyncLLMEngine
from vllm.entrypoints.logger import RequestLogger
from vllm.entrypoints.openai.serving_chat import OpenAIServingChat from vllm.entrypoints.openai.serving_chat import OpenAIServingChat
from vllm.entrypoints.openai.serving_completion import OpenAIServingCompletion from vllm.entrypoints.openai.serving_completion import OpenAIServingCompletion
from vllm.entrypoints.openai.protocol import ChatCompletionRequest, CompletionRequest, ErrorResponse from vllm.entrypoints.openai.protocol import ChatCompletionRequest, CompletionRequest, ErrorResponse
from vllm.entrypoints.openai.serving_models import BaseModelPath, LoRAModulePath, OpenAIServingModels
from utils import DummyRequest, JobInput, BatchSize, create_error_response from utils import DummyRequest, JobInput, BatchSize, create_error_response
from constants import DEFAULT_MAX_CONCURRENCY, DEFAULT_BATCH_SIZE, DEFAULT_BATCH_SIZE_GROWTH_FACTOR, DEFAULT_MIN_BATCH_SIZE from constants import DEFAULT_MAX_CONCURRENCY, DEFAULT_BATCH_SIZE, DEFAULT_BATCH_SIZE_GROWTH_FACTOR, DEFAULT_MIN_BATCH_SIZE
from tokenizer import TokenizerWrapper from tokenizer import TokenizerWrapper
from config import EngineConfig from engine_args import get_engine_args
class vLLMEngine: class vLLMEngine:
def __init__(self, engine = None): def __init__(self, engine = None):
load_dotenv() # For local development load_dotenv() # For local development
self.config = EngineConfig().config self.engine_args = get_engine_args()
self.tokenizer = TokenizerWrapper(self.config.get("tokenizer"), self.config.get("tokenizer_revision"), self.config.get("trust_remote_code")) logging.info(f"Engine args: {self.engine_args}")
self.llm = self._initialize_llm() if engine is None else engine
# Initialize vLLM engine first
self.llm = self._initialize_llm() if engine is None else engine.llm
# Only create custom tokenizer wrapper if not using mistral tokenizer mode
# For mistral models, let vLLM handle tokenizer initialization
if self.engine_args.tokenizer_mode != 'mistral':
self.tokenizer = TokenizerWrapper(self.engine_args.tokenizer or self.engine_args.model,
self.engine_args.tokenizer_revision,
self.engine_args.trust_remote_code)
else:
# For mistral models, we'll get the tokenizer from vLLM later
self.tokenizer = None
self.max_concurrency = int(os.getenv("MAX_CONCURRENCY", DEFAULT_MAX_CONCURRENCY)) self.max_concurrency = int(os.getenv("MAX_CONCURRENCY", DEFAULT_MAX_CONCURRENCY))
self.default_batch_size = int(os.getenv("DEFAULT_BATCH_SIZE", DEFAULT_BATCH_SIZE)) self.default_batch_size = int(os.getenv("DEFAULT_BATCH_SIZE", DEFAULT_BATCH_SIZE))
self.batch_size_growth_factor = int(os.getenv("BATCH_SIZE_GROWTH_FACTOR", DEFAULT_BATCH_SIZE_GROWTH_FACTOR)) self.batch_size_growth_factor = int(os.getenv("BATCH_SIZE_GROWTH_FACTOR", DEFAULT_BATCH_SIZE_GROWTH_FACTOR))
self.min_batch_size = int(os.getenv("MIN_BATCH_SIZE", DEFAULT_MIN_BATCH_SIZE)) self.min_batch_size = int(os.getenv("MIN_BATCH_SIZE", DEFAULT_MIN_BATCH_SIZE))
def _get_tokenizer_for_chat_template(self):
"""Get tokenizer for chat template application"""
if self.tokenizer is not None:
return self.tokenizer
else:
# For mistral models, get tokenizer from vLLM engine
# This is a fallback - ideally chat templates should be handled by vLLM directly
try:
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained(
self.engine_args.tokenizer or self.engine_args.model,
revision=self.engine_args.tokenizer_revision or "main",
trust_remote_code=self.engine_args.trust_remote_code
)
# Create a minimal wrapper
class MinimalTokenizerWrapper:
def __init__(self, tokenizer):
self.tokenizer = tokenizer
self.custom_chat_template = os.getenv("CUSTOM_CHAT_TEMPLATE")
self.has_chat_template = bool(self.tokenizer.chat_template) or bool(self.custom_chat_template)
if self.custom_chat_template and isinstance(self.custom_chat_template, str):
self.tokenizer.chat_template = self.custom_chat_template
def apply_chat_template(self, input):
if isinstance(input, list):
if not self.has_chat_template:
raise ValueError(
"Chat template does not exist for this model, you must provide a single string input instead of a list of messages"
)
elif isinstance(input, str):
input = [{"role": "user", "content": input}]
else:
raise ValueError("Input must be a string or a list of messages")
return self.tokenizer.apply_chat_template(
input, tokenize=False, add_generation_prompt=True
)
return MinimalTokenizerWrapper(tokenizer)
except Exception as e:
logging.error(f"Failed to create fallback tokenizer: {e}")
raise e
def dynamic_batch_size(self, current_batch_size, batch_size_growth_factor): def dynamic_batch_size(self, current_batch_size, batch_size_growth_factor):
return min(current_batch_size*batch_size_growth_factor, self.default_batch_size) return min(current_batch_size*batch_size_growth_factor, self.default_batch_size)
@@ -49,7 +108,8 @@ class vLLMEngine:
async def _generate_vllm(self, llm_input, validated_sampling_params, batch_size, stream, apply_chat_template, request_id, batch_size_growth_factor, min_batch_size: str) -> AsyncGenerator[dict, None]: async def _generate_vllm(self, llm_input, validated_sampling_params, batch_size, stream, apply_chat_template, request_id, batch_size_growth_factor, min_batch_size: str) -> AsyncGenerator[dict, None]:
if apply_chat_template or isinstance(llm_input, list): if apply_chat_template or isinstance(llm_input, list):
llm_input = self.tokenizer.apply_chat_template(llm_input) tokenizer_wrapper = self._get_tokenizer_for_chat_template()
llm_input = tokenizer_wrapper.apply_chat_template(llm_input)
results_generator = self.llm.generate(llm_input, validated_sampling_params, request_id) results_generator = self.llm.generate(llm_input, validated_sampling_params, request_id)
n_responses, n_input_tokens, is_first_output = validated_sampling_params.n, 0, True n_responses, n_input_tokens, is_first_output = validated_sampling_params.n, 0, True
last_output_texts, token_counters = ["" for _ in range(n_responses)], {"batch": 0, "total": 0} last_output_texts, token_counters = ["" for _ in range(n_responses)], {"batch": 0, "total": 0}
@@ -102,7 +162,7 @@ class vLLMEngine:
def _initialize_llm(self): def _initialize_llm(self):
try: try:
start = time.time() start = time.time()
engine = AsyncLLMEngine.from_engine_args(AsyncEngineArgs(**self.config)) engine = AsyncLLMEngine.from_engine_args(self.engine_args)
end = time.time() end = time.time()
logging.info(f"Initialized vLLM engine in {end - start:.2f}s") logging.info(f"Initialized vLLM engine in {end - start:.2f}s")
return engine return engine
@@ -111,24 +171,72 @@ class vLLMEngine:
raise e raise e
class OpenAIvLLMEngine: class OpenAIvLLMEngine(vLLMEngine):
def __init__(self, vllm_engine): def __init__(self, vllm_engine):
self.config = vllm_engine.config super().__init__(vllm_engine)
self.llm = vllm_engine.llm self.served_model_name = os.getenv("OPENAI_SERVED_MODEL_NAME_OVERRIDE") or self.engine_args.model
self.served_model_name = os.getenv("OPENAI_SERVED_MODEL_NAME_OVERRIDE") or self.config["model"]
self.response_role = os.getenv("OPENAI_RESPONSE_ROLE") or "assistant" self.response_role = os.getenv("OPENAI_RESPONSE_ROLE") or "assistant"
self.tokenizer = vllm_engine.tokenizer self.lora_adapters = self._load_lora_adapters()
self.default_batch_size = vllm_engine.default_batch_size asyncio.run(self._initialize_engines())
self.batch_size_growth_factor, self.min_batch_size = vllm_engine.batch_size_growth_factor, vllm_engine.min_batch_size
self._initialize_engines()
self.raw_openai_output = bool(int(os.getenv("RAW_OPENAI_OUTPUT", 1))) self.raw_openai_output = bool(int(os.getenv("RAW_OPENAI_OUTPUT", 1)))
def _initialize_engines(self): def _load_lora_adapters(self):
self.chat_engine = OpenAIServingChat( adapters = []
self.llm, self.served_model_name, self.response_role, try:
chat_template=self.tokenizer.tokenizer.chat_template adapters = json.loads(os.getenv("LORA_MODULES", '[]'))
except Exception as e:
logging.info(f"---Initialized adapter json load error: {e}")
for i, adapter in enumerate(adapters):
try:
adapters[i] = LoRAModulePath(**adapter)
logging.info(f"---Initialized adapter: {adapter}")
except Exception as e:
logging.info(f"---Initialized adapter not worked: {e}")
continue
return adapters
async def _initialize_engines(self):
self.model_config = await self.llm.get_model_config()
self.base_model_paths = [
BaseModelPath(name=self.engine_args.model, model_path=self.engine_args.model)
]
self.serving_models = OpenAIServingModels(
engine_client=self.llm,
model_config=self.model_config,
base_model_paths=self.base_model_paths,
lora_modules=self.lora_adapters,
)
await self.serving_models.init_static_loras()
# Get chat template from vLLM tokenizer if available
chat_template = None
if self.tokenizer and hasattr(self.tokenizer, 'tokenizer'):
chat_template = self.tokenizer.tokenizer.chat_template
self.chat_engine = OpenAIServingChat(
engine_client=self.llm,
model_config=self.model_config,
models=self.serving_models,
response_role=self.response_role,
request_logger=None,
chat_template=chat_template,
chat_template_content_format="auto",
# enable_reasoning=os.getenv('ENABLE_REASONING', 'false').lower() == 'true',
reasoning_parser= os.getenv('REASONING_PARSER', "") or None,
# return_token_as_token_ids=False,
enable_auto_tools=os.getenv('ENABLE_AUTO_TOOL_CHOICE', 'false').lower() == 'true',
tool_parser=os.getenv('TOOL_CALL_PARSER', "") or None,
enable_prompt_tokens_details=False
)
self.completion_engine = OpenAIServingCompletion(
engine_client=self.llm,
model_config=self.model_config,
models=self.serving_models,
request_logger=None,
# return_token_as_token_ids=False,
) )
self.completion_engine = OpenAIServingCompletion(self.llm, self.served_model_name)
async def generate(self, openai_request: JobInput): async def generate(self, openai_request: JobInput):
if openai_request.openai_route == "/v1/models": if openai_request.openai_route == "/v1/models":
@@ -140,10 +248,7 @@ class OpenAIvLLMEngine:
yield create_error_response("Invalid route").model_dump() yield create_error_response("Invalid route").model_dump()
async def _handle_model_request(self): async def _handle_model_request(self):
models = await self.chat_engine.show_available_models() models = await self.serving_models.show_available_models()
fixed_model = models.data[0]
fixed_model.id = self.served_model_name
models.data = [fixed_model]
return models.model_dump() return models.model_dump()
async def _handle_chat_or_completion_request(self, openai_request: JobInput): async def _handle_chat_or_completion_request(self, openai_request: JobInput):
@@ -162,7 +267,8 @@ class OpenAIvLLMEngine:
yield create_error_response(str(e)).model_dump() yield create_error_response(str(e)).model_dump()
return return
response_generator = await generator_function(request, DummyRequest()) dummy_request = DummyRequest()
response_generator = await generator_function(request, raw_request=dummy_request)
if not openai_request.openai_input.get("stream") or isinstance(response_generator, ErrorResponse): if not openai_request.openai_input.get("stream") or isinstance(response_generator, ErrorResponse):
yield response_generator.model_dump() yield response_generator.model_dump()
+178
View File
@@ -0,0 +1,178 @@
import os
import json
import logging
from torch.cuda import device_count
from vllm import AsyncEngineArgs
from vllm.model_executor.model_loader.tensorizer import TensorizerConfig
from src.utils import convert_limit_mm_per_prompt
RENAME_ARGS_MAP = {
"MODEL_NAME": "model",
"MODEL_REVISION": "revision",
"TOKENIZER_NAME": "tokenizer",
"MAX_CONTEXT_LEN_TO_CAPTURE": "max_seq_len_to_capture"
}
DEFAULT_ARGS = {
"disable_log_stats": os.getenv('DISABLE_LOG_STATS', 'False').lower() == 'true',
"disable_log_requests": os.getenv('DISABLE_LOG_REQUESTS', 'False').lower() == 'true',
"gpu_memory_utilization": float(os.getenv('GPU_MEMORY_UTILIZATION', 0.95)),
"pipeline_parallel_size": int(os.getenv('PIPELINE_PARALLEL_SIZE', 1)),
"tensor_parallel_size": int(os.getenv('TENSOR_PARALLEL_SIZE', 1)),
"served_model_name": os.getenv('SERVED_MODEL_NAME', None),
"tokenizer": os.getenv('TOKENIZER', None),
"skip_tokenizer_init": os.getenv('SKIP_TOKENIZER_INIT', 'False').lower() == 'true',
"tokenizer_mode": os.getenv('TOKENIZER_MODE', 'auto'),
"trust_remote_code": os.getenv('TRUST_REMOTE_CODE', 'False').lower() == 'true',
"download_dir": os.getenv('DOWNLOAD_DIR', None),
"load_format": os.getenv('LOAD_FORMAT', 'auto'),
"config_format": os.getenv('CONFIG_FORMAT', 'auto'),
"dtype": os.getenv('DTYPE', 'auto'),
"kv_cache_dtype": os.getenv('KV_CACHE_DTYPE', 'auto'),
"quantization_param_path": os.getenv('QUANTIZATION_PARAM_PATH', None),
"seed": int(os.getenv('SEED', 0)),
"max_model_len": int(os.getenv('MAX_MODEL_LEN', 0)) or None,
"worker_use_ray": os.getenv('WORKER_USE_RAY', 'False').lower() == 'true',
"distributed_executor_backend": os.getenv('DISTRIBUTED_EXECUTOR_BACKEND', None),
"max_parallel_loading_workers": int(os.getenv('MAX_PARALLEL_LOADING_WORKERS', 0)) or None,
"block_size": int(os.getenv('BLOCK_SIZE', 16)),
"enable_prefix_caching": os.getenv('ENABLE_PREFIX_CACHING', 'False').lower() == 'true',
"disable_sliding_window": os.getenv('DISABLE_SLIDING_WINDOW', 'False').lower() == 'true',
"use_v2_block_manager": os.getenv('USE_V2_BLOCK_MANAGER', 'False').lower() == 'true',
"swap_space": int(os.getenv('SWAP_SPACE', 4)), # GiB
"cpu_offload_gb": int(os.getenv('CPU_OFFLOAD_GB', 0)), # GiB
"max_num_batched_tokens": int(os.getenv('MAX_NUM_BATCHED_TOKENS', 0)) or None,
"max_num_seqs": int(os.getenv('MAX_NUM_SEQS', 256)),
"max_logprobs": int(os.getenv('MAX_LOGPROBS', 20)), # Default value for OpenAI Chat Completions API
"revision": os.getenv('REVISION', None),
"code_revision": os.getenv('CODE_REVISION', None),
"rope_scaling": os.getenv('ROPE_SCALING', None),
"rope_theta": float(os.getenv('ROPE_THETA', 0)) or None,
"tokenizer_revision": os.getenv('TOKENIZER_REVISION', None),
"quantization": os.getenv('QUANTIZATION', None),
"enforce_eager": os.getenv('ENFORCE_EAGER', 'False').lower() == 'true',
"max_context_len_to_capture": int(os.getenv('MAX_CONTEXT_LEN_TO_CAPTURE', 0)) or None,
"max_seq_len_to_capture": int(os.getenv('MAX_SEQ_LEN_TO_CAPTURE', 8192)),
"disable_custom_all_reduce": os.getenv('DISABLE_CUSTOM_ALL_REDUCE', 'False').lower() == 'true',
"tokenizer_pool_size": int(os.getenv('TOKENIZER_POOL_SIZE', 0)),
"tokenizer_pool_type": os.getenv('TOKENIZER_POOL_TYPE', 'ray'),
"tokenizer_pool_extra_config": os.getenv('TOKENIZER_POOL_EXTRA_CONFIG', None),
"enable_lora": os.getenv('ENABLE_LORA', 'False').lower() == 'true',
"max_loras": int(os.getenv('MAX_LORAS', 1)),
"max_lora_rank": int(os.getenv('MAX_LORA_RANK', 16)),
"enable_prompt_adapter": os.getenv('ENABLE_PROMPT_ADAPTER', 'False').lower() == 'true',
"max_prompt_adapters": int(os.getenv('MAX_PROMPT_ADAPTERS', 1)),
"max_prompt_adapter_token": int(os.getenv('MAX_PROMPT_ADAPTER_TOKEN', 0)),
"fully_sharded_loras": os.getenv('FULLY_SHARDED_LORAS', 'False').lower() == 'true',
"lora_extra_vocab_size": int(os.getenv('LORA_EXTRA_VOCAB_SIZE', 256)),
"long_lora_scaling_factors": tuple(map(float, os.getenv('LONG_LORA_SCALING_FACTORS', '').split(','))) if os.getenv('LONG_LORA_SCALING_FACTORS') else None,
"lora_dtype": os.getenv('LORA_DTYPE', 'auto'),
"max_cpu_loras": int(os.getenv('MAX_CPU_LORAS', 0)) or None,
"device": os.getenv('DEVICE', 'auto'),
"ray_workers_use_nsight": os.getenv('RAY_WORKERS_USE_NSIGHT', 'False').lower() == 'true',
"num_gpu_blocks_override": int(os.getenv('NUM_GPU_BLOCKS_OVERRIDE', 0)) or None,
"num_lookahead_slots": int(os.getenv('NUM_LOOKAHEAD_SLOTS', 0)),
"model_loader_extra_config": os.getenv('MODEL_LOADER_EXTRA_CONFIG', None),
"ignore_patterns": os.getenv('IGNORE_PATTERNS', None),
"preemption_mode": os.getenv('PREEMPTION_MODE', None),
"scheduler_delay_factor": float(os.getenv('SCHEDULER_DELAY_FACTOR', 0.0)),
"enable_chunked_prefill": os.getenv('ENABLE_CHUNKED_PREFILL', None),
"guided_decoding_backend": os.getenv('GUIDED_DECODING_BACKEND', 'outlines'),
"speculative_model": os.getenv('SPECULATIVE_MODEL', None),
"speculative_draft_tensor_parallel_size": int(os.getenv('SPECULATIVE_DRAFT_TENSOR_PARALLEL_SIZE', 0)) or None,
"num_speculative_tokens": int(os.getenv('NUM_SPECULATIVE_TOKENS', 0)) or None,
"speculative_max_model_len": int(os.getenv('SPECULATIVE_MAX_MODEL_LEN', 0)) or None,
"speculative_disable_by_batch_size": int(os.getenv('SPECULATIVE_DISABLE_BY_BATCH_SIZE', 0)) or None,
"ngram_prompt_lookup_max": int(os.getenv('NGRAM_PROMPT_LOOKUP_MAX', 0)) or None,
"ngram_prompt_lookup_min": int(os.getenv('NGRAM_PROMPT_LOOKUP_MIN', 0)) or None,
"spec_decoding_acceptance_method": os.getenv('SPEC_DECODING_ACCEPTANCE_METHOD', 'rejection_sampler'),
"typical_acceptance_sampler_posterior_threshold": float(os.getenv('TYPICAL_ACCEPTANCE_SAMPLER_POSTERIOR_THRESHOLD', 0)) or None,
"typical_acceptance_sampler_posterior_alpha": float(os.getenv('TYPICAL_ACCEPTANCE_SAMPLER_POSTERIOR_ALPHA', 0)) or None,
"qlora_adapter_name_or_path": os.getenv('QLORA_ADAPTER_NAME_OR_PATH', None),
"disable_logprobs_during_spec_decoding": os.getenv('DISABLE_LOGPROBS_DURING_SPEC_DECODING', None),
"otlp_traces_endpoint": os.getenv('OTLP_TRACES_ENDPOINT', None),
"use_v2_block_manager": os.getenv('USE_V2_BLOCK_MANAGER', 'true'),
}
limit_mm_env = os.getenv('LIMIT_MM_PER_PROMPT')
if limit_mm_env is not None:
DEFAULT_ARGS["limit_mm_per_prompt"] = convert_limit_mm_per_prompt(limit_mm_env)
def match_vllm_args(args):
"""Rename args to match vllm by:
1. Renaming keys to lower case
2. Renaming keys to match vllm
3. Filtering args to match vllm's AsyncEngineArgs
Args:
args (dict): Dictionary of args
Returns:
dict: Dictionary of args with renamed keys
"""
renamed_args = {RENAME_ARGS_MAP.get(k, k): v for k, v in args.items()}
matched_args = {k: v for k, v in renamed_args.items() if k in AsyncEngineArgs.__dataclass_fields__}
return {k: v for k, v in matched_args.items() if v not in [None, ""]}
def get_local_args():
"""
Retrieve local arguments from a JSON file.
Returns:
dict: Local arguments.
"""
if not os.path.exists("/local_model_args.json"):
return {}
with open("/local_model_args.json", "r") as f:
local_args = json.load(f)
if local_args.get("MODEL_NAME") is None:
logging.warning("Model name not found in /local_model_args.json. There maybe was a problem when baking the model in.")
logging.info(f"Using baked in model with args: {local_args}")
os.environ["TRANSFORMERS_OFFLINE"] = "1"
os.environ["HF_HUB_OFFLINE"] = "1"
return local_args
def get_engine_args():
# Start with default args
args = DEFAULT_ARGS
# Get env args that match keys in AsyncEngineArgs
args.update(os.environ)
# Get local args if model is baked in and overwrite env args
args.update(get_local_args())
# if args.get("TENSORIZER_URI"): TODO: add back once tensorizer is ready
# args["load_format"] = "tensorizer"
# args["model_loader_extra_config"] = TensorizerConfig(tensorizer_uri=args["TENSORIZER_URI"], num_readers=None)
# logging.info(f"Using tensorized model from {args['TENSORIZER_URI']}")
# Rename and match to vllm args
args = match_vllm_args(args)
if args.get("load_format") == "bitsandbytes":
args["quantization"] = args["load_format"]
# Set tensor parallel size and max parallel loading workers if more than 1 GPU is available
num_gpus = device_count()
if num_gpus > 1:
args["tensor_parallel_size"] = num_gpus
args["max_parallel_loading_workers"] = None
if os.getenv("MAX_PARALLEL_LOADING_WORKERS"):
logging.warning("Overriding MAX_PARALLEL_LOADING_WORKERS with None because more than 1 GPU is available.")
# Deprecated env args backwards compatibility
if args.get("kv_cache_dtype") == "fp8_e5m2":
args["kv_cache_dtype"] = "fp8"
logging.warning("Using fp8_e5m2 is deprecated. Please use fp8 instead.")
if os.getenv("MAX_CONTEXT_LEN_TO_CAPTURE"):
args["max_seq_len_to_capture"] = int(os.getenv("MAX_CONTEXT_LEN_TO_CAPTURE"))
logging.warning("Using MAX_CONTEXT_LEN_TO_CAPTURE is deprecated. Please use MAX_SEQ_LEN_TO_CAPTURE instead.")
# if "gemma-2" in args.get("model", "").lower():
# os.environ["VLLM_ATTENTION_BACKEND"] = "FLASHINFER"
# logging.info("Using FLASHINFER for gemma-2 model.")
return AsyncEngineArgs(**args)
+2 -1
View File
@@ -4,7 +4,8 @@ from typing import Union
class TokenizerWrapper: class TokenizerWrapper:
def __init__(self, tokenizer_name_or_path, tokenizer_revision, trust_remote_code): def __init__(self, tokenizer_name_or_path, tokenizer_revision, trust_remote_code):
self.tokenizer = AutoTokenizer.from_pretrained(tokenizer_name_or_path, revision=tokenizer_revision, trust_remote_code=trust_remote_code) print(f"tokenizer_name_or_path: {tokenizer_name_or_path}, tokenizer_revision: {tokenizer_revision}, trust_remote_code: {trust_remote_code}")
self.tokenizer = AutoTokenizer.from_pretrained(tokenizer_name_or_path, revision=tokenizer_revision or "main", trust_remote_code=trust_remote_code)
self.custom_chat_template = os.getenv("CUSTOM_CHAT_TEMPLATE") self.custom_chat_template = os.getenv("CUSTOM_CHAT_TEMPLATE")
self.has_chat_template = bool(self.tokenizer.chat_template) or bool(self.custom_chat_template) self.has_chat_template = bool(self.tokenizer.chat_template) or bool(self.custom_chat_template)
if self.custom_chat_template and isinstance(self.custom_chat_template, str): if self.custom_chat_template and isinstance(self.custom_chat_template, str):
+37 -4
View File
@@ -1,12 +1,29 @@
import os import os
import logging import logging
from http import HTTPStatus from http import HTTPStatus
from functools import wraps
from time import time
from vllm.entrypoints.openai.protocol import RequestResponseMetadata
try:
from vllm.utils import random_uuid from vllm.utils import random_uuid
from vllm.entrypoints.openai.protocol import ErrorResponse from vllm.entrypoints.openai.protocol import ErrorResponse
from vllm import SamplingParams from vllm import SamplingParams
except ImportError:
logging.warning("Error importing vllm, skipping related imports. This is ONLY expected when baking model into docker image from a machine without GPUs")
pass
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
# Updated to parse multiple comma-separated multimodal limits (e.g., 'image=1,video=0')
def convert_limit_mm_per_prompt(input_string: str):
result = {}
pairs = input_string.split(',')
for pair in pairs:
key, value = pair.split('=')
result[key] = int(value)
return result
def count_physical_cores(): def count_physical_cores():
with open('/proc/cpuinfo') as f: with open('/proc/cpuinfo') as f:
content = f.readlines() content = f.readlines()
@@ -32,7 +49,11 @@ class JobInput:
self.max_batch_size = job.get("max_batch_size") self.max_batch_size = job.get("max_batch_size")
self.apply_chat_template = job.get("apply_chat_template", False) self.apply_chat_template = job.get("apply_chat_template", False)
self.use_openai_format = job.get("use_openai_format", False) self.use_openai_format = job.get("use_openai_format", False)
self.sampling_params = SamplingParams(**job.get("sampling_params", {})) samp_param = job.get("sampling_params", {})
if "max_tokens" not in samp_param:
samp_param["max_tokens"] = 100
self.sampling_params = SamplingParams(**samp_param)
# self.sampling_params = SamplingParams(max_tokens=100, **job.get("sampling_params", {}))
self.request_id = random_uuid() self.request_id = random_uuid()
batch_size_growth_factor = job.get("batch_size_growth_factor") batch_size_growth_factor = job.get("batch_size_growth_factor")
self.batch_size_growth_factor = float(batch_size_growth_factor) if batch_size_growth_factor else None self.batch_size_growth_factor = float(batch_size_growth_factor) if batch_size_growth_factor else None
@@ -40,8 +61,14 @@ class JobInput:
self.min_batch_size = int(min_batch_size) if min_batch_size else None self.min_batch_size = int(min_batch_size) if min_batch_size else None
self.openai_route = job.get("openai_route") self.openai_route = job.get("openai_route")
self.openai_input = job.get("openai_input") self.openai_input = job.get("openai_input")
class DummyState:
def __init__(self):
self.request_metadata = None
class DummyRequest: class DummyRequest:
def __init__(self):
self.headers = {}
self.state = DummyState()
async def is_disconnected(self): async def is_disconnected(self):
return False return False
@@ -68,6 +95,12 @@ def create_error_response(message: str, err_type: str = "BadRequestError", statu
def get_int_bool_env(env_var: str, default: bool) -> bool: def get_int_bool_env(env_var: str, default: bool) -> bool:
return int(os.getenv(env_var, int(default))) == 1 return int(os.getenv(env_var, int(default))) == 1
def timer_decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
start = time()
result = func(*args, **kwargs)
end = time()
logging.info(f"{func.__name__} completed in {end - start:.2f} seconds")
return result
return wrapper
-149
View File
@@ -1,149 +0,0 @@
################### vLLM Base Dockerfile ###################
# This Dockerfile is for building the image that the
# vLLM worker container will use as its base image.
# If your changes are outside of the vLLM source code, you
# do not need to build this image.
##########################################################
# Define the CUDA version for the build
ARG WORKER_CUDA_VERSION=11.8.0
FROM nvidia/cuda:${WORKER_CUDA_VERSION}-devel-ubuntu22.04 AS dev
# Re-declare ARG after FROM
ARG WORKER_CUDA_VERSION
# Update and install dependencies
RUN apt-get update -y \
&& apt-get install -y python3-pip git
# Set working directory
WORKDIR /vllm-installation
RUN ldconfig /usr/local/cuda-$(echo "$WORKER_CUDA_VERSION" | sed 's/\.0$//')/compat/
# Install build and runtime dependencies
COPY vllm/requirements-common.txt requirements-common.txt
COPY vllm/requirements-cuda${WORKER_CUDA_VERSION}.txt requirements-cuda.txt
RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r requirements-cuda.txt
# Install development dependencies
COPY vllm/requirements-dev.txt requirements-dev.txt
RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r requirements-dev.txt
ARG torch_cuda_arch_list='7.0 7.5 8.0 8.6 8.9 9.0+PTX'
ENV TORCH_CUDA_ARCH_LIST=${torch_cuda_arch_list}
FROM dev AS build
# Re-declare ARG after FROM
ARG WORKER_CUDA_VERSION
# Install build dependencies
COPY vllm/requirements-build.txt requirements-build.txt
RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r requirements-build.txt
# install compiler cache to speed up compilation leveraging local or remote caching
RUN apt-get update -y && apt-get install -y ccache
# Copy necessary files
COPY vllm/csrc csrc
COPY vllm/setup.py setup.py
COPY vllm/cmake cmake
COPY vllm/CMakeLists.txt CMakeLists.txt
COPY vllm/requirements-common.txt requirements-common.txt
COPY vllm/requirements-cuda${WORKER_CUDA_VERSION}.txt requirements-cuda.txt
COPY vllm/pyproject.toml pyproject.toml
COPY vllm/vllm vllm
# Set environment variables for building extensions
ENV WORKER_CUDA_VERSION=${WORKER_CUDA_VERSION}
ENV VLLM_INSTALL_PUNICA_KERNELS=0
# Build extensions
ENV CCACHE_DIR=/root/.cache/ccache
RUN --mount=type=cache,target=/root/.cache/ccache \
--mount=type=cache,target=/root/.cache/pip \
python3 setup.py bdist_wheel --dist-dir=dist
RUN --mount=type=cache,target=/root/.cache/pip \
pip cache remove vllm_nccl*
FROM dev as flash-attn-builder
# max jobs used for build
# flash attention version
ARG flash_attn_version=v2.5.8
ENV FLASH_ATTN_VERSION=${flash_attn_version}
WORKDIR /usr/src/flash-attention-v2
# Download the wheel or build it if a pre-compiled release doesn't exist
RUN pip --verbose wheel flash-attn==${FLASH_ATTN_VERSION} \
--no-build-isolation --no-deps --no-cache-dir
FROM dev as NCCL-installer
# Re-declare ARG after FROM
ARG WORKER_CUDA_VERSION
# Update and install necessary libraries
RUN apt-get update -y \
&& apt-get install -y wget
# Install NCCL library
RUN if [ "$WORKER_CUDA_VERSION" = "11.8.0" ]; then \
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \
&& dpkg -i cuda-keyring_1.0-1_all.deb \
&& apt-get update \
&& apt install -y libnccl2=2.15.5-1+cuda11.8 libnccl-dev=2.15.5-1+cuda11.8; \
elif [ "$WORKER_CUDA_VERSION" = "12.1.0" ]; then \
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \
&& dpkg -i cuda-keyring_1.0-1_all.deb \
&& apt-get update \
&& apt install -y libnccl2=2.17.1-1+cuda12.1 libnccl-dev=2.17.1-1+cuda12.1; \
else \
echo "Unsupported CUDA version: $WORKER_CUDA_VERSION"; \
exit 1; \
fi
FROM nvidia/cuda:${WORKER_CUDA_VERSION}-base-ubuntu22.04 AS vllm-base
# Re-declare ARG after FROM
ARG WORKER_CUDA_VERSION
# Update and install necessary libraries
RUN apt-get update -y \
&& apt-get install -y python3-pip
# Set working directory
WORKDIR /vllm-workspace
RUN ldconfig /usr/local/cuda-$(echo "$WORKER_CUDA_VERSION" | sed 's/\.0$//')/compat/
RUN --mount=type=bind,from=build,src=/vllm-installation/dist,target=/vllm-workspace/dist \
--mount=type=cache,target=/root/.cache/pip \
pip install dist/*.whl --verbose
RUN --mount=type=bind,from=flash-attn-builder,src=/usr/src/flash-attention-v2,target=/usr/src/flash-attention-v2 \
--mount=type=cache,target=/root/.cache/pip \
pip install /usr/src/flash-attention-v2/*.whl --no-cache-dir
FROM vllm-base AS runtime
# install additional dependencies for openai api server
RUN --mount=type=cache,target=/root/.cache/pip \
pip install accelerate hf_transfer modelscope tensorizer
# Set PYTHONPATH environment variable
ENV PYTHONPATH="/"
# Copy NCCL library
COPY --from=NCCL-installer /usr/lib/x86_64-linux-gnu/libnccl.so.2 /usr/lib/x86_64-linux-gnu/libnccl.so.2
# Set the VLLM_NCCL_SO_PATH environment variable
ENV VLLM_NCCL_SO_PATH="/usr/lib/x86_64-linux-gnu/libnccl.so.2"
# Validate the installation
RUN python3 -c "import vllm; print(vllm.__file__)"
-1
View File
@@ -1 +0,0 @@
This directory is for building the vllm-base image utilized by the worker.
-2
View File
@@ -1,2 +0,0 @@
version: '0.4.2'
dev_version: '0.4.2'
+1514
View File
File diff suppressed because it is too large Load Diff