forked from kaito-project/kaito
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: package vllm runtime into image (kaito-project#655)
**Reason for Change**: <!-- What does this PR improve or fix in Kaito? Why is it needed? --> - pack vllm runtime and chat_template files - align the requirements of the two runtimes - support to load chat_template for hf runtime Signed-off-by: jerryzhuang <[email protected]>
- Loading branch information
Showing
20 changed files
with
245 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: unit-tests-ragengine | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths-ignore: ["docs/**", "**.md", "**.mdx", "**.png", "**.jpg"] | ||
pull_request: | ||
branches: [main, release-**] | ||
paths-ignore: ["docs/**", "**.md", "**.mdx", "**.png", "**.jpg"] | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
env: | ||
GO_VERSION: "1.22" | ||
|
||
jobs: | ||
unit-tests: | ||
runs-on: ubuntu-latest | ||
environment: unit-tests | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: Check out the code | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
|
||
- name: Run unit tests | ||
run: | | ||
make rag-service-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Requirement | ||
|
||
Pip dependencies for both Kaito inference and tuning. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Common dependencies | ||
-r requirements.txt | ||
|
||
# Test dependencies | ||
pytest | ||
httpx | ||
peft | ||
requests |
19 changes: 11 additions & 8 deletions
19
...nference/text-generation/requirements.txt → presets/dependencies/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
# Dependencies for TFS | ||
|
||
# Core Dependencies | ||
transformers==4.41.2 | ||
torch==2.2.0 | ||
vllm==0.6.3 | ||
transformers >= 4.45.0 | ||
torch==2.4.0 | ||
accelerate==0.30.1 | ||
fastapi>=0.111.0,<0.112.0 # Allow patch updates | ||
pydantic==2.7.4 | ||
pydantic>=2.9 | ||
uvicorn[standard]>=0.29.0,<0.30.0 # Allow patch updates | ||
uvloop | ||
peft==0.11.1 | ||
numpy==1.22.4 | ||
numpy<3.0,>=1.25.0 | ||
sentencepiece==0.2.0 | ||
jinja2>=3.1.0 | ||
|
||
# Utility libraries | ||
datasets==2.19.1 | ||
peft==0.11.1 | ||
bitsandbytes==0.42.0 | ||
sentencepiece==0.2.0 | ||
|
||
# Less critical, can be latest | ||
gputil | ||
psutil | ||
# For UTs | ||
pytest | ||
httpx | ||
peft | ||
trl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% if messages[0]['role'] == 'system' %} | ||
{% set system_message = messages[0]['content'] %} | ||
{% set messages = messages[1:] %} | ||
{% else %} | ||
{% set system_message = '' %} | ||
{% endif %} | ||
|
||
{{ system_message | trim }} | ||
{% for message in messages %} | ||
{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %} | ||
{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }} | ||
{% endif %} | ||
|
||
{% set content = message['content'].replace('\r\n', '\n').replace('\n\n', '\n') %} | ||
{{ '\n\n' + message['role'] | capitalize + ': ' + content | trim }} | ||
{% endfor %} | ||
|
||
{% if add_generation_prompt %} | ||
{{ '\n\nAssistant:' }} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{% if messages[0]['role'] == 'system' %} | ||
{% set system_message = '<<SYS>>\n' + messages[0]['content'] | trim + '\n<</SYS>>\n\n' %} | ||
{% set messages = messages[1:] %} | ||
{% else %} | ||
{% set system_message = '' %} | ||
{% endif %} | ||
|
||
{% for message in messages %} | ||
{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %} | ||
{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }} | ||
{% endif %} | ||
|
||
{% if loop.index0 == 0 %} | ||
{% set content = system_message + message['content'] %} | ||
{% else %} | ||
{% set content = message['content'] %} | ||
{% endif %} | ||
|
||
{% if message['role'] == 'user' %} | ||
{{ bos_token + '[INST] ' + content | trim + ' [/INST]' }} | ||
{% elif message['role'] == 'assistant' %} | ||
{{ ' ' + content | trim + ' ' + eos_token }} | ||
{% endif %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% if messages[0]['role'] == 'system' %} | ||
{% set offset = 1 %} | ||
{% else %} | ||
{% set offset = 0 %} | ||
{% endif %} | ||
|
||
{{ bos_token }} | ||
{% for message in messages %} | ||
{% if (message['role'] == 'user') != (loop.index0 % 2 == offset) %} | ||
{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }} | ||
{% endif %} | ||
|
||
{{ '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n' + message['content'] | trim + '<|eot_id|>' }} | ||
{% endfor %} | ||
|
||
{% if add_generation_prompt %} | ||
{{ '<|start_header_id|>' + 'assistant' + '<|end_header_id|>\n\n' }} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{% if messages[0]['role'] == 'system' %} | ||
{% set system_message = messages[0]['content'] | trim + '\n\n' %} | ||
{% set messages = messages[1:] %} | ||
{% else %} | ||
{% set system_message = '' %} | ||
{% endif %} | ||
|
||
{{ bos_token + system_message}} | ||
{% for message in messages %} | ||
{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %} | ||
{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }} | ||
{% endif %} | ||
|
||
{% if message['role'] == 'user' %} | ||
{{ '[INST] ' + message['content'] | trim + ' [/INST]' }} | ||
{% elif message['role'] == 'assistant' %} | ||
{{ ' ' + message['content'] | trim + eos_token }} | ||
{% endif %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% if messages[0]['role'] == 'system' %} | ||
{% set offset = 1 %} | ||
{% else %} | ||
{% set offset = 0 %} | ||
{% endif %} | ||
|
||
{{ bos_token }} | ||
{% for message in messages %} | ||
{% if (message['role'] == 'user') != (loop.index0 % 2 == offset) %} | ||
{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }} | ||
{% endif %} | ||
|
||
{{ '<|' + message['role'] + '|>\n' + message['content'] | trim + '<|end|>' + '\n' }} | ||
{% endfor %} | ||
|
||
{% if add_generation_prompt %} | ||
{{ '<|assistant|>\n' }} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{% if messages[0]['role'] == 'system' %} | ||
{% set offset = 1 %} | ||
{% else %} | ||
{% set offset = 0 %} | ||
{% endif %} | ||
|
||
{% for message in messages %} | ||
{% if (message['role'] == 'user') != (loop.index0 % 2 == offset) %} | ||
{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }} | ||
{% endif %} | ||
|
||
{{ '<|' + message['role'] + '|>\n' + message['content'] | trim + '<|end|>' + '\n' }} | ||
{% endfor %} | ||
|
||
{% if add_generation_prompt %} | ||
{{ '<|assistant|>\n' }} | ||
{% endif %} |
Oops, something went wrong.