model: Support Janus-pro (#3203)
This commit is contained in:
@@ -30,13 +30,20 @@ from transformers import (
|
||||
)
|
||||
from transformers.models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES
|
||||
|
||||
from sglang.srt.configs import ChatGLMConfig, DbrxConfig, ExaoneConfig, Qwen2_5_VLConfig
|
||||
from sglang.srt.configs import (
|
||||
ChatGLMConfig,
|
||||
DbrxConfig,
|
||||
ExaoneConfig,
|
||||
MultiModalityConfig,
|
||||
Qwen2_5_VLConfig,
|
||||
)
|
||||
|
||||
_CONFIG_REGISTRY: Dict[str, Type[PretrainedConfig]] = {
|
||||
ChatGLMConfig.model_type: ChatGLMConfig,
|
||||
DbrxConfig.model_type: DbrxConfig,
|
||||
ExaoneConfig.model_type: ExaoneConfig,
|
||||
Qwen2_5_VLConfig.model_type: Qwen2_5_VLConfig,
|
||||
MultiModalityConfig.model_type: MultiModalityConfig,
|
||||
}
|
||||
|
||||
for name, cls in _CONFIG_REGISTRY.items():
|
||||
@@ -67,6 +74,13 @@ def get_config(
|
||||
model, trust_remote_code=trust_remote_code, revision=revision, **kwargs
|
||||
)
|
||||
|
||||
# FIXME: Pour contents of janus-pro's langauge_config to first-level
|
||||
if isinstance(model, str) and model.lower().startswith("deepseek-ai/janus-pro"):
|
||||
assert hasattr(config, "language_config")
|
||||
for key, val in config.language_config.__dict__.items():
|
||||
setattr(config, key, val)
|
||||
setattr(config, "architectures", ["MultiModalityCausalLM"])
|
||||
|
||||
if config.model_type in _CONFIG_REGISTRY:
|
||||
config_class = _CONFIG_REGISTRY[config.model_type]
|
||||
config = config_class.from_pretrained(model, revision=revision)
|
||||
|
||||
Reference in New Issue
Block a user