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
d910816c
Unverified
Commit
d910816c
authored
May 30, 2024
by
Robert Shaw
Committed by
GitHub
May 30, 2024
Browse files
[Bugfix] Automatically Detect SparseML models (#5119)
parent
87d41c84
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
vllm/config.py
vllm/config.py
+14
-2
No files found.
vllm/config.py
View file @
d910816c
...
@@ -156,6 +156,17 @@ class ModelConfig:
...
@@ -156,6 +156,17 @@ class ModelConfig:
self
.
embedding_mode
=
any
(
self
.
embedding_mode
=
any
(
ModelRegistry
.
is_embedding_model
(
arch
)
for
arch
in
architectures
)
ModelRegistry
.
is_embedding_model
(
arch
)
for
arch
in
architectures
)
def
_parse_quant_hf_config
(
self
):
quant_cfg
=
getattr
(
self
.
hf_config
,
"quantization_config"
,
None
)
if
quant_cfg
is
None
:
# SparseML uses a "compression_config" with a "quantization_config".
compression_cfg
=
getattr
(
self
.
hf_config
,
"compression_config"
,
None
)
if
compression_cfg
is
not
None
:
quant_cfg
=
compression_cfg
.
get
(
"quantization_config"
,
None
)
return
quant_cfg
def
_verify_quantization
(
self
)
->
None
:
def
_verify_quantization
(
self
)
->
None
:
supported_quantization
=
[
*
QUANTIZATION_METHODS
]
supported_quantization
=
[
*
QUANTIZATION_METHODS
]
rocm_supported_quantization
=
[
"gptq"
,
"squeezellm"
]
rocm_supported_quantization
=
[
"gptq"
,
"squeezellm"
]
...
@@ -163,12 +174,13 @@ class ModelConfig:
...
@@ -163,12 +174,13 @@ class ModelConfig:
self
.
quantization
=
self
.
quantization
.
lower
()
self
.
quantization
=
self
.
quantization
.
lower
()
# Parse quantization method from the HF model config, if available.
# Parse quantization method from the HF model config, if available.
quant_cfg
=
getattr
(
self
.
hf_config
,
"quantization_config"
,
None
)
quant_cfg
=
self
.
_parse_quant_hf_config
()
if
quant_cfg
is
not
None
:
if
quant_cfg
is
not
None
:
quant_method
=
quant_cfg
.
get
(
"quant_method"
,
""
).
lower
()
quant_method
=
quant_cfg
.
get
(
"quant_method"
,
""
).
lower
()
# Detect which checkpoint is it
# Detect which checkpoint is it
for
name
,
method
in
QUANTIZATION_METHODS
.
items
():
for
_
,
method
in
QUANTIZATION_METHODS
.
items
():
quantization_override
=
method
.
override_quantization_method
(
quantization_override
=
method
.
override_quantization_method
(
quant_cfg
,
self
.
quantization
)
quant_cfg
,
self
.
quantization
)
if
quantization_override
:
if
quantization_override
:
...
...
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