RichardErkhov commited on
Commit
728dc46
1 Parent(s): bd3e38d

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +163 -0
README.md ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ stablelm-2-12b - bnb 4bits
11
+ - Model creator: https://huggingface.co/stabilityai/
12
+ - Original model: https://huggingface.co/stabilityai/stablelm-2-12b/
13
+
14
+
15
+
16
+
17
+ Original model description:
18
+ ---
19
+ language:
20
+ - en
21
+ - de
22
+ - es
23
+ - fr
24
+ - it
25
+ - nl
26
+ - pt
27
+ license: other
28
+ tags:
29
+ - causal-lm
30
+ datasets:
31
+ - tiiuae/falcon-refinedweb
32
+ - togethercomputer/RedPajama-Data-1T
33
+ - uonlp/CulturaX
34
+ - CarperAI/pilev2-dev
35
+ - bigcode/starcoderdata
36
+ - DataProvenanceInitiative/Commercially-Verified-Licenses
37
+ ---
38
+ # `Stable LM 2 12B`
39
+
40
+ ## Model Description
41
+
42
+ `Stable LM 2 12B` is a 12.1 billion parameter decoder-only language model pre-trained on 2 trillion tokens of diverse multilingual and code datasets for two epochs.
43
+
44
+ Please note: For commercial use, please refer to https://stability.ai/membership.
45
+
46
+ ## Usage
47
+
48
+ **NOTE**: This model requires `transformers>=4.40.0`
49
+
50
+ Get started generating text with `Stable LM 2 12B` by using the following code snippet:
51
+
52
+ ```python
53
+ from transformers import AutoModelForCausalLM, AutoTokenizer
54
+ tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-2-12b")
55
+ model = AutoModelForCausalLM.from_pretrained(
56
+ "stabilityai/stablelm-2-12b",
57
+ torch_dtype="auto",
58
+ )
59
+ model.cuda()
60
+ inputs = tokenizer("The weather is always wonderful", return_tensors="pt").to(model.device)
61
+ tokens = model.generate(
62
+ **inputs,
63
+ max_new_tokens=64,
64
+ temperature=0.70,
65
+ top_p=0.95,
66
+ do_sample=True,
67
+ )
68
+ print(tokenizer.decode(tokens[0], skip_special_tokens=True))
69
+ ```
70
+
71
+ ### Run with Flash Attention 2 ⚡️
72
+
73
+ <details>
74
+ <summary> Click to expand </summary>
75
+
76
+ ```python
77
+ from transformers import AutoModelForCausalLM, AutoTokenizer
78
+ tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-2-12b")
79
+ model = AutoModelForCausalLM.from_pretrained(
80
+ "stabilityai/stablelm-2-12b",
81
+ torch_dtype="auto",
82
+ attn_implementation="flash_attention_2",
83
+ )
84
+ model.cuda()
85
+ inputs = tokenizer("The weather is always wonderful", return_tensors="pt").to(model.device)
86
+ tokens = model.generate(
87
+ **inputs,
88
+ max_new_tokens=64,
89
+ temperature=0.70,
90
+ top_p=0.95,
91
+ do_sample=True,
92
+ )
93
+ print(tokenizer.decode(tokens[0], skip_special_tokens=True))
94
+ ```
95
+
96
+ </details>
97
+
98
+ ## Model Details
99
+
100
+ * **Developed by**: [Stability AI](https://stability.ai/)
101
+ * **Model type**: `Stable LM 2 12B` models are auto-regressive language models based on the transformer decoder architecture.
102
+ * **Language(s)**: English
103
+ * **Paper**: [Stable LM 2 Technical Report](https://arxiv.org/abs/2402.17834)
104
+ * **Library**: [GPT-NeoX](https://github.com/EleutherAI/gpt-neox)
105
+ * **License**: [Stability AI Non-Commercial Research Community License](https://huggingface.co/stabilityai/stablelm-2-12b/blob/main/LICENSE).
106
+ * **Commercial License**: to use this model commercially, please refer to https://stability.ai/membership
107
+ * **Contact**: For questions and comments about the model, please email `lm@stability.ai`
108
+
109
+ ### Model Architecture
110
+
111
+ The model is a decoder-only transformer with the following architecture:
112
+
113
+ | Parameters | Hidden Size | Layers | Heads | KV Heads | Sequence Length |
114
+ |----------------|-------------|--------|-------|----------|-----------------|
115
+ | 12,143,605,760 | 5120 | 40 | 32 | 8 | 4096 |
116
+
117
+ * **Position Embeddings**: Rotary Position Embeddings ([Su et al., 2021](https://arxiv.org/abs/2104.09864)) applied to the first 25% of head embedding dimensions for improved throughput following [Black et al. (2022)](https://arxiv.org/pdf/2204.06745.pdf).
118
+ * **Parallel Layers**: Parallel attention and feed-forward residual layers with a single input LayerNorm ([Wang, 2021](https://github.com/kingoflolz/mesh-transformer-jax)).
119
+ * **Normalization**: LayerNorm ([Ba et al., 2016](https://arxiv.org/abs/1607.06450)) without biases. Furthermore, we apply per-head QK normalization ([Dehghani et al., 2023](https://arxiv.org/abs/2302.05442), [Wortsman et al., 2023](https://arxiv.org/abs/2309.14322)).
120
+ * **Biases**: We remove all bias terms from the feed-forward networks and grouped-query self-attention layers.
121
+ * **Tokenizer**: We use Arcade100k, a BPE tokenizer extended from OpenAI's [`tiktoken.cl100k_base`](https://github.com/openai/tiktoken). We split digits into individual tokens following findings by [Liu & Low (2023)](https://arxiv.org/abs/2305.14201).
122
+
123
+ ## Training
124
+
125
+ ### Training Dataset
126
+
127
+ The dataset is comprised of a filtered mixture of open-source large-scale datasets available on the [HuggingFace Hub](https://huggingface.co/datasets): Falcon RefinedWeb extract ([Penedo et al., 2023](https://huggingface.co/datasets/tiiuae/falcon-refinedweb)), RedPajama-Data ([Together Computer., 2023](https://github.com/togethercomputer/RedPajama-Data)) and The Pile ([Gao et al., 2020](https://arxiv.org/abs/2101.00027)) both without the *Books3* subset, and StarCoder ([Li et al., 2023](https://arxiv.org/abs/2305.06161)). We further supplement our training with multi-lingual data from CulturaX ([Nguyen et al., 2023](https://arxiv.org/abs/2309.09400)) and, in particular, from its OSCAR corpora, as well as restructured data in the style of [Yuan & Liu (2022)](https://arxiv.org/abs/2206.11147).
128
+
129
+ * Given the large amount of web data, we recommend fine-tuning the base `Stable LM 2 12B` for your downstream tasks.
130
+
131
+ ### Training Procedure
132
+
133
+ The model is pre-trained on the aforementioned datasets in `bfloat16` precision, optimized with AdamW, and trained using the Arcade100k tokenizer with a vocabulary size of 100,352. We outline the complete hyperparameters choices in the project's [GitHub repository - config*](https://github.com/Stability-AI/StableLM/blob/main/configs/stablelm-2-12b.yml).
134
+
135
+ ### Training Infrastructure
136
+
137
+ * **Hardware**: `Stable LM 2 12B` was trained on the Stability AI cluster across 384 NVIDIA H100 GPUs (AWS P5 instances).
138
+
139
+ * **Software**: We use a fork of `gpt-neox` ([EleutherAI, 2021](https://github.com/EleutherAI/gpt-neox)), train under 2D parallelism (Data and Tensor Parallel) with ZeRO-1 ([Rajbhandari et al., 2019](https://arxiv.org/abs/1910.02054v3)), and rely on flash-attention as well as SwiGLU and Rotary Embedding kernels from FlashAttention-2 ([Dao et al., 2023](https://tridao.me/publications/flash2/flash2.pdf))
140
+
141
+ ## Use and Limitations
142
+
143
+ ### Intended Use
144
+
145
+ The model is intended to be used as a foundational base model for application-specific fine-tuning. Developers must evaluate and fine-tune the model for safe performance in downstream applications. For commercial use, please refer to https://stability.ai/membership.
146
+
147
+ ### Limitations and Bias
148
+
149
+ As a base model, this model may exhibit unreliable, unsafe, or other undesirable behaviors that must be corrected through evaluation and fine-tuning prior to deployment. The pre-training dataset may have contained offensive or inappropriate content, even after applying data cleansing filters, which can be reflected in the model-generated text. We recommend that users exercise caution when using these models in production systems. Do not use the models if they are unsuitable for your application, or for any applications that may cause deliberate or unintentional harm to others.
150
+
151
+ ## How to Cite
152
+
153
+ ```bibtex
154
+ @article{bellagente2024stable,
155
+ title={Stable LM 2 1.6 B Technical Report},
156
+ author={Bellagente, Marco and Tow, Jonathan and Mahan, Dakota and Phung, Duy and Zhuravinskyi, Maksym and Adithyan, Reshinth and Baicoianu, James and Brooks, Ben and Cooper, Nathan and Datta, Ashish and others},
157
+ journal={arXiv preprint arXiv:2402.17834},
158
+ year={2024}
159
+ }
160
+ ```
161
+
162
+
163
+