Locutusque commited on
Commit
99b50d4
1 Parent(s): b342964

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +238 -0
README.md ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ datasets:
4
+ - Locutusque/InstructMix
5
+ language:
6
+ - en
7
+ metrics:
8
+ - bleu
9
+ - perplexity
10
+ pipeline_tag: text-generation
11
+ ---
12
+
13
+ # Model Card for Model ID
14
+
15
+ <!-- Provide a quick summary of what the model is/does. -->
16
+ This a fine-tuned version of gpt2 on Locutusque/InstructMix.
17
+
18
+ ## Model Details
19
+ This model performs significantly better than Locutusque/gpt2-conversational-or-qa. Here are the training results
20
+ BLEU - 26
21
+ Perplexity - 12
22
+ ### Model Description
23
+
24
+ <!-- Provide a longer summary of what this model is. -->
25
+
26
+
27
+
28
+ - **Developed by:** Locutusque
29
+ - **Shared by [optional]:** [More Information Needed]
30
+ - **Model type:** GPT-2
31
+ - **Language(s) (NLP):** English
32
+ - **License:** [More Information Needed]
33
+ - **Finetuned from model [optional]:** GPT-2
34
+
35
+ ### Model Sources [optional]
36
+
37
+ <!-- Provide the basic links for the model. -->
38
+
39
+ - **Repository:** [More Information Needed]
40
+ - **Paper [optional]:** [More Information Needed]
41
+ - **Demo [optional]:** [More Information Needed]
42
+
43
+ ## Uses
44
+
45
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
46
+ This model is designed to follow instructions, or partake in conversations.
47
+
48
+ ### Direct Use
49
+
50
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
51
+
52
+ Instruction-following or conversational.
53
+
54
+ ### Downstream Use [optional]
55
+
56
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
57
+
58
+ [More Information Needed]
59
+
60
+ ### Out-of-Scope Use
61
+
62
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
63
+
64
+ [More Information Needed]
65
+
66
+ ## Bias, Risks, and Limitations
67
+
68
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
69
+
70
+ [More Information Needed]
71
+
72
+ ### Recommendations
73
+
74
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
75
+
76
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
77
+
78
+ ## How to Get Started with the Model
79
+
80
+ Use the code below to get started with the model.
81
+
82
+ ```python
83
+ import torch
84
+ from transformers import GPT2Tokenizer, GPT2LMHeadModel
85
+
86
+ tokenizer = GPT2Tokenizer.from_pretrained('gpt2-conversational-retrain')
87
+ model = GPT2LMHeadModel.from_pretrained('gpt2-conversational-retrain')
88
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
89
+ model.to(device)
90
+ def generate_text(model, tokenizer, prompt, max_length=1024):
91
+ prompt = f'<|ASSISTANT|> {prompt} <|USER|> '
92
+ input_ids = tokenizer.encode(prompt, add_special_tokens=True, return_tensors="pt").to(device)
93
+ attention_mask = torch.ones_like(input_ids).to(device)
94
+ output = model.generate(input_ids,
95
+ max_length=max_length,
96
+ do_sample=True,
97
+ temperature=0.3,
98
+ top_k=23,
99
+ top_p=0.7,
100
+ repetition_penalty=1.176,
101
+ pad_token_id=tokenizer.pad_token_id,
102
+ eos_token_id=tokenizer.eos_token_id,
103
+ attention_mask=attention_mask)
104
+ output_ids = tokenizer.decode(output[0], skip_special_tokens=False)
105
+ return output_ids
106
+ # Loop to interact with the model
107
+ while True:
108
+ prompt = input("Enter a prompt (or 'q' to quit): ")
109
+ if prompt == "q":
110
+ break
111
+ output_text = generate_text(model, tokenizer, prompt)
112
+ print(output_text)
113
+ ```
114
+
115
+ ## Training Details
116
+
117
+ ### Training Data
118
+
119
+ <!-- This should link to a Data 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. -->
120
+
121
+ https://huggingface.co/datasets/Locutusque/InstructMix
122
+
123
+ ### Training Procedure
124
+
125
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
126
+
127
+ #### Preprocessing [optional]
128
+
129
+ [More Information Needed]
130
+
131
+
132
+ #### Training Hyperparameters
133
+
134
+ - **Training regime:** fp16 non-mixed precision <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
135
+
136
+ #### Speeds, Sizes, Times [optional]
137
+
138
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
139
+
140
+ [More Information Needed]
141
+
142
+ ## Evaluation
143
+
144
+ <!-- This section describes the evaluation protocols and provides the results. -->
145
+
146
+ ### Testing Data, Factors & Metrics
147
+
148
+ #### Testing Data
149
+
150
+ <!-- This should link to a Data Card if possible. -->
151
+
152
+ [More Information Needed]
153
+
154
+ #### Factors
155
+
156
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
157
+
158
+ [More Information Needed]
159
+
160
+ #### Metrics
161
+
162
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
163
+
164
+ [More Information Needed]
165
+
166
+ ### Results
167
+
168
+ [More Information Needed]
169
+
170
+ #### Summary
171
+
172
+
173
+
174
+ ## Model Examination [optional]
175
+
176
+ <!-- Relevant interpretability work for the model goes here -->
177
+
178
+ [More Information Needed]
179
+
180
+ ## Environmental Impact
181
+
182
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
183
+
184
+ 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).
185
+
186
+ - **Hardware Type:** [More Information Needed]
187
+ - **Hours used:** [More Information Needed]
188
+ - **Cloud Provider:** [More Information Needed]
189
+ - **Compute Region:** [More Information Needed]
190
+ - **Carbon Emitted:** [More Information Needed]
191
+
192
+ ## Technical Specifications [optional]
193
+
194
+ ### Model Architecture and Objective
195
+
196
+ [More Information Needed]
197
+
198
+ ### Compute Infrastructure
199
+
200
+ [More Information Needed]
201
+
202
+ #### Hardware
203
+
204
+ [More Information Needed]
205
+
206
+ #### Software
207
+
208
+ [More Information Needed]
209
+
210
+ ## Citation [optional]
211
+
212
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
213
+
214
+ **BibTeX:**
215
+
216
+ [More Information Needed]
217
+
218
+ **APA:**
219
+
220
+ [More Information Needed]
221
+
222
+ ## Glossary [optional]
223
+
224
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
225
+
226
+ [More Information Needed]
227
+
228
+ ## More Information [optional]
229
+
230
+ [More Information Needed]
231
+
232
+ ## Model Card Authors [optional]
233
+
234
+ [More Information Needed]
235
+
236
+ ## Model Card Contact
237
+
238
+ [More Information Needed]