Downloads · 30 days
10
2% of all-time downloads
LoftQ/Mistral-7B-v0.1-4bit-32rank
Mistral-7B-v0.1-4bit-32rank is a text generation model from LoftQ. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
LoftQ (LoRA-fine-tuning-aware Quantization) provides a quantized backbone Q and LoRA adapters A and B, given a full-precision pre-trained weight W.
Downloads · 30 days
10
2% of all-time downloads
All-time downloads
647
Public
Parameters
7.2B
14.8 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors14.7 GB · 99%
From the Hugging Face model README
| Paper | Code | PEFT Example |
LoftQ (LoRA-fine-tuning-aware Quantization) provides a quantized backbone Q and LoRA adapters A and B, given a full-precision pre-trained weight W.
This model, Mistral-7B-v0.1-4bit-32rank, is obtained from Mistral-7B-v0.1.
The backbone is under LoftQ/Mistral-7B-v0.1-4bit-32rank and LoRA adapters are under the subfolder='loftq_init'.
torch.bfloat16Training. Here's an example of loading this model and preparing for the LoRA fine-tuning.
import torch
from transformers import AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel
MODEL_ID = "LoftQ/Mistral-7B-v0.1-4bit-32rank"
base_model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
torch_dtype=torch.bfloat16, # you may change it with different models
quantization_config=BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.bfloat16, # bfloat16 is recommended
bnb_4bit_use_double_quant=False,
bnb_4bit_quant_type='nf4',
),
)
peft_model = PeftModel.from_pretrained(
base_model,
MODEL_ID,
subfolder="loftq_init",
is_trainable=True,
)
# Do training with peft_model ...
See the full code at our Github Repo
@article{li2023loftq,
title={Loftq: Lora-fine-tuning-aware quantization for large language models},
author={Li, Yixiao and Yu, Yifan and Liang, Chen and He, Pengcheng and Karampatziakis, Nikos and Chen, Weizhu and Zhao, Tuo},
journal={arXiv preprint arXiv:2310.08659},
year={2023}
}