add deepseek v3
This commit is contained in:
parent
2a12142714
commit
2a9498d5df
2 changed files with 56 additions and 0 deletions
53
unsloth/registry/_deepseek.py
Normal file
53
unsloth/registry/_deepseek.py
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
from unsloth.registry.registry import ModelInfo, ModelMeta, QuantType, _register_models
|
||||
|
||||
_IS_DEEPSEEKV3_REGISTERED = False
|
||||
|
||||
class DeepseekV3ModelInfo(ModelInfo):
|
||||
@classmethod
|
||||
def construct_model_name(cls, base_name, version, size, quant_type, instruct_tag):
|
||||
key = f"{base_name}-V{version}"
|
||||
key = cls.append_instruct_tag(key, instruct_tag)
|
||||
key = cls.append_quant_type(key, quant_type)
|
||||
return key
|
||||
|
||||
# Deepseek V3 Model Meta
|
||||
DeepseekV3Meta = ModelMeta(
|
||||
org="deepseek-ai",
|
||||
base_name="DeepSeek",
|
||||
instruct_tags=[None],
|
||||
model_version="3",
|
||||
model_sizes=[""],
|
||||
model_info_cls=DeepseekV3ModelInfo,
|
||||
is_multimodal=False,
|
||||
quant_types=[QuantType.NONE, QuantType.BF16],
|
||||
)
|
||||
|
||||
DeepseekV3_0324Meta = ModelMeta(
|
||||
org="deepseek-ai",
|
||||
base_name="DeepSeek",
|
||||
instruct_tags=[None],
|
||||
model_version="3-0324",
|
||||
model_sizes=[""],
|
||||
model_info_cls=DeepseekV3ModelInfo,
|
||||
is_multimodal=False,
|
||||
quant_types=[QuantType.NONE, QuantType.GGUF],
|
||||
)
|
||||
|
||||
def register_deepseek_v3_models(include_original_model: bool = False):
|
||||
global _IS_DEEPSEEKV3_REGISTERED
|
||||
if _IS_DEEPSEEKV3_REGISTERED:
|
||||
return
|
||||
_register_models(DeepseekV3Meta, include_original_model=include_original_model)
|
||||
_register_models(DeepseekV3_0324Meta, include_original_model=include_original_model)
|
||||
_IS_DEEPSEEKV3_REGISTERED = True
|
||||
|
||||
register_deepseek_v3_models(include_original_model=True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
from unsloth.registry.registry import MODEL_REGISTRY, _check_model_info
|
||||
for model_id, model_info in MODEL_REGISTRY.items():
|
||||
model_info = _check_model_info(model_id)
|
||||
if model_info is None:
|
||||
print(f"\u2718 {model_id}")
|
||||
else:
|
||||
print(f"\u2713 {model_id}")
|
||||
|
|
@ -8,17 +8,20 @@ class QuantType(Enum):
|
|||
UNSLOTH = "unsloth" # dynamic 4-bit quantization
|
||||
GGUF = "GGUF"
|
||||
NONE = "none"
|
||||
BF16 = "bf16" # only for Deepseek V3
|
||||
|
||||
# Tags for Hugging Face model paths
|
||||
BNB_QUANTIZED_TAG = "bnb-4bit"
|
||||
UNSLOTH_DYNAMIC_QUANT_TAG = "unsloth" + "-" + BNB_QUANTIZED_TAG
|
||||
GGUF_TAG = "GGUF"
|
||||
BF16_TAG = "bf16"
|
||||
|
||||
QUANT_TAG_MAP = {
|
||||
QuantType.BNB: BNB_QUANTIZED_TAG,
|
||||
QuantType.UNSLOTH: UNSLOTH_DYNAMIC_QUANT_TAG,
|
||||
QuantType.GGUF: GGUF_TAG,
|
||||
QuantType.NONE: None,
|
||||
QuantType.BF16: BF16_TAG,
|
||||
}
|
||||
|
||||
# NOTE: models registered with org="unsloth" and QUANT_TYPE.NONE are aliases of QUANT_TYPE.UNSLOTH
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue