Update README.md
Browse files
README.md
CHANGED
@@ -1,178 +1,190 @@
|
|
1 |
---
|
2 |
-
license:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
4 |
|
5 |
-
#
|
6 |
|
7 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
8 |
|
9 |
|
|
|
10 |
|
11 |
-
|
|
|
12 |
|
13 |
-
### Model Description
|
14 |
|
15 |
-
|
|
|
16 |
|
17 |
-
|
18 |
|
19 |
-
|
20 |
-
- **Funded by [optional]:** [More Information Needed]
|
21 |
-
- **Shared by [optional]:** [More Information Needed]
|
22 |
-
- **Model type:** [More Information Needed]
|
23 |
-
- **Language(s) (NLP):** [More Information Needed]
|
24 |
-
- **License:** [More Information Needed]
|
25 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
26 |
|
27 |
-
###
|
28 |
|
29 |
-
|
|
|
30 |
|
31 |
-
|
32 |
-
- **Paper [optional]:** [More Information Needed]
|
33 |
-
- **Demo [optional]:** [More Information Needed]
|
34 |
|
35 |
-
|
|
|
|
|
|
|
36 |
|
37 |
-
|
|
|
38 |
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
|
|
|
|
|
42 |
|
43 |
-
|
44 |
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
-
|
48 |
|
49 |
-
|
|
|
|
|
50 |
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
54 |
|
55 |
-
|
56 |
|
57 |
-
|
|
|
|
|
|
|
|
|
58 |
|
59 |
-
|
|
|
|
|
60 |
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
-
|
|
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
[More Information Needed]
|
129 |
-
|
130 |
-
#### Summary
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
## Model Examination [optional]
|
135 |
-
|
136 |
-
<!-- Relevant interpretability work for the model goes here -->
|
137 |
-
|
138 |
-
[More Information Needed]
|
139 |
-
|
140 |
-
## Environmental Impact
|
141 |
-
|
142 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
143 |
-
|
144 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
145 |
-
|
146 |
-
- **Hardware Type:** [More Information Needed]
|
147 |
-
- **Hours used:** [More Information Needed]
|
148 |
-
- **Cloud Provider:** [More Information Needed]
|
149 |
-
- **Compute Region:** [More Information Needed]
|
150 |
-
- **Carbon Emitted:** [More Information Needed]
|
151 |
-
|
152 |
-
## Technical Specifications [optional]
|
153 |
-
|
154 |
-
### Model Architecture and Objective
|
155 |
-
|
156 |
-
[More Information Needed]
|
157 |
-
|
158 |
-
### Compute Infrastructure
|
159 |
-
|
160 |
-
[More Information Needed]
|
161 |
-
|
162 |
-
#### Hardware
|
163 |
-
|
164 |
-
[More Information Needed]
|
165 |
-
|
166 |
-
#### Software
|
167 |
-
|
168 |
-
[More Information Needed]
|
169 |
-
|
170 |
-
## Citation [optional]
|
171 |
-
|
172 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
173 |
-
|
174 |
-
**BibTeX:**
|
175 |
-
|
176 |
-
[More Information Needed]
|
177 |
-
|
178 |
-
**APA:**
|
|
|
1 |
---
|
2 |
+
license: cc-by-nc-4.0
|
3 |
+
base_model: google/gemma-7b-it
|
4 |
+
tags:
|
5 |
+
- generated_from_trainer
|
6 |
+
- axolotl
|
7 |
+
- gemma
|
8 |
+
- instruct
|
9 |
+
- finetune
|
10 |
+
- chatml
|
11 |
+
- gpt4
|
12 |
+
- synthetic data
|
13 |
+
- distillation
|
14 |
+
model-index:
|
15 |
+
- name: gemma-7b-openhermes
|
16 |
+
results: []
|
17 |
+
datasets:
|
18 |
+
- mlabonne/chatml-OpenHermes2.5-dpo-binarized-alpha
|
19 |
+
language:
|
20 |
+
- en
|
21 |
+
library_name: transformers
|
22 |
+
pipeline_tag: text-generation
|
23 |
---
|
24 |
+
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
25 |
+
should probably proofread and complete it, then remove this comment. -->
|
26 |
|
27 |
+
# gemma-7b-openhermes
|
28 |
|
|
|
29 |
|
30 |
|
31 |
+
![image/jpeg](https://cdn-uploads.huggingface.co/production/uploads/64e380b2e12618b261fa6ba0/mh-NUO_aNbQpD_NAuFv7g.jpeg)
|
32 |
|
33 |
+
gemma-7b-openhermes is a variant of the Gemma 7B language model, which has been further fine-tuned on the OpenHermes-2.5 preference dataset
|
34 |
+
using QLoRA.
|
35 |
|
|
|
36 |
|
37 |
+
* [google/gemma-7b-it](https://huggingface.co/google/gemma-7b-it)
|
38 |
+
* [mlabonne/chatml-OpenHermes2.5-dpo-binarized-alpha](https://huggingface.co/datasets/mlabonne/chatml-OpenHermes2.5-dpo-binarized-alpha)
|
39 |
|
40 |
+
</details><br>
|
41 |
|
42 |
+
## Usage
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
+
### Chat Template
|
45 |
|
46 |
+
The instruction-tuned models use a chat template that must be adhered to for conversational use.
|
47 |
+
The easiest way to apply it is using the tokenizer's built-in chat template, as shown in the following snippet.
|
48 |
|
49 |
+
Let's load the model and apply the chat template to a conversation. In this example, we'll start with a single user interaction:
|
|
|
|
|
50 |
|
51 |
+
```py
|
52 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
53 |
+
import transformers
|
54 |
+
import torch
|
55 |
|
56 |
+
model_id = "abideen/gemma-7b-openhermes"
|
57 |
+
dtype = torch.bfloat16
|
58 |
|
59 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
60 |
+
model = AutoModelForCausalLM.from_pretrained(
|
61 |
+
model_id,
|
62 |
+
device_map="cuda",
|
63 |
+
torch_dtype=dtype,
|
64 |
+
)
|
65 |
|
66 |
+
chat = [{ "role": "user", "content": "What is a Language Model?" }]
|
67 |
+
prompt = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
|
68 |
+
```
|
69 |
|
70 |
+
After the prompt is ready, generation can be performed like this:
|
71 |
|
72 |
+
```py
|
73 |
+
inputs = tokenizer.encode(prompt, add_special_tokens=True, return_tensors="pt")
|
74 |
+
outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=250)
|
75 |
+
print(tokenizer.decode(outputs[0]))
|
76 |
+
```
|
77 |
+
|
78 |
+
### Inputs and outputs
|
79 |
+
|
80 |
+
* **Input:** Text string, such as a question, a prompt, or a document to be
|
81 |
+
summarized.
|
82 |
+
* **Output:** Generated English-language text in response to the input, such
|
83 |
+
as an answer to a question, or a summary of a document.
|
84 |
|
85 |
+
## Evaluation data
|
86 |
|
87 |
+
🏆 Evals coming soon.
|
88 |
+
|
89 |
+
### Training hyperparameters
|
90 |
|
91 |
+
The following hyperparameters were used during training:
|
92 |
+
- learning_rate: 5e-07
|
93 |
+
- train_batch_size: 1
|
94 |
+
- eval_batch_size: 8
|
95 |
+
- seed: 42
|
96 |
+
- gradient_accumulation_steps: 8
|
97 |
+
- total_train_batch_size: 8
|
98 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
99 |
+
- lr_scheduler_type: cosine
|
100 |
+
- lr_scheduler_warmup_steps: 100
|
101 |
+
- training_steps: 1000
|
102 |
|
|
|
103 |
|
104 |
+
### 📝 Axolotl Configuration
|
105 |
|
106 |
+
```yaml
|
107 |
+
base_model: google/gemma-7b-it
|
108 |
+
model_type: GemmaForCausalLM
|
109 |
+
tokenizer_type: GemmaTokenizer
|
110 |
+
trust_remote_code: true
|
111 |
|
112 |
+
load_in_8bit: false
|
113 |
+
load_in_4bit: true
|
114 |
+
strict: false
|
115 |
|
116 |
+
rl: dpo
|
117 |
+
chat_template: chatml
|
118 |
+
datasets:
|
119 |
+
- path: mlabonne/chatml-OpenHermes2.5-dpo-binarized-alpha
|
120 |
+
split: train
|
121 |
+
type: chatml.intel
|
122 |
+
dataset_prepared_path:
|
123 |
+
val_set_size: 0.01
|
124 |
+
output_dir: ./out
|
125 |
|
126 |
+
adapter: qlora
|
127 |
+
lora_model_dir:
|
128 |
|
129 |
+
sequence_len: 1800
|
130 |
+
sample_packing: false
|
131 |
+
pad_to_sequence_len: false
|
132 |
+
|
133 |
+
lora_r: 16
|
134 |
+
lora_alpha: 16
|
135 |
+
lora_dropout: 0.05
|
136 |
+
lora_target_linear: true
|
137 |
+
lora_fan_in_fan_out:
|
138 |
+
lora_target_modules:
|
139 |
+
|
140 |
+
wandb_project: gemma
|
141 |
+
wandb_entity:
|
142 |
+
wandb_watch:
|
143 |
+
wandb_name:
|
144 |
+
wandb_log_model:
|
145 |
+
|
146 |
+
gradient_accumulation_steps: 8
|
147 |
+
micro_batch_size: 1
|
148 |
+
num_epochs: 1
|
149 |
+
optimizer: paged_adamw_32bit
|
150 |
+
lr_scheduler: cosine
|
151 |
+
learning_rate: 5e-7
|
152 |
+
|
153 |
+
train_on_inputs: false
|
154 |
+
group_by_length: false
|
155 |
+
bf16: true
|
156 |
+
fp16: false
|
157 |
+
tf32: true
|
158 |
+
|
159 |
+
gradient_checkpointing: true
|
160 |
+
early_stopping_patience:
|
161 |
+
resume_from_checkpoint:
|
162 |
+
local_rank:
|
163 |
+
logging_steps: 1
|
164 |
+
xformers_attention:
|
165 |
+
flash_attention: false
|
166 |
+
|
167 |
+
warmup_steps: 100
|
168 |
+
evals_per_epoch: 1
|
169 |
+
eval_table_size:
|
170 |
+
eval_table_max_new_tokens: 128
|
171 |
+
save_steps: 1000
|
172 |
+
max_steps: 1000
|
173 |
+
debug:
|
174 |
+
deepspeed:
|
175 |
+
weight_decay: 0.0
|
176 |
+
fsdp:
|
177 |
+
fsdp_config:
|
178 |
+
special_tokens:
|
179 |
+
```
|
180 |
+
|
181 |
+
|
182 |
+
### Framework versions
|
183 |
+
|
184 |
+
- Transformers 4.39.0.dev0
|
185 |
+
- Pytorch 2.1.2+cu118
|
186 |
+
- Datasets 2.17.0
|
187 |
+
- Tokenizers 0.15.0
|
188 |
+
- axolotl: 0.4.0
|
189 |
+
|
190 |
+
[<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|