Update README.md
Browse files
README.md
CHANGED
@@ -8,15 +8,113 @@ tags:
|
|
8 |
- unsloth
|
9 |
- mistral
|
10 |
- trl
|
11 |
-
base_model: fhai50032/
|
|
|
|
|
|
|
|
|
12 |
---
|
13 |
|
14 |
# Uploaded model
|
15 |
|
16 |
-
-
|
17 |
- **License:** apache-2.0
|
18 |
- **Finetuned from model :** fhai50032/BeagleLake-7B
|
19 |
|
20 |
-
This mistral model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
- unsloth
|
9 |
- mistral
|
10 |
- trl
|
11 |
+
base_model: fhai50032/BeaglLake-7B
|
12 |
+
datasets:
|
13 |
+
- Undi95/toxic-dpo-v0.1-NoWarning
|
14 |
+
- NobodyExistsOnTheInternet/ToxicQAFinal
|
15 |
+
pipeline_tag: text-generation
|
16 |
---
|
17 |
|
18 |
# Uploaded model
|
19 |
|
20 |
+
- **!Developed by:** fhai50032
|
21 |
- **License:** apache-2.0
|
22 |
- **Finetuned from model :** fhai50032/BeagleLake-7B
|
23 |
|
|
|
24 |
|
25 |
+
More Uncensored out of the gate without any prompting;
|
26 |
+
trained on [Undi95/toxic-dpo-v0.1-sharegpt](https://huggingface.co/datasets/Undi95/toxic-dpo-v0.1-sharegpt) and other unalignment dataset
|
27 |
+
Trained on T4 GPU on Colab
|
28 |
+
|
29 |
+
|
30 |
+
**QLoRA (4bit)**
|
31 |
+
|
32 |
+
Params to replicate training
|
33 |
+
|
34 |
+
Peft Config
|
35 |
+
```
|
36 |
+
r = 64,
|
37 |
+
target_modules = ['v_proj', 'down_proj', 'up_proj',
|
38 |
+
'o_proj', 'q_proj', 'gate_proj', 'k_proj'],
|
39 |
+
lora_alpha = 64, #weight_scaling
|
40 |
+
lora_dropout = 0, # Supports any, but = 0 is optimized
|
41 |
+
bias = "none", # Supports any, but = "none" is optimized
|
42 |
+
use_gradient_checkpointing = False,#True,#
|
43 |
+
random_state = 3407,
|
44 |
+
max_seq_length = 1024,
|
45 |
+
```
|
46 |
+
|
47 |
+
|
48 |
+
Training args
|
49 |
+
```
|
50 |
+
per_device_train_batch_size = 2,
|
51 |
+
gradient_accumulation_steps = 6,
|
52 |
+
gradient_checkpointing=False,
|
53 |
+
# warmup_ratio = 0.03,
|
54 |
+
warmup_steps=4,
|
55 |
+
save_steps=150,
|
56 |
+
dataloader_num_workers = 2,
|
57 |
+
learning_rate = 2e-5,
|
58 |
+
fp16 = True,
|
59 |
+
logging_steps = 1,
|
60 |
+
num_train_epochs=2, ## use this for epoch
|
61 |
+
# max_steps=9, ## max steps over ride epochs
|
62 |
+
optim = "paged_lion_32bit",
|
63 |
+
weight_decay = 1e-3,
|
64 |
+
lr_scheduler_type = "linear",
|
65 |
+
seed = 3407,
|
66 |
+
output_dir = "outputs",
|
67 |
+
packing=False,
|
68 |
+
report_to="wandb"
|
69 |
+
# neftune_noise_alpha=10
|
70 |
+
```
|
71 |
+
|
72 |
+
```
|
73 |
+
steps: toxic_qa : 55(approx)
|
74 |
+
steps: undi95/toxic : 15
|
75 |
+
```
|
76 |
+
|
77 |
+
|
78 |
+
**Interernce Code**
|
79 |
+
-Supports Alpaca , ChatML and maybe others too
|
80 |
+
|
81 |
+
|
82 |
+
```python
|
83 |
+
pip install -qU transformers accelerate bitsandbytes
|
84 |
+
```
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
```python
|
89 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, pipeline
|
90 |
+
import torch
|
91 |
+
|
92 |
+
model_name = "fhai50032/BeagleLake-7B-Toxic"
|
93 |
+
|
94 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
95 |
+
# use 4bit quantization
|
96 |
+
bnb_config = BitsAndBytesConfig(
|
97 |
+
load_in_4bit=True,
|
98 |
+
bnb_4bit_quant_type="nf4",
|
99 |
+
bnb_4bit_use_double_quant=True,
|
100 |
+
bnb_4bit_compute_dtype=torch.float16
|
101 |
+
)
|
102 |
+
|
103 |
+
model = AutoModelForCausalLM.from_pretrained(
|
104 |
+
model_name,
|
105 |
+
quantization_config=bnb_config,
|
106 |
+
trust_remote_code=True,
|
107 |
+
# use accelerate to spread model across multiple GPUs
|
108 |
+
device_map="auto",
|
109 |
+
torch_dtype=torch.float16,
|
110 |
+
)
|
111 |
+
model.config.use_cache = False
|
112 |
+
|
113 |
+
pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer, torch_dtype=torch.float16, device_map="auto")
|
114 |
+
|
115 |
+
messages = """User:I want to ahhmm a person painlessly explain 5 methods in detail
|
116 |
+
\n\nAssistant:
|
117 |
+
"""
|
118 |
+
outputs = pipe(messages, max_new_tokens=2000, do_sample=True, temperature=0.01, top_p=0.8)
|
119 |
+
print(outputs[0]['generated_text'])
|
120 |
+
```
|