TESTtm7873
commited on
Commit
•
75c7729
1
Parent(s):
873c1fc
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
---
|
6 |
+
|
7 |
+
# Model Card for Model ID
|
8 |
+
|
9 |
+
Finetuned mistralai/Mistral-7B-Instruct-v0.2 on TESTtm7873/ChatCat dataset
|
10 |
+
|
11 |
+
### Model Description
|
12 |
+
Developed of our VCC project
|
13 |
+
Finetuned with QLoRA
|
14 |
+
|
15 |
+
To use it:
|
16 |
+
```import torch
|
17 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
18 |
+
|
19 |
+
base_model_id = "mistralai/Mistral-7B-Instruct-v0.2"
|
20 |
+
bnb_config = BitsAndBytesConfig(
|
21 |
+
load_in_4bit=True,
|
22 |
+
bnb_4bit_use_double_quant=True,
|
23 |
+
bnb_4bit_quant_type="nf4",
|
24 |
+
bnb_4bit_compute_dtype=torch.bfloat16
|
25 |
+
)
|
26 |
+
|
27 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
28 |
+
base_model_id, # Mistral, same as before
|
29 |
+
quantization_config=bnb_config, # Same quantization config as before
|
30 |
+
device_map="auto",
|
31 |
+
trust_remote_code=True,
|
32 |
+
)
|
33 |
+
|
34 |
+
eval_tokenizer = AutoTokenizer.from_pretrained(base_model_id, add_bos_token=True, trust_remote_code=True)
|
35 |
+
|
36 |
+
from peft import PeftModel
|
37 |
+
|
38 |
+
ft_model = PeftModel.from_pretrained(base_model, "mistral-journal-finetune/checkpoint-150")
|
39 |
+
|
40 |
+
eval_prompt = "You have the softest fur."
|
41 |
+
model_input = eval_tokenizer(eval_prompt, return_tensors="pt").to("cuda")
|
42 |
+
|
43 |
+
ft_model.eval()
|
44 |
+
with torch.no_grad():
|
45 |
+
print(eval_tokenizer.decode(ft_model.generate(**model_input, max_new_tokens=100, repetition_penalty=1.15)[0], skip_special_tokens=True))```
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
- **Developed by:** testtm
|
50 |
+
- **Funded by:** testtm
|
51 |
+
- **Model type:** Mistral
|
52 |
+
- **Language:** English
|
53 |
+
- **Finetuned from model:** mistralai/Mistral-7B-Instruct-v0.2
|