Update README.md
Browse files
README.md
CHANGED
@@ -1,202 +1,136 @@
|
|
|
|
1 |
---
|
2 |
base_model: meta-llama/Llama-2-7b-hf
|
3 |
library_name: peft
|
4 |
---
|
5 |
|
6 |
-
# Model Card for Model
|
7 |
-
|
8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
9 |
|
|
|
10 |
|
|
|
11 |
|
12 |
## Model Details
|
13 |
|
14 |
### Model Description
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
- **Developed by:**
|
21 |
-
- **
|
22 |
-
- **
|
23 |
-
- **
|
24 |
-
- **
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
|
28 |
-
### Model Sources
|
29 |
|
30 |
-
|
|
|
31 |
|
32 |
-
|
33 |
-
- **Paper [optional]:** [More Information Needed]
|
34 |
-
- **Demo [optional]:** [More Information Needed]
|
35 |
-
|
36 |
-
## Uses
|
37 |
-
|
38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
39 |
|
40 |
### Direct Use
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
[More Information Needed]
|
45 |
|
46 |
-
### Downstream Use
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
[More Information Needed]
|
51 |
|
52 |
### Out-of-Scope Use
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
[More Information Needed]
|
57 |
-
|
58 |
-
## Bias, Risks, and Limitations
|
59 |
-
|
60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
61 |
-
|
62 |
-
[More Information Needed]
|
63 |
-
|
64 |
-
### Recommendations
|
65 |
-
|
66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
67 |
-
|
68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
69 |
-
|
70 |
-
## How to Get Started with the Model
|
71 |
-
|
72 |
-
Use the code below to get started with the model.
|
73 |
-
|
74 |
-
[More Information Needed]
|
75 |
-
|
76 |
-
## Training Details
|
77 |
-
|
78 |
-
### Training Data
|
79 |
-
|
80 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
81 |
-
|
82 |
-
[More Information Needed]
|
83 |
-
|
84 |
-
### Training Procedure
|
85 |
-
|
86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
87 |
-
|
88 |
-
#### Preprocessing [optional]
|
89 |
|
90 |
-
|
91 |
|
|
|
92 |
|
93 |
-
|
94 |
|
95 |
-
|
96 |
|
97 |
-
|
|
|
98 |
|
99 |
-
|
100 |
|
101 |
-
|
|
|
|
|
|
|
|
|
102 |
|
103 |
## Evaluation
|
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 |
-
|
129 |
-
[
|
130 |
-
|
131 |
-
#### Summary
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
## Model Examination [optional]
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
|
141 |
## Environmental Impact
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
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).
|
146 |
-
|
147 |
-
- **Hardware Type:** [More Information Needed]
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
-
|
153 |
-
## Technical Specifications [optional]
|
154 |
-
|
155 |
-
### Model Architecture and Objective
|
156 |
-
|
157 |
-
[More Information Needed]
|
158 |
-
|
159 |
-
### Compute Infrastructure
|
160 |
|
161 |
-
|
|
|
162 |
|
163 |
-
#### Hardware
|
164 |
|
165 |
-
|
166 |
|
167 |
-
|
168 |
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
-
##
|
172 |
|
173 |
-
|
174 |
-
|
175 |
-
**BibTeX:**
|
176 |
-
|
177 |
-
[More Information Needed]
|
178 |
-
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
## More Information [optional]
|
190 |
-
|
191 |
-
[More Information Needed]
|
192 |
-
|
193 |
-
## Model Card Authors [optional]
|
194 |
-
|
195 |
-
[More Information Needed]
|
196 |
|
197 |
## Model Card Contact
|
198 |
|
199 |
-
|
|
|
200 |
### Framework versions
|
201 |
|
202 |
-
- PEFT 0.15.1
|
|
|
|
1 |
+
|
2 |
---
|
3 |
base_model: meta-llama/Llama-2-7b-hf
|
4 |
library_name: peft
|
5 |
---
|
6 |
|
7 |
+
# Model Card for Instruction Backtranslation (Backward Model)
|
|
|
|
|
8 |
|
9 |
+
## Model Overview
|
10 |
|
11 |
+
This repository contains a fine-tuned version of the Llama-2-7b-hf model specifically trained for **Instruction Backtranslation**, implementing the method described in the paper "Self Alignment with Instruction Backtranslation." The model is trained as a backward model to predict original instructions given their corresponding outputs. This reverse training aims to improve model alignment and self-consistency.
|
12 |
|
13 |
## Model Details
|
14 |
|
15 |
### Model Description
|
16 |
|
17 |
+
The model utilizes the LLaMA-2 architecture fine-tuned using Low-Rank Adaptation (LoRA) techniques (PEFT library). The primary goal is to reconstruct instructions (`x`) from outputs (`y`), thus creating pairs `(y, x)` for backward prediction.
|
|
|
|
|
18 |
|
19 |
+
- **Developed by:** Abhishek Sagar Sanda
|
20 |
+
- **Model type:** LoRA-finetuned Causal LM
|
21 |
+
- **Language(s):** English
|
22 |
+
- **License:** Apache-2.0 (consistent with base LLaMA-2 model)
|
23 |
+
- **Finetuned from:** [meta-llama/Llama-2-7b-hf](https://huggingface.co/meta-llama/Llama-2-7b-hf)
|
|
|
|
|
24 |
|
25 |
+
### Model Sources
|
26 |
|
27 |
+
- **Paper:** [Self Alignment with Instruction Backtranslation](https://arxiv.org/abs/2308.06259)
|
28 |
+
- **Base Model Repository:** [meta-llama/Llama-2-7b-hf](https://huggingface.co/meta-llama/Llama-2-7b-hf)
|
29 |
|
30 |
+
## Intended Uses
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
### Direct Use
|
33 |
|
34 |
+
- Generating original instructions from outputs for alignment purposes.
|
35 |
+
- Research in model alignment, self-consistency, and instruction-following behavior.
|
|
|
36 |
|
37 |
+
### Downstream Use
|
38 |
|
39 |
+
- Enhancing forward instruction-following models via self-alignment methods.
|
40 |
+
- Improving instruction tuning datasets by generating diverse instructions from desired outputs.
|
|
|
41 |
|
42 |
### Out-of-Scope Use
|
43 |
|
44 |
+
- This model is not suited for general question-answering or generic text generation tasks.
|
45 |
+
- Avoid using in contexts requiring high factual accuracy without additional verification.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
+
## Training Data
|
48 |
|
49 |
+
The model was trained on the **OpenAssistant-Guanaco** training dataset, focusing on `(output, instruction)` pairs for backward prediction.
|
50 |
|
51 |
+
## Training Procedure
|
52 |
|
53 |
+
### Preprocessing
|
54 |
|
55 |
+
- Dataset pairs were inverted to use outputs (`y`) as input and instructions (`x`) as labels.
|
56 |
+
- Standard tokenization was applied using LLaMA's tokenizer.
|
57 |
|
58 |
+
### Training Hyperparameters
|
59 |
|
60 |
+
- **LoRA Rank (r):** 8
|
61 |
+
- **LoRA Alpha:** 32
|
62 |
+
- **LoRA Dropout:** 0.05
|
63 |
+
- **Target Modules:** `k_proj`, `q_proj`, `v_proj`, `o_proj`
|
64 |
+
- **Training Precision:** bf16 mixed precision
|
65 |
|
66 |
## Evaluation
|
67 |
|
68 |
+
Evaluation involved assessing the accuracy of generated instructions against the original instructions. Key metrics include BLEU, ROUGE, and qualitative human evaluations.
|
69 |
|
70 |
+
## Technical Specifications
|
71 |
|
72 |
+
### Model Architecture
|
73 |
|
74 |
+
- LLaMA-2 Transformer Architecture with PEFT LoRA Adaptation
|
75 |
+
- **Tokenizer:** LLaMA Tokenizer (`tokenizer_class`: LlamaTokenizer)
|
76 |
+
- **Maximum Sequence Length:** Practically unlimited (`model_max_length` is set very large)
|
77 |
|
78 |
+
### Hardware
|
79 |
|
80 |
+
- GPUs: NVIDIA A100 GPUs recommended
|
81 |
+
- Cloud Provider: AWS/GCP
|
82 |
|
83 |
+
## How to Use
|
84 |
|
85 |
+
Here's a quick start guide:
|
86 |
|
87 |
+
```python
|
88 |
+
from peft import PeftModel, PeftConfig
|
89 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
90 |
|
91 |
+
base_model_name = "meta-llama/Llama-2-7b-hf"
|
92 |
+
peft_model_name = "your_hf_model_path"
|
93 |
|
94 |
+
config = PeftConfig.from_pretrained(peft_model_name)
|
95 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
|
96 |
+
model = AutoModelForCausalLM.from_pretrained(base_model_name)
|
97 |
+
model = PeftModel.from_pretrained(model, peft_model_name)
|
98 |
|
99 |
+
inputs = tokenizer("Output text goes here", return_tensors="pt")
|
100 |
+
outputs = model.generate(**inputs)
|
101 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
102 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
## Environmental Impact
|
105 |
|
106 |
+
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
+
- **Hardware Type:** NVIDIA GeForce RTX 4070 GPU
|
109 |
+
- **Hours Used:** 3hrs
|
110 |
|
|
|
111 |
|
112 |
+
## Citation
|
113 |
|
114 |
+
If you use this model, please cite:
|
115 |
|
116 |
+
```bibtex
|
117 |
+
@article{xu2023selfalignment,
|
118 |
+
title={Self Alignment with Instruction Backtranslation},
|
119 |
+
author={Xu, et al.},
|
120 |
+
journal={arXiv preprint arXiv:2308.06259},
|
121 |
+
year={2023}
|
122 |
+
}
|
123 |
+
```
|
124 |
|
125 |
+
## Model Card Author
|
126 |
|
127 |
+
- Abhishek Sagar Sanda
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
## Model Card Contact
|
130 |
|
131 | |
132 |
+
|
133 |
### Framework versions
|
134 |
|
135 |
+
- PEFT 0.15.1
|
136 |
+
- Transformers 4.38.1
|