Downloads · 30 days
12
23% of all-time downloads
RichardErkhov/ejbejaranos_-_Bitnet-Llama3-from8BM-now2B-8bits
ejbejaranos_-_Bitnet-Llama3-from8BM-now2B-8bits is a machine learning model from RichardErkhov. 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
12
23% of all-time downloads
All-time downloads
52
Public
Parameters
2.4B
3.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors3.4 GB · 99%
How the weights are stored.
I81.3B · 55%
From the Hugging Face model README
Quantization made by Richard Erkhov.
Bitnet-Llama3-from8BM-now2B - bnb 8bits
library_name: transformers license: apache-2.0 datasets:
This project transforms a Llama3 model from 8B parameters to a BitNet architecture with 2B parameters, applying BitLinear layers. Additionally, the model is trained with a predefined dataset and uploaded to Hugging Face for future use.
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
This repository includes scripts to:
Make sure you have all required dependencies installed:
pip install torch transformers datasets wandb huggingface_hub
from transformers import AutoModelForCausalLM, AutoTokenizer
from utils.bitnet_transformation import replace_linears_in_hf
# Load the BitNet model
model = "ejbejaranos/Bitnet-Llama3-from8BM-now2B"
model = AutoModelForCausalLM.from_pretrained(
model,
use_auth_token="YOUR_HF_TOKEN"
)
# Replace BitNet layers for inference
replace_linears_in_hf(model)
tokenizer = AutoTokenizer.from_pretrained("ejbejaranos/Bitnet-Llama3-from8BM-now2B")
# Set up for inference
model.to(device="cuda:0")
prompt = "What is Machine Learning?"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
generate_ids = model.generate(inputs.input_ids, max_length=50)
output = tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
print(output)

During training, the following metrics will be logged to Weights & Biases:
final_loss: 1.4.final_perplexity: 4.2.If you have questions, suggestions, or improvements, feel free to open an Issue or contact us through Hugging Face.
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
Thanks to Hugging Face and Weights & Biases for providing support and tools.