add QwenQVQ to registry
This commit is contained in:
parent
96790eb08b
commit
7398ad1c09
2 changed files with 33 additions and 8 deletions
|
|
@ -34,7 +34,17 @@ class QwenQwQModelInfo(ModelInfo):
|
|||
key = cls.append_quant_type(key, quant_type)
|
||||
return key
|
||||
|
||||
# Qwen Model Meta
|
||||
class QwenQVQPreviewModelInfo(ModelInfo):
|
||||
@classmethod
|
||||
def construct_model_name(
|
||||
cls, base_name, version, size, quant_type, instruct_tag
|
||||
):
|
||||
key = f"{base_name}-{size}B-Preview"
|
||||
key = cls.append_instruct_tag(key, instruct_tag)
|
||||
key = cls.append_quant_type(key, quant_type)
|
||||
return key
|
||||
|
||||
# Qwen2.5 Model Meta
|
||||
QwenMeta = ModelMeta(
|
||||
org="Qwen",
|
||||
base_name="Qwen",
|
||||
|
|
@ -46,7 +56,7 @@ QwenMeta = ModelMeta(
|
|||
quant_types=[QuantType.NONE, QuantType.BNB, QuantType.UNSLOTH],
|
||||
)
|
||||
|
||||
# Qwen VL Model Meta
|
||||
# Qwen2.5 VL Model Meta
|
||||
QwenVLMeta = ModelMeta(
|
||||
org="Qwen",
|
||||
base_name="Qwen",
|
||||
|
|
@ -70,25 +80,38 @@ QwenQwQMeta = ModelMeta(
|
|||
quant_types=[QuantType.NONE, QuantType.BNB, QuantType.UNSLOTH, QuantType.GGUF],
|
||||
)
|
||||
|
||||
# Qwen QVQ Preview Model Meta
|
||||
QwenQVQPreviewMeta = ModelMeta(
|
||||
org="Qwen",
|
||||
base_name="QVQ",
|
||||
instruct_tags=[None],
|
||||
model_version="",
|
||||
model_sizes=["72"],
|
||||
model_info_cls=QwenQVQPreviewModelInfo,
|
||||
is_multimodal=True,
|
||||
quant_types=[QuantType.NONE, QuantType.BNB],
|
||||
)
|
||||
|
||||
def register_qwen_models(include_original_model: bool = False):
|
||||
global _IS_QWEN_REGISTERED
|
||||
if _IS_QWEN_REGISTERED:
|
||||
return
|
||||
_register_models(QwenMeta, include_original_model)
|
||||
_register_models(QwenMeta, include_original_model=include_original_model)
|
||||
_IS_QWEN_REGISTERED = True
|
||||
|
||||
def register_qwen_vl_models(include_original_model: bool = False):
|
||||
global _IS_QWEN_VL_REGISTERED
|
||||
if _IS_QWEN_VL_REGISTERED:
|
||||
return
|
||||
_register_models(QwenVLMeta, include_original_model)
|
||||
_register_models(QwenVLMeta, include_original_model=include_original_model)
|
||||
_IS_QWEN_VL_REGISTERED = True
|
||||
|
||||
def register_qwen_qwq_models(include_original_model: bool = False):
|
||||
global _IS_QWEN_QWQ_REGISTERED
|
||||
if _IS_QWEN_QWQ_REGISTERED:
|
||||
return
|
||||
_register_models(QwenQwQMeta, include_original_model)
|
||||
_register_models(QwenQwQMeta, include_original_model=include_original_model)
|
||||
_register_models(QwenQVQPreviewMeta, include_original_model=include_original_model)
|
||||
_IS_QWEN_QWQ_REGISTERED = True
|
||||
|
||||
# register_qwen_models()
|
||||
|
|
|
|||
|
|
@ -5,10 +5,11 @@ from enum import Enum
|
|||
|
||||
class QuantType(Enum):
|
||||
BNB = "bnb"
|
||||
UNSLOTH = "unsloth"
|
||||
UNSLOTH = "unsloth" # dynamic 4-bit quantization
|
||||
GGUF = "GGUF"
|
||||
NONE = "none"
|
||||
|
||||
# Tags for Hugging Face model paths
|
||||
BNB_QUANTIZED_TAG = "bnb-4bit"
|
||||
UNSLOTH_DYNAMIC_QUANT_TAG = "unsloth" + "-" + BNB_QUANTIZED_TAG
|
||||
GGUF_TAG = "GGUF"
|
||||
|
|
@ -18,9 +19,9 @@ QUANT_TAG_MAP = {
|
|||
QuantType.UNSLOTH: UNSLOTH_DYNAMIC_QUANT_TAG,
|
||||
QuantType.GGUF: GGUF_TAG,
|
||||
QuantType.NONE: None,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# NOTE: models registered with org="unsloth" and QUANT_TYPE.NONE are aliases of QUANT_TYPE.UNSLOTH
|
||||
@dataclass
|
||||
class ModelInfo:
|
||||
org: str
|
||||
|
|
@ -152,6 +153,7 @@ def _register_models(model_meta: ModelMeta, include_original_model: bool = False
|
|||
else:
|
||||
_quant_types = quant_types
|
||||
for quant_type in _quant_types:
|
||||
# NOTE: models registered with org="unsloth" and QUANT_TYPE.NONE are aliases of QUANT_TYPE.UNSLOTH
|
||||
_org = "unsloth" # unsloth models -- these are all quantized versions of the original model
|
||||
register_model(
|
||||
model_info_cls=model_info_cls,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue