Edit model card

Bitsandbytes quantization of https://huggingface.co/deepseek-ai/DeepSeek-Coder-V2-Lite-Base.

See https://huggingface.co/blog/4bit-transformers-bitsandbytes for instructions.

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers import BitsAndBytesConfig
import torch

# Define the 4-bit configuration
nf4_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_use_double_quant=True,
    bnb_4bit_compute_dtype=torch.bfloat16
)

# Load the pre-trained model with the 4-bit quantization configuration
model = AutoModelForCausalLM.from_pretrained("deepseek-ai/DeepSeek-Coder-V2-Lite-Base", quantization_config=nf4_config)

# Load the tokenizer associated with the model
tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/DeepSeek-Coder-V2-Lite-Base")

# Push the model and tokenizer to the Hugging Face hub
model.push_to_hub("onekq-ai/DeepSeek-Coder-V2-Lite-Base-bnb-4bit", use_auth_token=True)
tokenizer.push_to_hub("onekq-ai/DeepSeek-Coder-V2-Lite-Base-bnb-4bit", use_auth_token=True)
Downloads last month
40
Safetensors
Model size
8.31B params
Tensor type
F32
·
FP16
·
U8
·
Inference Examples
Inference API (serverless) does not yet support model repos that contain custom code.

Model tree for onekq-ai/DeepSeek-Coder-V2-Lite-Base-bnb-4bit

Quantized
(9)
this model

Collection including onekq-ai/DeepSeek-Coder-V2-Lite-Base-bnb-4bit