forked from vllm-project/vllm
-
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.
[ROCm] Fix build problem resulted from previous commit related to FP8 kv-cache support (vllm-project#2790) Add documentation on how to do incremental builds (vllm-project#2796) [Ray] Integration compiled DAG off by default (vllm-project#2471) Disable custom all reduce by default (vllm-project#2808) add usage context removed usage_context from Engine_args Move IO to another process added http request [ROCm] support Radeon™ 7900 series (gfx1100) without using flash-attention (vllm-project#2768) Add documentation section about LoRA (vllm-project#2834) Refactor 2 awq gemm kernels into m16nXk32 (vllm-project#2723) Co-authored-by: Chunan Zeng <chunanzeng@Chunans-Air.attlocal.net> Added additional arg for from_engine_args comments
- Loading branch information
Showing
20 changed files
with
414 additions
and
329 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
Large diffs are not rendered by default.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
.. _lora: | ||
|
||
Using LoRA adapters | ||
=================== | ||
|
||
This document shows you how to use `LoRA adapters <https://arxiv.org/abs/2106.09685>`_ with vLLM on top of a base model. | ||
Adapters can be efficiently served on a per request basis with minimal overhead. First we download the adapter(s) and save | ||
them locally with | ||
|
||
.. code-block:: python | ||
from huggingface_hub import snapshot_download | ||
sql_lora_path = snapshot_download(repo_id="yard1/llama-2-7b-sql-lora-test") | ||
Then we instantiate the base model and pass in the ``enable_lora=True`` flag: | ||
|
||
.. code-block:: python | ||
from vllm import LLM, SamplingParams | ||
from vllm.lora.request import LoRARequest | ||
llm = LLM(model="meta-llama/Llama-2-7b-hf", enable_lora=True) | ||
We can now submit the prompts and call ``llm.generate`` with the ``lora_request`` parameter. The first parameter | ||
of ``LoRARequest`` is a human identifiable name, the second parameter is a globally unique ID for the adapter and | ||
the third parameter is the path to the LoRA adapter. | ||
|
||
.. code-block:: python | ||
sampling_params = SamplingParams( | ||
temperature=0, | ||
max_tokens=256, | ||
stop=["[/assistant]"] | ||
) | ||
prompts = [ | ||
"[user] Write a SQL query to answer the question based on the table schema.\n\n context: CREATE TABLE table_name_74 (icao VARCHAR, airport VARCHAR)\n\n question: Name the ICAO for lilongwe international airport [/user] [assistant]", | ||
"[user] Write a SQL query to answer the question based on the table schema.\n\n context: CREATE TABLE table_name_11 (nationality VARCHAR, elector VARCHAR)\n\n question: When Anchero Pantaleone was the elector what is under nationality? [/user] [assistant]", | ||
] | ||
outputs = llm.generate( | ||
prompts, | ||
sampling_params, | ||
lora_request=LoRARequest("sql_adapter", 1, sql_lora_path) | ||
) | ||
Check out `examples/multilora_inference.py <https://github.com/vllm-project/vllm/blob/main/examples/multilora_inference.py>`_ | ||
for an example of how to use LoRA adapters with the async engine and how to use more advanced configuration options. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- amd_hip_bf16.h 2024-02-06 18:28:58.268699142 +0000 | ||
+++ amd_hip_bf16.h.new 2024-02-06 18:28:31.988647133 +0000 | ||
@@ -90,10 +90,10 @@ | ||
#include "math_fwd.h" // ocml device functions | ||
|
||
#if defined(__HIPCC_RTC__) | ||
-#define __HOST_DEVICE__ __device__ | ||
+#define __HOST_DEVICE__ __device__ static | ||
#else | ||
#include <climits> | ||
-#define __HOST_DEVICE__ __host__ __device__ | ||
+#define __HOST_DEVICE__ __host__ __device__ static inline | ||
#endif | ||
|
||
// Since we are using unsigned short to represent data in bfloat16, it can be of different sizes on |
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 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
Oops, something went wrong.