File size: 1,163 Bytes
81ebb94 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# Model Card for Mistral-7B-Instruct-v0.2-8bit
The Mistral-7B-Instruct-v0.2-8bit is a 8bit quantize version with torch_dtype=torch.float16, I just load in 8bit and push here [Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2).
For full details of this model please read our [paper](https://arxiv.org/abs/2310.06825) and [release blog post](https://mistral.ai/news/la-plateforme/).
```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "mistralai/Mistral-7B-Instruct-v0.2"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
load_in_8bit=True,
use_flash_attention_2=True,
torch_dtype=torch.float16,
)
model.push_to_hub("LsTam/Mistral-7B-Instruct-v0.2-8bit")
```
To use it:
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
tok_name = "mistralai/Mistral-7B-Instruct-v0.2"
model_name = "LsTam/Mistral-7B-Instruct-v0.2-8bit"
tokenizer = AutoTokenizer.from_pretrained(tok_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
use_flash_attention_2=True,
)
``` |