Fix Mistral model (#1220)

This commit is contained in:
Woosuk Kwon
2023-09-28 10:44:05 -07:00
committed by GitHub
parent bb1ba58f06
commit a8e98aee0c
4 changed files with 27 additions and 14 deletions
+9
View File
@@ -17,6 +17,15 @@ _CONFIG_REGISTRY = {
def get_config(model: str,
trust_remote_code: bool,
revision: Optional[str] = None) -> PretrainedConfig:
# NOTE: Because the Mistral model in HF hub does not have
# `configuration_mistral.py`, we cannot use `AutoConfig` to load the
# config. Instead, we use `MistralConfig` directly.
# NOTE: This is a hack. This does not work for local models.
# FIXME: Remove this once the Mistral model is available in the stable
# version of HF transformers.
if "mistral" in model.lower():
return MistralConfig.from_pretrained(model, revision=revision)
try:
config = AutoConfig.from_pretrained(
model, trust_remote_code=trust_remote_code, revision=revision)
@@ -6,6 +6,7 @@ from vllm.transformers_utils.configs.qwen import QWenConfig
# tiiuae/falcon-7b(-instruct) models. Newer Falcon models will use the
# `FalconConfig` class from the official HuggingFace transformers library.
from vllm.transformers_utils.configs.falcon import RWConfig
from vllm.transformers_utils.configs.mistral import MistralConfig
__all__ = [
"MPTConfig",
@@ -13,4 +14,5 @@ __all__ = [
"AquilaConfig",
"QWenConfig",
"RWConfig",
"MistralConfig",
]