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
82e7e19a
Unverified
Commit
82e7e19a
authored
Apr 03, 2025
by
Kyle Sayers
Committed by
GitHub
Apr 03, 2025
Browse files
[SupportsQuant] Chameleon, Chatglm, Commandr (#15952)
Signed-off-by:
Kyle Sayers
<
kylesayrs@gmail.com
>
parent
421c4629
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
8 deletions
+17
-8
vllm/model_executor/models/chameleon.py
vllm/model_executor/models/chameleon.py
+7
-2
vllm/model_executor/models/chatglm.py
vllm/model_executor/models/chatglm.py
+8
-4
vllm/model_executor/models/commandr.py
vllm/model_executor/models/commandr.py
+2
-2
No files found.
vllm/model_executor/models/chameleon.py
View file @
82e7e19a
...
...
@@ -38,7 +38,8 @@ from vllm.multimodal.processing import (BaseMultiModalProcessor,
from
vllm.multimodal.profiling
import
BaseDummyInputsBuilder
,
ProcessorInputs
from
vllm.sequence
import
IntermediateTensors
from
.interfaces
import
MultiModalEmbeddings
,
SupportsMultiModal
,
SupportsPP
from
.interfaces
import
(
MultiModalEmbeddings
,
SupportsMultiModal
,
SupportsPP
,
SupportsQuant
)
from
.utils
import
(
flatten_bn
,
is_pp_missing_parameter
,
make_empty_intermediate_tensors_factory
,
make_layers
,
maybe_prefix
,
merge_multimodal_embeddings
)
...
...
@@ -927,7 +928,11 @@ class ChameleonModel(nn.Module):
info
=
ChameleonProcessingInfo
,
dummy_inputs
=
ChameleonDummyInputsBuilder
)
class
ChameleonForConditionalGeneration
(
nn
.
Module
,
SupportsMultiModal
,
SupportsPP
):
SupportsPP
,
SupportsQuant
):
packed_modules_mapping
=
{
"qkv_proj"
:
[
"q_proj"
,
"k_proj"
,
"v_proj"
],
"gate_up_proj"
:
[
"gate_proj"
,
"up_proj"
]
}
def
__init__
(
self
,
*
,
vllm_config
:
VllmConfig
,
prefix
:
str
=
""
):
super
().
__init__
()
...
...
vllm/model_executor/models/chatglm.py
View file @
82e7e19a
...
...
@@ -29,7 +29,7 @@ from vllm.model_executor.sampling_metadata import SamplingMetadata
from
vllm.sequence
import
IntermediateTensors
from
vllm.transformers_utils.configs
import
ChatGLMConfig
from
.interfaces
import
SupportsLoRA
,
SupportsPP
from
.interfaces
import
SupportsLoRA
,
SupportsPP
,
SupportsQuant
from
.utils
import
(
AutoWeightsLoader
,
WeightsMapper
,
is_pp_missing_parameter
,
make_empty_intermediate_tensors_factory
,
make_layers
,
maybe_prefix
)
...
...
@@ -295,7 +295,11 @@ class GLMTransformer(nn.Module):
@
support_torch_compile
class
ChatGLMModel
(
nn
.
Module
):
class
ChatGLMModel
(
nn
.
Module
,
SupportsQuant
):
packed_modules_mapping
=
{
"linear_proj.merged_proj"
:
[
"linear_proj.gate_proj"
,
"linear_proj.dense_h_to_4h"
]
}
def
__init__
(
self
,
*
,
vllm_config
:
VllmConfig
,
prefix
:
str
=
""
):
super
().
__init__
()
...
...
@@ -395,7 +399,6 @@ class ChatGLMModel(nn.Module):
class
ChatGLMBaseModel
(
nn
.
Module
):
hf_to_vllm_mapper
=
WeightsMapper
(
orig_to_new_substr
=
{
".word_embeddings"
:
""
},
)
...
...
@@ -452,7 +455,8 @@ class ChatGLMBaseModel(nn.Module):
return
loader
.
load_weights
(
weights
,
mapper
=
self
.
hf_to_vllm_mapper
)
class
ChatGLMForCausalLM
(
ChatGLMBaseModel
,
SupportsLoRA
,
SupportsPP
):
class
ChatGLMForCausalLM
(
ChatGLMBaseModel
,
SupportsLoRA
,
SupportsPP
,
SupportsQuant
):
packed_modules_mapping
=
{
"query_key_value"
:
[
"query_key_value"
],
"dense_h_to_4h"
:
[
"dense_h_to_4h"
]
...
...
vllm/model_executor/models/commandr.py
View file @
82e7e19a
...
...
@@ -49,7 +49,7 @@ from vllm.model_executor.utils import set_weight_attrs
from
vllm.platforms
import
current_platform
from
vllm.sequence
import
IntermediateTensors
from
.interfaces
import
SupportsLoRA
,
SupportsPP
from
.interfaces
import
SupportsLoRA
,
SupportsPP
,
SupportsQuant
from
.utils
import
(
extract_layer_index
,
is_pp_missing_parameter
,
make_empty_intermediate_tensors_factory
,
make_layers
,
maybe_prefix
)
...
...
@@ -332,7 +332,7 @@ class CohereModel(nn.Module):
return
hidden_states
class
CohereForCausalLM
(
nn
.
Module
,
SupportsLoRA
,
SupportsPP
):
class
CohereForCausalLM
(
nn
.
Module
,
SupportsLoRA
,
SupportsPP
,
SupportsQuant
):
packed_modules_mapping
=
{
"qkv_proj"
:
[
"q_proj"
,
...
...
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