jon-tow commited on
Commit
b42bea9
0 Parent(s):

initial commit

Browse files
Files changed (2) hide show
  1. .gitattributes +35 -0
  2. README.md +136 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ datasets:
4
+ - tiiuae/falcon-refinedweb
5
+ - togethercomputer/RedPajama-Data-1T
6
+ - uonlp/CulturaX
7
+ - CarperAI/pilev2-dev
8
+ - bigcode/starcoderdata
9
+ - DataProvenanceInitiative/Commercially-Verified-Licenses
10
+ language:
11
+ - en
12
+ - de
13
+ - es
14
+ - fr
15
+ - it
16
+ - nl
17
+ - pt
18
+ tags:
19
+ - causal-lm
20
+ ---
21
+ # `Stable LM 2 12B`
22
+
23
+ ## Model Description
24
+
25
+ `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.
26
+
27
+ ## Usage
28
+
29
+ Get started generating text with `Stable LM 2 12B` by using the following code snippet:
30
+
31
+ ```python
32
+ from transformers import AutoModelForCausalLM, AutoTokenizer
33
+ tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-2-12b")
34
+ model = AutoModelForCausalLM.from_pretrained(
35
+ "stabilityai/stablelm-2-12b",
36
+ torch_dtype="auto",
37
+ )
38
+ model.cuda()
39
+ inputs = tokenizer("The weather is always wonderful", return_tensors="pt").to(model.device)
40
+ tokens = model.generate(
41
+ **inputs,
42
+ max_new_tokens=64,
43
+ temperature=0.70,
44
+ top_p=0.95,
45
+ do_sample=True,
46
+ )
47
+ print(tokenizer.decode(tokens[0], skip_special_tokens=True))
48
+ ```
49
+
50
+ ### Run with Flash Attention 2 ⚡️
51
+
52
+ <details>
53
+ <summary> Click to expand </summary>
54
+
55
+ ```python
56
+ from transformers import AutoModelForCausalLM, AutoTokenizer
57
+ tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-2-12b")
58
+ model = AutoModelForCausalLM.from_pretrained(
59
+ "stabilityai/stablelm-2-12b",
60
+ torch_dtype="auto",
61
+ attn_implementation="flash_attention_2",
62
+ )
63
+ model.cuda()
64
+ inputs = tokenizer("The weather is always wonderful", return_tensors="pt").to(model.device)
65
+ tokens = model.generate(
66
+ **inputs,
67
+ max_new_tokens=64,
68
+ temperature=0.70,
69
+ top_p=0.95,
70
+ do_sample=True,
71
+ )
72
+ print(tokenizer.decode(tokens[0], skip_special_tokens=True))
73
+ ```
74
+
75
+ </details>
76
+
77
+ ## Model Details
78
+
79
+ * **Developed by**: [Stability AI](https://stability.ai/)
80
+ * **Model type**: `Stable LM 2 12B` models are auto-regressive language models based on the transformer decoder architecture.
81
+ * **Language(s)**: English
82
+ * **Library**: [GPT-NeoX](https://github.com/EleutherAI/gpt-neox)
83
+ * **License**: [Stability AI Non-Commercial Research Community License](https://huggingface.co/stabilityai/stablelm-2-12b/blob/main/LICENSE). If you'd like to use this model for commercial products or purposes, please contact us [here](https://stability.ai/membership) to learn more.
84
+ * **Contact**: For questions and comments about the model, please email `lm@stability.ai`
85
+
86
+ ### Model Architecture
87
+
88
+ The model is a decoder-only transformer with the following architecture:
89
+
90
+ | Parameters | Hidden Size | Layers | Heads | KV Heads | Sequence Length |
91
+ |----------------|-------------|--------|-------|----------|-----------------|
92
+ | 12,143,605,760 | 5120 | 40 | 32 | 8 | 4096 |
93
+
94
+ * **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).
95
+ * **Parallel Layers**: Parallel attention and feed-forward residual layers with a single input LayerNorm ([Wang, 2021](https://github.com/kingoflolz/mesh-transformer-jax)).
96
+ * **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)).
97
+ * **Biases**: We remove all bias terms from the feed-forward networks and grouped-query self-attention layers.
98
+ * **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).
99
+
100
+ ## Training
101
+
102
+ ### Training Dataset
103
+
104
+ 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).
105
+
106
+ * Given the large amount of web data, we recommend fine-tuning the base `Stable LM 2 12B` for your downstream tasks.
107
+
108
+ ### Training Procedure
109
+
110
+ 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).
111
+
112
+ ### Training Infrastructure
113
+
114
+ * **Hardware**: `Stable LM 2 12B` was trained on the Stability AI cluster across 384 NVIDIA H100 GPUs (AWS P5 instances).
115
+
116
+ * **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))
117
+
118
+ ## Use and Limitations
119
+
120
+ ### Intended Use
121
+
122
+ 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.
123
+
124
+ ### Limitations and Bias
125
+
126
+ 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.
127
+
128
+ ## How to Cite
129
+
130
+ ```bibtex
131
+ @misc{StableLM-2-12B,
132
+ url={[https://huggingface.co/stabilityai/stablelm-2-12b](https://huggingface.co/stabilityai/stablelm-2-12b)},
133
+ title={Stable LM 2 12B},
134
+ author={Stability AI Language Team}
135
+ }
136
+ ```