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
baa54675
Unverified
Commit
baa54675
authored
Sep 05, 2024
by
Nick Hill
Committed by
GitHub
Sep 06, 2024
Browse files
[BugFix] Fix Granite model configuration (#8216)
parent
db3bf7c9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
24 deletions
+42
-24
vllm/transformers_utils/config.py
vllm/transformers_utils/config.py
+38
-24
vllm/transformers_utils/configs/__init__.py
vllm/transformers_utils/configs/__init__.py
+4
-0
No files found.
vllm/transformers_utils/config.py
View file @
baa54675
...
@@ -10,12 +10,16 @@ from transformers.models.auto.modeling_auto import (
...
@@ -10,12 +10,16 @@ from transformers.models.auto.modeling_auto import (
from
vllm.envs
import
VLLM_USE_MODELSCOPE
from
vllm.envs
import
VLLM_USE_MODELSCOPE
from
vllm.logger
import
init_logger
from
vllm.logger
import
init_logger
# yapf conflicts with isort for this block
# yapf: disable
from
vllm.transformers_utils.configs
import
(
ChatGLMConfig
,
DbrxConfig
,
from
vllm.transformers_utils.configs
import
(
ChatGLMConfig
,
DbrxConfig
,
EAGLEConfig
,
ExaoneConfig
,
EAGLEConfig
,
ExaoneConfig
,
InternVLChatConfig
,
JAISConfig
,
GraniteConfig
,
InternVLChatConfig
,
MedusaConfig
,
MLPSpeculatorConfig
,
JAISConfig
,
MedusaConfig
,
MPTConfig
,
NemotronConfig
,
MLPSpeculatorConfig
,
MPTConfig
,
RWConfig
,
UltravoxConfig
)
NemotronConfig
,
RWConfig
,
UltravoxConfig
)
# yapf: enable
from
vllm.transformers_utils.utils
import
check_gguf_file
from
vllm.transformers_utils.utils
import
check_gguf_file
if
VLLM_USE_MODELSCOPE
:
if
VLLM_USE_MODELSCOPE
:
...
@@ -39,6 +43,9 @@ _CONFIG_REGISTRY: Dict[str, Type[PretrainedConfig]] = {
...
@@ -39,6 +43,9 @@ _CONFIG_REGISTRY: Dict[str, Type[PretrainedConfig]] = {
"internvl_chat"
:
InternVLChatConfig
,
"internvl_chat"
:
InternVLChatConfig
,
"nemotron"
:
NemotronConfig
,
"nemotron"
:
NemotronConfig
,
"ultravox"
:
UltravoxConfig
,
"ultravox"
:
UltravoxConfig
,
# Granite can be removed from here once we have upgraded to
# transformers 4.45+
"granite"
:
GraniteConfig
,
}
}
for
name
,
cls
in
_CONFIG_REGISTRY
.
items
():
for
name
,
cls
in
_CONFIG_REGISTRY
.
items
():
...
@@ -62,6 +69,17 @@ def get_config(
...
@@ -62,6 +69,17 @@ def get_config(
kwargs
[
"gguf_file"
]
=
Path
(
model
).
name
kwargs
[
"gguf_file"
]
=
Path
(
model
).
name
model
=
Path
(
model
).
parent
model
=
Path
(
model
).
parent
config_dict
,
_
=
PretrainedConfig
.
get_config_dict
(
model
,
revision
=
revision
,
code_revision
=
code_revision
,
**
kwargs
)
# Use custom model class if it's in our registry
model_type
=
config_dict
.
get
(
"model_type"
)
if
model_type
in
_CONFIG_REGISTRY
:
config_class
=
_CONFIG_REGISTRY
[
model_type
]
config
=
config_class
.
from_pretrained
(
model
,
revision
=
revision
,
code_revision
=
code_revision
)
else
:
try
:
try
:
config
=
AutoConfig
.
from_pretrained
(
config
=
AutoConfig
.
from_pretrained
(
model
,
model
,
...
@@ -70,8 +88,9 @@ def get_config(
...
@@ -70,8 +88,9 @@ def get_config(
code_revision
=
code_revision
,
code_revision
=
code_revision
,
**
kwargs
)
**
kwargs
)
except
ValueError
as
e
:
except
ValueError
as
e
:
if
(
not
trust_remote_code
and
if
(
not
trust_remote_code
"requires you to execute the configuration file"
in
str
(
e
)):
and
"requires you to execute the configuration file"
in
str
(
e
)):
err_msg
=
(
err_msg
=
(
"Failed to load the model config. If the model is a custom "
"Failed to load the model config. If the model is a custom "
"model not yet available in the HuggingFace transformers "
"model not yet available in the HuggingFace transformers "
...
@@ -80,11 +99,6 @@ def get_config(
...
@@ -80,11 +99,6 @@ def get_config(
raise
RuntimeError
(
err_msg
)
from
e
raise
RuntimeError
(
err_msg
)
from
e
else
:
else
:
raise
e
raise
e
if
config
.
model_type
in
_CONFIG_REGISTRY
:
config_class
=
_CONFIG_REGISTRY
[
config
.
model_type
]
config
=
config_class
.
from_pretrained
(
model
,
revision
=
revision
,
code_revision
=
code_revision
)
# Special architecture mapping check for GGUF models
# Special architecture mapping check for GGUF models
if
is_gguf
:
if
is_gguf
:
...
...
vllm/transformers_utils/configs/__init__.py
View file @
baa54675
...
@@ -6,6 +6,7 @@ from vllm.transformers_utils.configs.exaone import ExaoneConfig
...
@@ -6,6 +6,7 @@ from vllm.transformers_utils.configs.exaone import ExaoneConfig
# tiiuae/falcon-7b(-instruct) models. Newer Falcon models will use the
# tiiuae/falcon-7b(-instruct) models. Newer Falcon models will use the
# `FalconConfig` class from the official HuggingFace transformers library.
# `FalconConfig` class from the official HuggingFace transformers library.
from
vllm.transformers_utils.configs.falcon
import
RWConfig
from
vllm.transformers_utils.configs.falcon
import
RWConfig
from
vllm.transformers_utils.configs.granite
import
GraniteConfig
from
vllm.transformers_utils.configs.internvl
import
InternVLChatConfig
from
vllm.transformers_utils.configs.internvl
import
InternVLChatConfig
from
vllm.transformers_utils.configs.jais
import
JAISConfig
from
vllm.transformers_utils.configs.jais
import
JAISConfig
from
vllm.transformers_utils.configs.medusa
import
MedusaConfig
from
vllm.transformers_utils.configs.medusa
import
MedusaConfig
...
@@ -27,4 +28,7 @@ __all__ = [
...
@@ -27,4 +28,7 @@ __all__ = [
"MLPSpeculatorConfig"
,
"MLPSpeculatorConfig"
,
"NemotronConfig"
,
"NemotronConfig"
,
"UltravoxConfig"
,
"UltravoxConfig"
,
# Granite can be removed from here once we have upgraded to
# transformers 4.45+
"GraniteConfig"
,
]
]
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