Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- natural_instructions
|
4 |
+
- the_pile
|
5 |
+
- cot
|
6 |
+
- Muennighoff/P3
|
7 |
+
inference:
|
8 |
+
parameters:
|
9 |
+
max_new_tokens: 5
|
10 |
+
temperature: 1.0
|
11 |
+
top_k: 1
|
12 |
+
language:
|
13 |
+
- en
|
14 |
+
pipeline_tag: text-generation
|
15 |
+
widget:
|
16 |
+
-
|
17 |
+
example_title: "Sentiment Analysis"
|
18 |
+
text: |-
|
19 |
+
The task is to label the post's emotion as sadness, joy, love, anger, fear, or surprise.
|
20 |
+
|
21 |
+
Input: I'm feeling quite sad and sorry for myself but ill snap out of it soon.
|
22 |
+
Output: sadness
|
23 |
+
|
24 |
+
Input: I am just feeling cranky and blue.
|
25 |
+
Output: anger
|
26 |
+
|
27 |
+
Input: I can have for a treat or if i am feeling festive.
|
28 |
+
Output:
|
29 |
+
-
|
30 |
+
example_title: "Country Currency"
|
31 |
+
text: |-
|
32 |
+
Return the currency of the given country.
|
33 |
+
|
34 |
+
Input: Switzerland
|
35 |
+
Output: Swiss Franc
|
36 |
+
|
37 |
+
Input: India
|
38 |
+
Output:
|
39 |
+
-
|
40 |
+
example_title: "Tweet Eval Hate"
|
41 |
+
text: |-
|
42 |
+
Label whether the following tweet contains hate speech against either immigrants or women. Hate Speech (HS) is commonly defined as any communication that disparages a person or a group on the basis of some characteristic such as race, color, ethnicity, gender, sexual orientation, nationality, religion, or other characteristics.
|
43 |
+
Possible labels:
|
44 |
+
1. hate speech
|
45 |
+
2. not hate speech
|
46 |
+
|
47 |
+
Tweet: HOW REFRESHING! In South Korea, there is no such thing as 'political correctness" when it comes to dealing with Muslim refugee wannabes via @user
|
48 |
+
Label: hate speech
|
49 |
+
|
50 |
+
Tweet: New to Twitter-- any men on here know what the process is to get #verified?
|
51 |
+
Label: not hate speech
|
52 |
+
|
53 |
+
Tweet: Dont worry @user you are and will always be the most hysterical woman.
|
54 |
+
Label:
|
55 |
+
-
|
56 |
+
example_title: "Entity Recognition"
|
57 |
+
text: |-
|
58 |
+
Extract all the names of people, places, and organizations from the following sentences.
|
59 |
+
|
60 |
+
Sentence: Satya Nadella, the CEO of Microsoft, was visiting the Bahamas last May.
|
61 |
+
Entities: Satya Nadella, Microsoft, Bahamas
|
62 |
+
|
63 |
+
Sentence: Pacific Northwest cities include Seattle and Portland, which I have visited with Vikash.
|
64 |
+
Entities:
|
65 |
+
-
|
66 |
+
example_title: "Data Clearning"
|
67 |
+
text: |-
|
68 |
+
Format the data into a CSV file:
|
69 |
+
|
70 |
+
Input: Jane Doe [email protected] (520) 382 2435
|
71 |
+
Output: Jane Doe,[email protected],520-382-2435
|
72 |
+
|
73 |
+
Input: Peter Lee (510) 333-2429 email: [email protected]
|
74 |
+
Output:
|
75 |
+
---
|
76 |
+
|
77 |
+
<h1 style="font-size: 42px">GPT-JT<h1/>
|
78 |
+
|
79 |
+
|
80 |
+
***<p style="font-size: 24px">Feel free to try out our [Online Demo](https://huggingface.co/spaces/togethercomputer/GPT-JT)!</p>***
|
81 |
+
|
82 |
+
|
83 |
+
# Model Summary
|
84 |
+
|
85 |
+
> **NOTE**: This model was converted to 8-bit using the scripts from [hivemind](https://huggingface.co/hivemind/gpt-j-6B-8bit).
|
86 |
+
|
87 |
+
> With a new decentralized training algorithm, we fine-tuned GPT-J (6B) on 3.53 billion tokens, resulting in GPT-JT (6B), a model that outperforms many 100B+ parameter models on classification benchmarks.
|
88 |
+
|
89 |
+
We incorporated a collection of open techniques and datasets to build GPT-JT:
|
90 |
+
- GPT-JT is a fork of [EleutherAI](https://www.eleuther.ai)'s [GPT-J (6B)](https://huggingface.co/EleutherAI/gpt-j-6B);
|
91 |
+
- We used [UL2](https://github.com/google-research/google-research/tree/master/ul2)'s training objective, allowing the model to see bidirectional context of the prompt;
|
92 |
+
- The model was trained on a large collection of diverse data, including [Chain-of-Thought (CoT)](https://ai.googleblog.com/2022/05/language-models-perform-reasoning-via.html), [Public Pool of Prompts (P3) dataset](https://huggingface.co/datasets/bigscience/P3), [Natural-Instructions (NI) dataset](https://github.com/allenai/natural-instructions).
|
93 |
+
|
94 |
+
With the help of techniques mentioned above, GPT-JT significantly improves the performance of classification tasks over the original GPT-J, and even outperforms most 100B+ parameter models!
|
95 |
+
|
96 |
+
# Quick Start
|
97 |
+
|
98 |
+
```python
|
99 |
+
from transformers import pipeline
|
100 |
+
pipe = pipeline(model='togethercomputer/GPT-JT-6B-v1')
|
101 |
+
pipe('''"I love this!" Is it positive? A:''')
|
102 |
+
```
|
103 |
+
or
|
104 |
+
```python
|
105 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
106 |
+
tokenizer = AutoTokenizer.from_pretrained("togethercomputer/GPT-JT-6B-v1")
|
107 |
+
model = AutoModelForCausalLM.from_pretrained("togethercomputer/GPT-JT-6B-v1")
|
108 |
+
```
|
109 |
+
|
110 |
+
# Training Details
|
111 |
+
|
112 |
+
## UL2 Training Objective
|
113 |
+
|
114 |
+
We train GPT-JT using UL2 training objective [1][2].
|
115 |
+
The original GPT-J uses causal mask (as shown below left) for autoregressive generation. So for each token, it can only see its previous context.
|
116 |
+
In order to fully leverage the context information, we continue to train GPT-J with UL2 training objectives, and uses causal mask with prefix (as shown below right) -- using bidirectional attention for the prompt / input and causal attention for token generation.
|
117 |
+
Intuitively, being able to see context bidirectionally might improve downstream tasks that require this information.
|
118 |
+
|
119 |
+
$$
|
120 |
+
\begin{bmatrix}
|
121 |
+
1 & 0 & 0 & 0 & 0 \\
|
122 |
+
1 & 1 & 0 & 0 & 0 \\
|
123 |
+
1 & 1 & 1 & 0 & 0 \\
|
124 |
+
1 & 1 & 1 & 1 & 0 \\
|
125 |
+
1 & 1 & 1 & 1 & 1
|
126 |
+
\end{bmatrix}
|
127 |
+
|
128 |
+
\begin{bmatrix}
|
129 |
+
1 & 1 & 1 & 0 & 0 \\
|
130 |
+
1 & 1 & 1 & 0 & 0 \\
|
131 |
+
1 & 1 & 1 & 0 & 0 \\
|
132 |
+
1 & 1 & 1 & 1 & 0 \\
|
133 |
+
1 & 1 & 1 & 1 & 1
|
134 |
+
\end{bmatrix}
|
135 |
+
$$
|
136 |
+
|
137 |
+
Furthermore, we leverage a large collection of data, including [Natural-Instructions](https://github.com/allenai/natural-instructions), [P3](https://huggingface.co/datasets/Muennighoff/P3), [MMLU-COT](https://github.com/jasonwei20/flan-2/blob/main/mmlu-cot.json), and [the Pile](https://huggingface.co/datasets/the_pile)
|
138 |
+
Specifically, we first conduct training for 2.62 billion tokens using the UL2 loss on the Pile, followed by 0.92 billion tokens with a mixture of the above datasets: 5% of COT, 20% of P3, 20% of NI, and 55% of the Pile.
|
139 |
+
|
140 |
+
## Hyperparameters
|
141 |
+
|
142 |
+
We used AdamW with a learning rate of 1e-5 and global batch size of 64 (16 for each data parallel worker).
|
143 |
+
We used mix-precision training where the activation is in FP16 while the optimizer states are kept in FP32.
|
144 |
+
We use both data parallelism and pipeline parallelism to conduct training.
|
145 |
+
During training, we truncate the input sequence to 2048 tokens, and for input sequence that contains less than 2048 tokens, we concatenate multiple sequences into one long sequence to improve the data efficiency.
|
146 |
+
|
147 |
+
## Infrastructure
|
148 |
+
|
149 |
+
We used [the Together Research Computer](https://together.xyz/) to conduct training.
|
150 |
+
|
151 |
+
# References
|
152 |
+
|
153 |
+
[1]: Tay, Yi, Mostafa Dehghani, Vinh Q. Tran, Xavier Garcia, Dara Bahri, Tal Schuster, Huaixiu Steven Zheng, Neil Houlsby, and Donald Metzler. "Unifying Language Learning Paradigms." arXiv preprint arXiv:2205.05131 (2022).
|
154 |
+
|
155 |
+
[2]: Tay, Yi, Jason Wei, Hyung Won Chung, Vinh Q. Tran, David R. So, Siamak Shakeri, Xavier Garcia et al. "Transcending scaling laws with 0.1% extra compute." arXiv preprint arXiv:2210.11399 (2022).
|