Downloads · 30 days
13
27% of all-time downloads
yamatazen/ForgottenMaid-12B-bnb
ForgottenMaid-12B-bnb is a machine learning model from yamatazen. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
13
27% of all-time downloads
All-time downloads
49
Public
Parameters
12.6B
8.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors8.3 GB · 100%
How the weights are stored.
U811.2B · 89%
From the Hugging Face model README
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
import torch
import sys
# Define model ID
model_id = sys.argv[1]
# Configure quantization
quantization_config = BitsAndBytesConfig(
load_in_4bit=True, # Use 4-bit quantization (or load_in_8bit=True for 8-bit)
bnb_4bit_quant_type="nf4", # Normal Float 4-bit (nf4) for better precision
bnb_4bit_compute_dtype=torch.float16, # Compute in float16 for efficiency
bnb_4bit_use_double_quant=True # Double quantization for further memory savings
)
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_id)
# Load quantized model
model = AutoModelForCausalLM.from_pretrained(
model_id,
quantization_config=quantization_config,
device_map="auto", # Automatically map layers to GPU/CPU
torch_dtype=torch.float16
)
# Save model and tokenizer
save_path = sys.argv[2]
model.save_pretrained(save_path)
tokenizer.save_pretrained(save_path)