Downloads · 30 days
10
7% of all-time downloads
FilledVaccum/Llama-3-Nanda-10B-Chat-Quantized-8-Bits
Llama-3-Nanda-10B-Chat-Quantized-8-Bits is a text generation model from FilledVaccum. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as llama3.
This is an 8-bit quantized version of the MBZUAI/Llama-3-Nanda-10B-Chat model, optimized for efficient inference while maintaining high performance. The model has been quantized using BitsAndBytesConfig to reduce memo…
Downloads · 30 days
10
7% of all-time downloads
All-time downloads
148
Public
Parameters
10B
11.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors11.3 GB · 100%
How the weights are stored.
I88.7B · 87%
From the Hugging Face model README
This is an 8-bit quantized version of the MBZUAI/Llama-3-Nanda-10B-Chat model, optimized for efficient inference while maintaining high performance. The model has been quantized using BitsAndBytesConfig to reduce memory footprint from ~37GB to ~10.5GB, making it more accessible for deployment on consumer hardware.
LlamaForCausalLM(
(model): LlamaModel(
(embed_tokens): Embedding(153856, 4096)
(layers): ModuleList(
(0-39): 40 x LlamaDecoderLayer(
(self_attn): LlamaAttention(
(q_proj): Linear(in_features=4096, out_features=4096, bias=False)
(k_proj): Linear(in_features=4096, out_features=1024, bias=False)
(v_proj): Linear(in_features=4096, out_features=1024, bias=False)
(o_proj): Linear(in_features=4096, out_features=4096, bias=False)
)
(mlp): LlamaMLP(
(gate_proj): Linear(in_features=4096, out_features=14336, bias=False)
(up_proj): Linear(in_features=4096, out_features=14336, bias=False)
(down_proj): Linear(in_features=14336, out_features=4096, bias=False)
(act_fn): SiLUActivation()
)
(input_layernorm): LlamaRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): LlamaRMSNorm((4096,), eps=1e-05)
)
)
(norm): LlamaRMSNorm((4096,), eps=1e-05)
(rotary_emb): LlamaRotaryEmbedding()
)
(lm_head): Linear(in_features=4096, out_features=153856, bias=False)
)
This model excels in:
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
# Load model with 8-bit quantization
model_path = "FilledVaccum/Llama-3-Nanda-10B-Chat-Quantized-8-Bits"
device = "cuda" if torch.cuda.is_available() else "cpu"
# Configure 8-bit quantization
quantization_config = BitsAndBytesConfig(load_in_8bit=True)
# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(
model_path,
quantization_config=quantization_config,
device_map="auto",
trust_remote_code=True
)
# Chat template
prompt_template = "<|begin_of_text|><|start_header_id|>system<|end_header_id|>You are a helpful AI assistant.<|eot_id|><|start_header_id|>user<|end_header_id|>{Question}<|eot_id|><|start_header_id|>assistant<|end_header_id|>"
def get_response(question, max_length=500):
text = prompt_template.format(Question=question)
input_ids = tokenizer(text, return_tensors="pt").input_ids.to(device)
with torch.no_grad():
generate_ids = model.generate(
input_ids,
top_p=0.95,
temperature=0.2,
max_length=max_length,
min_length=30,
repetition_penalty=1.3,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.batch_decode(
generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=True
)[0]
return response.split("assistant")[-1].strip()
# Example usage
question = "What is artificial intelligence?"
response = get_response(question)
print(response)
# Hindi example
hindi_question = "मुझे यूएई के बारे में कुछ रोचक तथ्य बताएं?"
hindi_response = get_response(hindi_question)
print(hindi_response)
Recommended parameters for different use cases:
Creative Writing:
generate_ids = model.generate(
input_ids,
temperature=0.8,
top_p=0.9,
max_length=1000,
do_sample=True,
repetition_penalty=1.1
)
Factual Q&A:
generate_ids = model.generate(
input_ids,
temperature=0.2,
top_p=0.95,
max_length=500,
do_sample=True,
repetition_penalty=1.3
)
The model supports automatic device mapping across multiple GPUs:
model = AutoModelForCausalLM.from_pretrained(
model_path,
quantization_config=quantization_config,
device_map="auto" # Automatically distributes across available GPUs
)
| Metric | Value |
|---|---|
| Memory Footprint | 10.47 GB |
| Parameters | 9.98B |
| Quantization | 8-bit INT8 |
| Inference Speed | ~2-3x faster than FP16 |
| Quality Retention | ~95% of original model |
This model is based on MBZUAI/Llama-3-Nanda-10B-Chat, which was fine-tuned for:
The model includes safety mechanisms to:
However, users should be aware of potential biases and limitations inherent in large language models.
This model inherits the license from the base MBZUAI/Llama-3-Nanda-10B-Chat model. Please refer to the original model's license for usage terms.
If you use this model, please cite:
@misc{llama3-nanda-10b-quantized,
title={Llama-3-Nanda-10B-Chat-Quantized-8-Bits},
author={FilledVaccum},
year={2024},
publisher={Hugging Face},
url={https://huggingface.co/FilledVaccum/Llama-3-Nanda-10B-Chat-Quantized-8-Bits}
}
Also cite the original base model:
@misc{llama3-nanda-10b,
title={Llama-3-Nanda-10B-Chat},
author={MBZUAI},
year={2024},
publisher={Hugging Face},
url={https://huggingface.co/MBZUAI/Llama-3-Nanda-10B-Chat}
}
For questions or issues related to this quantized version, please open an issue in the model repository.
This model is provided as-is for research and educational purposes. Users are responsible for ensuring appropriate and ethical use.