RichardErkhov commited on
Commit
b6a11f2
1 Parent(s): e0418ae

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +193 -0
README.md ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ galactica-125m - bnb 8bits
11
+ - Model creator: https://huggingface.co/facebook/
12
+ - Original model: https://huggingface.co/facebook/galactica-125m/
13
+
14
+
15
+
16
+
17
+ Original model description:
18
+ ---
19
+ license: cc-by-nc-4.0
20
+ tags:
21
+ - galactica
22
+
23
+ widget:
24
+ - text: "The Transformer architecture [START_REF]"
25
+ - text: "The Schwarzschild radius is defined as: \\["
26
+ - text: "A force of 0.6N is applied to an object, which accelerates at 3m/s. What is its mass? <work>"
27
+ - text: "Lecture 1: The Ising Model\n\n"
28
+ - text: "[START_I_SMILES]"
29
+ - text: "[START_AMINO]GHMQSITAGQKVISKHKNGRFYQCEVVRLTTETFYEVNFDDGSFSDNLYPEDIVSQDCLQFGPPAEGEVVQVRWTDGQVYGAKFVASHPIQMYQVEFEDGSQLVVKRDDVYTLDEELP[END_AMINO] ## Keywords"
30
+ inference: false
31
+ ---
32
+
33
+ ![logo](https://s3.amazonaws.com/moonup/production/uploads/1668679814649-62441d1d9fdefb55a0b7d12c.png)
34
+
35
+ # GALACTICA 125M (mini)
36
+
37
+ Model card from the original [repo](https://github.com/paperswithcode/galai/blob/main/docs/model_card.md)
38
+
39
+ Following [Mitchell et al. (2018)](https://arxiv.org/abs/1810.03993), this model card provides information about the GALACTICA model, how it was trained, and the intended use cases. Full details about how the model was trained and evaluated can be found in the [release paper](https://galactica.org/paper.pdf).
40
+
41
+ ## Model Details
42
+
43
+ The GALACTICA models are trained on a large-scale scientific corpus. The models are designed to perform scientific tasks, including but not limited to citation prediction, scientific QA, mathematical reasoning, summarization, document generation, molecular property prediction and entity extraction. The models were developed by the Papers with Code team at Meta AI to study the use of language models for the automatic organization of science. We train models with sizes ranging from 125M to 120B parameters. Below is a summary of the released models:
44
+
45
+ | Size | Parameters |
46
+ |:-----------:|:-----------:|
47
+ | `mini` | 125 M |
48
+ | `base` | 1.3 B |
49
+ | `standard` | 6.7 B |
50
+ | `large` | 30 B |
51
+ | `huge` | 120 B |
52
+
53
+
54
+ ## Release Date
55
+
56
+ November 2022
57
+
58
+ ## Model Type
59
+
60
+ Transformer based architecture in a decoder-only setup with a few modifications (see paper for more details).
61
+
62
+ ## Paper & Demo
63
+
64
+ [Paper](https://galactica.org/paper.pdf) / [Demo](https://galactica.org)
65
+
66
+ ## Model Use
67
+
68
+ The primary intended users of the GALACTICA models are researchers studying language models applied to the scientific domain. We also anticipate the model will be useful for developers who wish to build scientific tooling. However, we caution against production use without safeguards given the potential of language models to hallucinate.
69
+
70
+ The models are made available under a non-commercial CC BY-NC 4.0 license. More information about how to use the model can be found in the README.md of this repository.
71
+
72
+ ## Training Data
73
+
74
+ The GALACTICA models are trained on 106 billion tokens of open-access scientific text and data. This includes papers, textbooks, scientific websites, encyclopedias, reference material, knowledge bases, and more. We tokenize different modalities to provide a natural langauge interface for different tasks. See the README.md for more information. See the paper for full information on the training data.
75
+
76
+ ## How to use
77
+
78
+ Find below some example scripts on how to use the model in `transformers`:
79
+
80
+ ## Using the Pytorch model
81
+
82
+ ### Running the model on a CPU
83
+
84
+ <details>
85
+ <summary> Click to expand </summary>
86
+
87
+ ```python
88
+
89
+ from transformers import AutoTokenizer, OPTForCausalLM
90
+
91
+ tokenizer = AutoTokenizer.from_pretrained("facebook/galactica-125m")
92
+ model = OPTForCausalLM.from_pretrained("facebook/galactica-125m")
93
+
94
+ input_text = "The Transformer architecture [START_REF]"
95
+ input_ids = tokenizer(input_text, return_tensors="pt").input_ids
96
+
97
+ outputs = model.generate(input_ids)
98
+ print(tokenizer.decode(outputs[0]))
99
+ ```
100
+
101
+ </details>
102
+
103
+ ### Running the model on a GPU
104
+
105
+ <details>
106
+ <summary> Click to expand </summary>
107
+
108
+ ```python
109
+ # pip install accelerate
110
+ from transformers import AutoTokenizer, OPTForCausalLM
111
+
112
+ tokenizer = AutoTokenizer.from_pretrained("facebook/galactica-125m")
113
+ model = OPTForCausalLM.from_pretrained("facebook/galactica-125m", device_map="auto")
114
+
115
+ input_text = "The Transformer architecture [START_REF]"
116
+ input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
117
+
118
+ outputs = model.generate(input_ids)
119
+ print(tokenizer.decode(outputs[0]))
120
+ ```
121
+
122
+ </details>
123
+
124
+ ### Running the model on a GPU using different precisions
125
+
126
+ #### FP16
127
+
128
+ <details>
129
+ <summary> Click to expand </summary>
130
+
131
+ ```python
132
+ # pip install accelerate
133
+ import torch
134
+ from transformers import AutoTokenizer, OPTForCausalLM
135
+
136
+ tokenizer = AutoTokenizer.from_pretrained("facebook/galactica-125m")
137
+ model = OPTForCausalLM.from_pretrained("facebook/galactica-125m", device_map="auto", torch_dtype=torch.float16)
138
+
139
+ input_text = "The Transformer architecture [START_REF]"
140
+ input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
141
+
142
+ outputs = model.generate(input_ids)
143
+ print(tokenizer.decode(outputs[0]))
144
+ ```
145
+
146
+ </details>
147
+
148
+ #### INT8
149
+
150
+ <details>
151
+ <summary> Click to expand </summary>
152
+
153
+ ```python
154
+ # pip install bitsandbytes accelerate
155
+ from transformers import AutoTokenizer, OPTForCausalLM
156
+
157
+ tokenizer = AutoTokenizer.from_pretrained("facebook/galactica-125m")
158
+ model = OPTForCausalLM.from_pretrained("facebook/galactica-125m", device_map="auto", load_in_8bit=True)
159
+
160
+ input_text = "The Transformer architecture [START_REF]"
161
+ input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
162
+
163
+ outputs = model.generate(input_ids)
164
+ print(tokenizer.decode(outputs[0]))
165
+ ```
166
+
167
+ </details>
168
+
169
+ ## Performance and Limitations
170
+
171
+ The model outperforms several existing language models on a range of knowledge probes, reasoning, and knowledge-intensive scientific tasks. This also extends to general NLP tasks, where GALACTICA outperforms other open source general language models. That being said, we note a number of limitations in this section.
172
+
173
+ As with other language models, GALACTICA is often prone to hallucination - and training on a high-quality academic corpus does not prevent this, especially for less popular and less cited scientific concepts. There are no guarantees of truthful output when generating from the model. This extends to specific modalities such as citation prediction. While GALACTICA's citation behaviour approaches the ground truth citation behaviour with scale, the model continues to exhibit a popularity bias at larger scales.
174
+
175
+ In addition, we evaluated the model on several types of benchmarks related to stereotypes and toxicity. Overall, the model exhibits substantially lower toxicity rates compared to other large language models. That being said, the model continues to exhibit bias on certain measures (see the paper for details). So we recommend care when using the model for generations.
176
+
177
+ ## Broader Implications
178
+
179
+ GALACTICA can potentially be used as a new way to discover academic literature. We also expect a lot of downstream use for application to particular domains, such as mathematics, biology, and chemistry. In the paper, we demonstrated several examples of the model acting as alternative to standard search tools. We expect a new generation of scientific tools to be built upon large language models such as GALACTICA.
180
+
181
+ We encourage researchers to investigate beneficial and new use cases for these models. That being said, it is important to be aware of the current limitations of large language models. Researchers should pay attention to common issues such as hallucination and biases that could emerge from using these models.
182
+
183
+
184
+ ## Citation
185
+
186
+ ```bibtex
187
+ @inproceedings{GALACTICA,
188
+ title={GALACTICA: A Large Language Model for Science},
189
+ author={Ross Taylor and Marcin Kardas and Guillem Cucurull and Thomas Scialom and Anthony Hartshorn and Elvis Saravia and Andrew Poulton and Viktor Kerkez and Robert Stojnic},
190
+ year={2022}
191
+ }
192
+ ```
193
+