michaelfeil
commited on
Commit
•
52f885f
1
Parent(s):
2666def
Upload togethercomputer/RedPajama-INCITE-Instruct-3B-v1 ctranslate fp16 weights
Browse files- README.md +257 -0
- generation_config.json +6 -0
- special_tokens_map.json +5 -0
README.md
ADDED
@@ -0,0 +1,257 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
datasets:
|
6 |
+
- togethercomputer/RedPajama-Data-1T
|
7 |
+
- Muennighoff/P3
|
8 |
+
- Muennighoff/natural-instructions
|
9 |
+
widget:
|
10 |
+
- text: "Label the tweets as either 'positive', 'negative', 'mixed', or 'neutral': \n\nTweet: I can say that there isn't anything I would change.\nLabel: positive\n\nTweet: I'm not sure about this.\nLabel: neutral\n\nTweet: I liked some parts but I didn't like other parts.\nLabel: mixed\n\nTweet: I think the background image could have been better.\nLabel: negative\n\nTweet: I really like it.\nLabel:"
|
11 |
+
example_title: "Sentiment Analysis"
|
12 |
+
- text: "Please answer the following question:\n\nQuestion: What is the capital of Canada?\nAnswer: Ottawa\n\nQuestion: What is the currency of Switzerland?\nAnswer: Swiss franc\n\nQuestion: In which country is Wisconsin located?\nAnswer:"
|
13 |
+
example_title: "Question Answering"
|
14 |
+
- text: "Given a news article, classify its topic.\nPossible labels: 1. World 2. Sports 3. Business 4. Sci/Tech\n\nArticle: A nearby star thought to harbor comets and asteroids now appears to be home to planets, too.\nLabel: Sci/Tech\n\nArticle: Soaring crude prices plus worries about the economy and the outlook for earnings are expected to hang over the stock market next week during the depth of the summer doldrums.\nLabel: Business\n\nArticle: Murtagh a stickler for success Northeastern field hockey coach Cheryl Murtagh doesn't want the glare of the spotlight that shines on her to detract from a team that has been the America East champion for the past three years and has been to the NCAA tournament 13 times.\nLabel::"
|
15 |
+
example_title: "Topic Classification"
|
16 |
+
- text: "Paraphrase the given sentence into a different sentence.\n\nInput: Can you recommend some upscale restaurants in New York?\nOutput: What upscale restaurants do you recommend in New York?\n\nInput: What are the famous places we should not miss in Paris?\nOutput: Recommend some of the best places to visit in Paris?\n\nInput: Could you recommend some hotels that have cheap price in Zurich?\nOutput:"
|
17 |
+
example_title: "Paraphrasing"
|
18 |
+
- text: "Given a review from Amazon's food products, the task is to generate a short summary of the given review in the input.\n\nInput: I have bought several of the Vitality canned dog food products and have found them all to be of good quality. The product looks more like a stew than a processed meat and it smells better. My Labrador is finicky and she appreciates this product better than most.\nOutput: Good Quality Dog Food\n\nInput: Product arrived labeled as Jumbo Salted Peanuts...the peanuts were actually small sized unsalted. Not sure if this was an error or if the vendor intended to represent the product as 'Jumbo'.\nOutput: Not as Advertised\n\nInput: My toddler loves this game to a point where he asks for it. That's a big thing for me. Secondly, no glitching unlike one of their competitors (PlayShifu). Any tech I don’t have to reach out to support for help is a good tech for me. I even enjoy some of the games and activities in this. Overall, this is a product that shows that the developers took their time and made sure people would not be asking for refund. I’ve become bias regarding this product and honestly I look forward to buying more of this company’s stuff. Please keep up the great work.\nOutput:"
|
19 |
+
example_title: "Text Summarization"
|
20 |
+
- text: "Identify which sense of a word is meant in a given context.\n\nContext: The river overflowed the bank.\nWord: bank\nSense: river bank\n\nContext: A mouse takes much more room than a trackball.\nWord: mouse\nSense: computer mouse\n\nContext: The bank will not be accepting cash on Saturdays.\nWord: bank\nSense: commercial (finance) banks\n\nContext: Bill killed the project\nWord: kill\nSense:"
|
21 |
+
example_title: "Word Sense Disambiguation"
|
22 |
+
- text: "Given a pair of sentences, choose whether the two sentences agree (entailment)/disagree (contradiction) with each other.\nPossible labels: 1. entailment 2. contradiction\n\nSentence 1: The skier was on the edge of the ramp. Sentence 2: The skier was dressed in winter clothes.\nLabel: entailment\n\nSentence 1: The boy skated down the staircase railing. Sentence 2: The boy is a newbie skater.\nLabel: contradiction\n\nSentence 1: Two middle-aged people stand by a golf hole. Sentence 2: A couple riding in a golf cart.\nLabel:"
|
23 |
+
example_title: "Natural Language Inference"
|
24 |
+
inference:
|
25 |
+
parameters:
|
26 |
+
temperature: 0.7
|
27 |
+
top_p: 0.7
|
28 |
+
top_k: 50
|
29 |
+
max_new_tokens: 128
|
30 |
+
---
|
31 |
+
# # Fast-Inference with Ctranslate2
|
32 |
+
Speedup inference by 2x-8x using int8 inference in C++
|
33 |
+
|
34 |
+
quantized version of [togethercomputer/RedPajama-INCITE-Instruct-3B-v1](https://huggingface.co/togethercomputer/RedPajama-INCITE-Instruct-3B-v1)
|
35 |
+
```bash
|
36 |
+
pip install hf-hub-ctranslate2>=2.0.6 ctranslate2>=3.13.0
|
37 |
+
```
|
38 |
+
Converted on 2023-05-19 using
|
39 |
+
```
|
40 |
+
ct2-transformers-converter --model togethercomputer/RedPajama-INCITE-Instruct-3B-v1 --output_dir /home/michael/tmp-ct2fast-RedPajama-INCITE-Instruct-3B-v1 --force --copy_files tokenizer.json README.md tokenizer_config.json generation_config.json special_tokens_map.json .gitattributes --quantization float16
|
41 |
+
```
|
42 |
+
|
43 |
+
Checkpoint compatible to [ctranslate2](https://github.com/OpenNMT/CTranslate2) and [hf-hub-ctranslate2](https://github.com/michaelfeil/hf-hub-ctranslate2)
|
44 |
+
- `compute_type=int8_float16` for `device="cuda"`
|
45 |
+
- `compute_type=int8` for `device="cpu"`
|
46 |
+
|
47 |
+
```python
|
48 |
+
from hf_hub_ctranslate2 import TranslatorCT2fromHfHub, GeneratorCT2fromHfHub
|
49 |
+
from transformers import AutoTokenizer
|
50 |
+
|
51 |
+
model_name = "michaelfeil/ct2fast-RedPajama-INCITE-Instruct-3B-v1"
|
52 |
+
# use either TranslatorCT2fromHfHub or GeneratorCT2fromHfHub here, depending on model.
|
53 |
+
model = GeneratorCT2fromHfHub(
|
54 |
+
# load in int8 on CUDA
|
55 |
+
model_name_or_path=model_name,
|
56 |
+
device="cuda",
|
57 |
+
compute_type="int8_float16",
|
58 |
+
tokenizer=AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-Instruct-3B-v1")
|
59 |
+
)
|
60 |
+
outputs = model.generate(
|
61 |
+
text=["How do you call a fast Flan-ingo?", "User: How are you doing?"],
|
62 |
+
)
|
63 |
+
print(outputs)
|
64 |
+
```
|
65 |
+
|
66 |
+
# Licence and other remarks:
|
67 |
+
This is just a quantized version. Licence conditions are intended to be idential to original huggingface repo.
|
68 |
+
|
69 |
+
# Original description
|
70 |
+
|
71 |
+
|
72 |
+
# RedPajama-INCITE-Instruct-3B-v1
|
73 |
+
|
74 |
+
RedPajama-INCITE-Instruct-3B-v1 was developed by Together and leaders from the open-source AI community including Ontocord.ai, ETH DS3Lab, AAI CERC, Université de Montréal, MILA - Québec AI Institute, Stanford Center for Research on Foundation Models (CRFM), Stanford Hazy Research research group and LAION.
|
75 |
+
|
76 |
+
The model was fine-tuned for few-shot applications on the data of [GPT-JT](https://huggingface.co/togethercomputer/GPT-JT-6B-v1), with exclusion of tasks that overlap with the HELM core scenarios.
|
77 |
+
|
78 |
+
- Base Model: [RedPajama-INCITE-Base-3B-v1](https://huggingface.co/togethercomputer/RedPajama-INCITE-Base-3B-v1)
|
79 |
+
- Instruction-tuned Version: [RedPajama-INCITE-Instruct-3B-v1](https://huggingface.co/togethercomputer/RedPajama-INCITE-Instruct-3B-v1)
|
80 |
+
- Chat Version: [RedPajama-INCITE-Chat-3B-v1](https://huggingface.co/togethercomputer/RedPajama-INCITE-Chat-3B-v1)
|
81 |
+
|
82 |
+
|
83 |
+
## Model Details
|
84 |
+
- **Developed by**: Together Computer.
|
85 |
+
- **Model type**: Language Model
|
86 |
+
- **Language(s)**: English
|
87 |
+
- **License**: Apache 2.0
|
88 |
+
- **Model Description**: A 2.8B parameter pretrained language model.
|
89 |
+
|
90 |
+
# Quick Start
|
91 |
+
|
92 |
+
Please note that the model requires `transformers` version >= 4.25.1.
|
93 |
+
|
94 |
+
## GPU Inference
|
95 |
+
|
96 |
+
This requires a GPU with 8GB memory.
|
97 |
+
|
98 |
+
```python
|
99 |
+
import torch
|
100 |
+
import transformers
|
101 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
102 |
+
|
103 |
+
MIN_TRANSFORMERS_VERSION = '4.25.1'
|
104 |
+
|
105 |
+
# check transformers version
|
106 |
+
assert transformers.__version__ >= MIN_TRANSFORMERS_VERSION, f'Please upgrade transformers to version {MIN_TRANSFORMERS_VERSION} or higher.'
|
107 |
+
|
108 |
+
# init
|
109 |
+
tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-Instruct-3B-v1")
|
110 |
+
model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-Instruct-3B-v1", torch_dtype=torch.float16)
|
111 |
+
model = model.to('cuda:0')
|
112 |
+
# infer
|
113 |
+
prompt = "Q: The capital of France is?\nA:"
|
114 |
+
inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
|
115 |
+
input_length = inputs.input_ids.shape[1]
|
116 |
+
outputs = model.generate(
|
117 |
+
**inputs, max_new_tokens=128, do_sample=True, temperature=0.7, top_p=0.7, top_k=50, return_dict_in_generate=True
|
118 |
+
)
|
119 |
+
token = outputs.sequences[0, input_length:]
|
120 |
+
output_str = tokenizer.decode(token)
|
121 |
+
print(output_str)
|
122 |
+
"""
|
123 |
+
Paris
|
124 |
+
"""
|
125 |
+
```
|
126 |
+
|
127 |
+
## GPU Inference in Int8
|
128 |
+
|
129 |
+
This requires a GPU with 6GB memory.
|
130 |
+
|
131 |
+
To run inference with int8, please ensure you have installed accelerate and bitandbytes. You can install them with the following command:
|
132 |
+
|
133 |
+
```bash
|
134 |
+
pip install accelerate
|
135 |
+
pip install bitsandbytes
|
136 |
+
```
|
137 |
+
|
138 |
+
Then you can run inference with int8 as follows:
|
139 |
+
|
140 |
+
```python
|
141 |
+
import torch
|
142 |
+
import transformers
|
143 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
144 |
+
|
145 |
+
MIN_TRANSFORMERS_VERSION = '4.25.1'
|
146 |
+
|
147 |
+
# check transformers version
|
148 |
+
assert transformers.__version__ >= MIN_TRANSFORMERS_VERSION, f'Please upgrade transformers to version {MIN_TRANSFORMERS_VERSION} or higher.'
|
149 |
+
|
150 |
+
# init
|
151 |
+
tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-Instruct-3B-v1")
|
152 |
+
model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-Instruct-3B-v1", device_map='auto', torch_dtype=torch.float16, load_in_8bit=True)
|
153 |
+
|
154 |
+
# infer
|
155 |
+
prompt = "Q: The capital of France is?\nA:"
|
156 |
+
inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
|
157 |
+
input_length = inputs.input_ids.shape[1]
|
158 |
+
outputs = model.generate(
|
159 |
+
**inputs, max_new_tokens=128, do_sample=True, temperature=0.7, top_p=0.7, top_k=50, return_dict_in_generate=True
|
160 |
+
)
|
161 |
+
token = outputs.sequences[0, input_length:]
|
162 |
+
output_str = tokenizer.decode(token)
|
163 |
+
print(output_str)
|
164 |
+
"""
|
165 |
+
Paris
|
166 |
+
"""
|
167 |
+
```
|
168 |
+
|
169 |
+
## CPU Inference
|
170 |
+
|
171 |
+
```python
|
172 |
+
import torch
|
173 |
+
import transformers
|
174 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
175 |
+
|
176 |
+
MIN_TRANSFORMERS_VERSION = '4.25.1'
|
177 |
+
|
178 |
+
# check transformers version
|
179 |
+
assert transformers.__version__ >= MIN_TRANSFORMERS_VERSION, f'Please upgrade transformers to version {MIN_TRANSFORMERS_VERSION} or higher.'
|
180 |
+
|
181 |
+
# init
|
182 |
+
tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-Instruct-3B-v1")
|
183 |
+
model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-Instruct-3B-v1", torch_dtype=torch.bfloat16)
|
184 |
+
# infer
|
185 |
+
prompt = "Q: The capital of France is?\nA:"
|
186 |
+
inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
|
187 |
+
input_length = inputs.input_ids.shape[1]
|
188 |
+
outputs = model.generate(
|
189 |
+
**inputs, max_new_tokens=128, do_sample=True, temperature=0.7, top_p=0.7, top_k=50, return_dict_in_generate=True
|
190 |
+
)
|
191 |
+
token = outputs.sequences[0, input_length:]
|
192 |
+
output_str = tokenizer.decode(token)
|
193 |
+
print(output_str)
|
194 |
+
"""
|
195 |
+
Paris
|
196 |
+
"""
|
197 |
+
```
|
198 |
+
|
199 |
+
Please note that since `LayerNormKernelImpl` is not implemented in fp16 for CPU, we use `bfloat16` for CPU inference.
|
200 |
+
|
201 |
+
|
202 |
+
# Uses
|
203 |
+
|
204 |
+
## Direct Use
|
205 |
+
|
206 |
+
Excluded uses are described below.
|
207 |
+
|
208 |
+
### Misuse, Malicious Use, and Out-of-Scope Use
|
209 |
+
|
210 |
+
It is the responsibility of the end user to ensure that the model is used in a responsible and ethical manner.
|
211 |
+
|
212 |
+
#### Out-of-Scope Use
|
213 |
+
|
214 |
+
RedPajama-INCITE-Instruct-3B-v1 is a language model and may not perform well for other use cases outside of its intended scope.
|
215 |
+
For example, it may not be suitable for use in safety-critical applications or for making decisions that have a significant impact on individuals or society.
|
216 |
+
It is important to consider the limitations of the model and to only use it for its intended purpose.
|
217 |
+
|
218 |
+
#### Misuse and Malicious Use
|
219 |
+
|
220 |
+
RedPajama-INCITE-Instruct-3B-v1 is designed for language modeling.
|
221 |
+
Misuse of the model, such as using it to engage in illegal or unethical activities, is strictly prohibited and goes against the principles of the project.
|
222 |
+
|
223 |
+
Using the model to generate content that is cruel to individuals is a misuse of this model. This includes, but is not limited to:
|
224 |
+
|
225 |
+
- Generating fake news, misinformation, or propaganda
|
226 |
+
- Promoting hate speech, discrimination, or violence against individuals or groups
|
227 |
+
- Impersonating individuals or organizations without their consent
|
228 |
+
- Engaging in cyberbullying or harassment
|
229 |
+
- Defamatory content
|
230 |
+
- Spamming or scamming
|
231 |
+
- Sharing confidential or sensitive information without proper authorization
|
232 |
+
- Violating the terms of use of the model or the data used to train it
|
233 |
+
- Creating automated bots for malicious purposes such as spreading malware, phishing scams, or spamming
|
234 |
+
|
235 |
+
## Limitations
|
236 |
+
|
237 |
+
RedPajama-INCITE-Instruct-3B-v1, like other language models, has limitations that should be taken into consideration.
|
238 |
+
For example, the model may not always provide accurate or relevant answers, particularly for questions that are complex, ambiguous, or outside of its training data.
|
239 |
+
We therefore welcome contributions from individuals and organizations, and encourage collaboration towards creating a more robust and inclusive chatbot.
|
240 |
+
|
241 |
+
## Training
|
242 |
+
|
243 |
+
**Training Data**
|
244 |
+
|
245 |
+
Please refer to [togethercomputer/RedPajama-Data-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T)
|
246 |
+
|
247 |
+
**Training Procedure**
|
248 |
+
|
249 |
+
- **Hardware:** 8 A100
|
250 |
+
- **Optimizer:** Adam
|
251 |
+
- **Gradient Accumulations**: 1
|
252 |
+
- **Num of Tokens:** 131M tokens
|
253 |
+
- **Learning rate:** 1e-5
|
254 |
+
|
255 |
+
## Community
|
256 |
+
|
257 |
+
Join us on [Together Discord](https://discord.gg/6ZVDU8tTD4)
|
generation_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 0,
|
4 |
+
"eos_token_id": 0,
|
5 |
+
"transformers_version": "4.28.1"
|
6 |
+
}
|
special_tokens_map.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": "<|endoftext|>",
|
3 |
+
"eos_token": "<|endoftext|>",
|
4 |
+
"unk_token": "<|endoftext|>"
|
5 |
+
}
|