Technotech commited on
Commit
19b69c8
1 Parent(s): b4d89be

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +204 -0
README.md ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ datasets:
6
+ - togethercomputer/RedPajama-Data-1T
7
+ tags:
8
+ - gptq
9
+ ---
10
+
11
+ ## RedPajama-Base-3B-4bit-128g
12
+
13
+ RedPajama 3B, quantised to 4bit with groupsize of 128, no act order.
14
+
15
+ # Original Model Card
16
+
17
+ # RedPajama-INCITE-Base-3B-v1
18
+
19
+ RedPajama-INCITE-Base-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.
20
+ The training was done on 3,072 V100 GPUs provided as part of the INCITE 2023 project on Scalable Foundation Models for Transferrable Generalist AI, awarded to MILA, LAION, and EleutherAI in fall 2022, with support from the Oak Ridge Leadership Computing Facility (OLCF) and INCITE program.
21
+
22
+ - Base Model: [RedPajama-INCITE-Base-3B-v1](https://huggingface.co/togethercomputer/RedPajama-INCITE-Base-3B-v1)
23
+ - Instruction-tuned Version: [RedPajama-INCITE-Instruct-3B-v1](https://huggingface.co/togethercomputer/RedPajama-INCITE-Instruct-3B-v1)
24
+ - Chat Version: [RedPajama-INCITE-Chat-3B-v1](https://huggingface.co/togethercomputer/RedPajama-INCITE-Chat-3B-v1)
25
+
26
+ ## Model Details
27
+ - **Developed by**: Together Computer.
28
+ - **Model type**: Language Model
29
+ - **Language(s)**: English
30
+ - **License**: Apache 2.0
31
+ - **Model Description**: A 2.8B parameter pretrained language model.
32
+
33
+ # Quick Start
34
+
35
+ Please note that the model requires `transformers` version >= 4.25.1.
36
+
37
+ ## GPU Inference
38
+
39
+ This requires a GPU with 8GB memory.
40
+
41
+ ```python
42
+ import torch
43
+ import transformers
44
+ from transformers import AutoTokenizer, AutoModelForCausalLM
45
+
46
+ MIN_TRANSFORMERS_VERSION = '4.25.1'
47
+
48
+ # check transformers version
49
+ assert transformers.__version__ >= MIN_TRANSFORMERS_VERSION, f'Please upgrade transformers to version {MIN_TRANSFORMERS_VERSION} or higher.'
50
+
51
+ # init
52
+ tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-Base-3B-v1")
53
+ model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-Base-3B-v1", torch_dtype=torch.float16)
54
+ model = model.to('cuda:0')
55
+
56
+ # infer
57
+ prompt = "Alan Turing is"
58
+ inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
59
+ input_length = inputs.input_ids.shape[1]
60
+ outputs = model.generate(
61
+ **inputs, max_new_tokens=128, do_sample=True, temperature=0.7, top_p=0.7, top_k=50, return_dict_in_generate=True,
62
+ )
63
+ token = outputs.sequences[0, input_length:]
64
+ output_str = tokenizer.decode(token)
65
+ print(output_str)
66
+ """
67
+ a name that has been synonymous with the computer age since the 1950s. The British mathematician, logician, and cryptanalyst is widely regarded as the father of modern computing. His contributions to the development of the modern computer and the theory of computation have had a profound impact on the world we live in today.
68
+ Turing’s contributions to the development of the modern computer were made in the 1940s and 1950s. He is most famous for his work on the Turing machine, a theoretical model of a computing machine that was able to perform all the mathematical operations of a computer. Turing’s work on the...
69
+ """
70
+ ```
71
+
72
+ ## GPU Inference in Int8
73
+
74
+ To run inference with int8, please ensure you have installed accelerate and bitandbytes. You can install them with the following command:
75
+
76
+ ```bash
77
+ pip install accelerate
78
+ pip install bitsandbytes
79
+ ```
80
+
81
+ Then you can run inference with int8 as follows:
82
+
83
+ ```python
84
+ import torch
85
+ import transformers
86
+ from transformers import AutoTokenizer, AutoModelForCausalLM
87
+
88
+ MIN_TRANSFORMERS_VERSION = '4.25.1'
89
+
90
+ # check transformers version
91
+ assert transformers.__version__ >= MIN_TRANSFORMERS_VERSION, f'Please upgrade transformers to version {MIN_TRANSFORMERS_VERSION} or higher.'
92
+
93
+ # init
94
+ tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-Base-3B-v1")
95
+ model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-Base-3B-v1", device_map='auto', torch_dtype=torch.float16, load_in_8bit=True)
96
+
97
+ # infer
98
+ prompt = "Alan Turing is"
99
+ inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
100
+ input_length = inputs.input_ids.shape[1]
101
+ outputs = model.generate(
102
+ **inputs, max_new_tokens=128, do_sample=True, temperature=0.7, top_p=0.7, top_k=50, return_dict_in_generate=True
103
+ )
104
+ token = outputs.sequences[0, input_length:]
105
+ output_str = tokenizer.decode(token)
106
+ print(output_str)
107
+ """
108
+ the man who cracked the Enigma code during World War II, and who was later convicted of homosexual acts. He was a brilliant mathematician, and a visionary who foresaw the computer age....
109
+ """
110
+ ```
111
+
112
+ ## CPU Inference
113
+
114
+ You can run inference on CPU as follows:
115
+
116
+ ```python
117
+ import torch
118
+ import transformers
119
+ from transformers import AutoTokenizer, AutoModelForCausalLM
120
+
121
+ MIN_TRANSFORMERS_VERSION = '4.25.1'
122
+
123
+ # check transformers version
124
+ assert transformers.__version__ >= MIN_TRANSFORMERS_VERSION, f'Please upgrade transformers to version {MIN_TRANSFORMERS_VERSION} or higher.'
125
+
126
+ # init
127
+ tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-Base-3B-v1")
128
+ model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-Base-3B-v1", torch_dtype=torch.bfloat16)
129
+ # infer
130
+ prompt = "Alan Turing is"
131
+ inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
132
+ input_length = inputs.input_ids.shape[1]
133
+ outputs = model.generate(
134
+ **inputs, max_new_tokens=128, do_sample=True, temperature=0.7, top_p=0.7, top_k=50, return_dict_in_generate=True
135
+ )
136
+ token = outputs.sequences[0, input_length:]
137
+ output_str = tokenizer.decode(token)
138
+ print(output_str)
139
+ """
140
+ a name that is synonymous with the history of computer science. As the man who invented the Turing machine, the mathematical model that defines the limits of what can be computed, Turing is credited with the invention of the modern computer. Turing was also a mathematician and logician, and his work in these fields led to the development of the field of artificial intelligence...
141
+ """
142
+ ```
143
+
144
+ Please note that since `LayerNormKernelImpl` is not implemented in fp16 for CPU, we use `bfloat16` for CPU inference.
145
+
146
+ # Uses
147
+
148
+ Excluded uses are described below.
149
+
150
+ ### Misuse, Malicious Use, and Out-of-Scope Use
151
+
152
+ It is the responsibility of the end user to ensure that the model is used in a responsible and ethical manner.
153
+
154
+ #### Out-of-Scope Use
155
+
156
+ `RedPajama-INCITE-Base-3B-v1` is a language model and may not perform well for other use cases outside of its intended scope.
157
+ 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.
158
+ It is important to consider the limitations of the model and to only use it for its intended purpose.
159
+
160
+ #### Misuse and Malicious Use
161
+
162
+ `RedPajama-INCITE-Base-3B-v1` is designed for language modeling.
163
+ 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.
164
+
165
+ Using the model to generate content that is cruel to individuals is a misuse of this model. This includes, but is not limited to:
166
+
167
+ - Generating fake news, misinformation, or propaganda
168
+ - Promoting hate speech, discrimination, or violence against individuals or groups
169
+ - Impersonating individuals or organizations without their consent
170
+ - Engaging in cyberbullying or harassment
171
+ - Defamatory content
172
+ - Spamming or scamming
173
+ - Sharing confidential or sensitive information without proper authorization
174
+ - Violating the terms of use of the model or the data used to train it
175
+ - Creating automated bots for malicious purposes such as spreading malware, phishing scams, or spamming
176
+
177
+ ## Limitations
178
+
179
+ `RedPajama-INCITE-Base-3B-v1`, like other language models, has limitations that should be taken into consideration.
180
+ 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.
181
+ We therefore welcome contributions from individuals and organizations, and encourage collaboration towards creating a more robust and inclusive chatbot.
182
+
183
+ ## Training
184
+
185
+ **Training Data**
186
+
187
+ Please refer to [togethercomputer/RedPajama-Data-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T)
188
+
189
+ **Training Procedure**
190
+
191
+ - **Hardware:** 256 nodes of 6xV100 (IBM Power9), on the OLCF Summit cluster
192
+ - **Optimizer:** Apex FusedAdam
193
+ - **Parallelism:** Pipeline parallel 6, tensor parallel 2
194
+ - **Gradient Accumulations**: 8 (global batch size 4M tokens)
195
+ - **Num of Tokens:** 800B Tokens
196
+ - **Learning rate:** 0.00016
197
+
198
+ ## Benchmark
199
+
200
+ Please refer to our [blog post](https://together.xyz) for benchmark results.
201
+
202
+ ## Community
203
+
204
+ Join us on [Together Discord](https://discord.gg/6ZVDU8tTD4)