Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
2003cc35
Unverified
Commit
2003cc35
authored
Nov 06, 2024
by
Jee Jee Li
Committed by
GitHub
Nov 06, 2024
Browse files
[Model][LoRA]LoRA support added for LlamaEmbeddingModel (#10071)
Signed-off-by:
Jee Jee Li
<
pandaleefree@gmail.com
>
parent
6a585a23
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
docs/source/models/supported_models.rst
docs/source/models/supported_models.rst
+1
-1
vllm/model_executor/models/llama.py
vllm/model_executor/models/llama.py
+19
-1
No files found.
docs/source/models/supported_models.rst
View file @
2003cc35
...
...
@@ -333,7 +333,7 @@ Text Embedding
* - :code:`MistralModel`
- Mistral-based
- :code:`intfloat/e5-mistral-7b-instruct`, etc.
-
-
✅︎
- ✅︎
.. important::
...
...
vllm/model_executor/models/llama.py
View file @
2003cc35
...
...
@@ -627,7 +627,7 @@ class LlamaForCausalLM(nn.Module, SupportsLoRA, SupportsPP):
return
name
,
loaded_weight
class
LlamaEmbeddingModel
(
nn
.
Module
,
SupportsPP
):
class
LlamaEmbeddingModel
(
nn
.
Module
,
SupportsLoRA
,
SupportsPP
):
"""
A model that uses Llama with additional embedding functionalities.
...
...
@@ -638,6 +638,19 @@ class LlamaEmbeddingModel(nn.Module, SupportsPP):
model: An instance of LlamaModel used for forward operations.
_pooler: An instance of Pooler used for pooling operations.
"""
packed_modules_mapping
=
{
"qkv_proj"
:
[
"q_proj"
,
"k_proj"
,
"v_proj"
],
"gate_up_proj"
:
[
"gate_proj"
,
"up_proj"
]
}
# LoRA specific attributes
supported_lora_modules
=
[
"qkv_proj"
,
"o_proj"
,
"gate_up_proj"
,
"down_proj"
,
"embed_tokens"
]
embedding_modules
=
{
"embed_tokens"
:
"input_embeddings"
,
}
embedding_padding_modules
=
[]
def
__init__
(
self
,
...
...
@@ -679,3 +692,8 @@ class LlamaEmbeddingModel(nn.Module, SupportsPP):
def
load_kv_cache_scales
(
self
,
quantization_param_path
:
str
)
->
None
:
self
.
model
.
load_kv_cache_scales
(
quantization_param_path
)
# LRUCacheWorkerLoRAManager instantiation requires model config.
@
property
def
config
(
self
):
return
self
.
model
.
config
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment