Update README.md
Browse files
README.md
CHANGED
@@ -1,138 +0,0 @@
|
|
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 1.6B`
|
22 |
-
|
23 |
-
## Model Description
|
24 |
-
|
25 |
-
`Stable LM 2 1.6B` is a 1.6 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 1.6B` by using the following code snippet:
|
30 |
-
|
31 |
-
```python
|
32 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
33 |
-
tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-2-1_6b", trust_remote_code=True)
|
34 |
-
model = AutoModelForCausalLM.from_pretrained(
|
35 |
-
"stabilityai/stablelm-2-1_6b",
|
36 |
-
trust_remote_code=True,
|
37 |
-
torch_dtype="auto",
|
38 |
-
)
|
39 |
-
model.cuda()
|
40 |
-
inputs = tokenizer("The weather is always wonderful", return_tensors="pt").to(model.device)
|
41 |
-
tokens = model.generate(
|
42 |
-
**inputs,
|
43 |
-
max_new_tokens=64,
|
44 |
-
temperature=0.70,
|
45 |
-
top_p=0.95,
|
46 |
-
do_sample=True,
|
47 |
-
)
|
48 |
-
print(tokenizer.decode(tokens[0], skip_special_tokens=True))
|
49 |
-
```
|
50 |
-
|
51 |
-
### Run with Flash Attention 2 ⚡️
|
52 |
-
|
53 |
-
<details>
|
54 |
-
<summary> Click to expand </summary>
|
55 |
-
|
56 |
-
```python
|
57 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
58 |
-
tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-2-1_6b", trust_remote_code=True)
|
59 |
-
model = AutoModelForCausalLM.from_pretrained(
|
60 |
-
"stabilityai/stablelm-2-1_6b",
|
61 |
-
trust_remote_code=True,
|
62 |
-
torch_dtype="auto",
|
63 |
-
attn_implementation="flash_attention_2",
|
64 |
-
)
|
65 |
-
model.cuda()
|
66 |
-
inputs = tokenizer("The weather is always wonderful", return_tensors="pt").to(model.device)
|
67 |
-
tokens = model.generate(
|
68 |
-
**inputs,
|
69 |
-
max_new_tokens=64,
|
70 |
-
temperature=0.70,
|
71 |
-
top_p=0.95,
|
72 |
-
do_sample=True,
|
73 |
-
)
|
74 |
-
print(tokenizer.decode(tokens[0], skip_special_tokens=True))
|
75 |
-
```
|
76 |
-
|
77 |
-
</details>
|
78 |
-
|
79 |
-
|
80 |
-
## Model Details
|
81 |
-
|
82 |
-
* **Developed by**: [Stability AI](https://stability.ai/)
|
83 |
-
* **Model type**: `Stable LM 2 1.6B` models are auto-regressive language models based on the transformer decoder architecture.
|
84 |
-
* **Language(s)**: English
|
85 |
-
* **Library**: [GPT-NeoX](https://github.com/EleutherAI/gpt-neox)
|
86 |
-
* **License**: [Stability AI Non-Commercial Research Community License](https://huggingface.co/stabilityai/stablelm-2-1_6b/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.
|
87 |
-
* **Contact**: For questions and comments about the model, please email `lm@stability.ai`
|
88 |
-
|
89 |
-
### Model Architecture
|
90 |
-
|
91 |
-
The model is a decoder-only transformer similar to the LLaMA ([Touvron et al., 2023](https://arxiv.org/abs/2307.09288)) architecture with the following modifications:
|
92 |
-
|
93 |
-
| Parameters | Hidden Size | Layers | Heads | Sequence Length |
|
94 |
-
|----------------|-------------|--------|-------|-----------------|
|
95 |
-
| 1,644,417,024 | 2048 | 24 | 32 | 4096 |
|
96 |
-
|
97 |
-
* **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).
|
98 |
-
* **Normalization**: LayerNorm ([Ba et al., 2016](https://arxiv.org/abs/1607.06450)) with learned bias terms as opposed to RMSNorm ([Zhang & Sennrich, 2019](https://arxiv.org/abs/1910.07467)).
|
99 |
-
* **Biases**: We remove all bias terms from the model except for attention Q,K,V projections ([Bai et al., 2023](https://arxiv.org/abs/2309.16609)).
|
100 |
-
* **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).
|
101 |
-
|
102 |
-
## Training
|
103 |
-
|
104 |
-
### Training Dataset
|
105 |
-
|
106 |
-
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).
|
107 |
-
|
108 |
-
* Given the large amount of web data, we recommend fine-tuning the base `Stable LM 2 1.6B` for your downstream tasks.
|
109 |
-
|
110 |
-
### Training Procedure
|
111 |
-
|
112 |
-
The model is pre-trained on the aforementioned datasets in `bfloat16` precision, optimized with AdamW, and trained using the NeoX 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-1.6b.yml). The final checkpoint of pre-training, before cooldown, is provided in the `global_step420000` [branch](https://huggingface.co/stabilityai/stablelm-2-1_6b/blob/global_step420000/README.md).
|
113 |
-
|
114 |
-
### Training Infrastructure
|
115 |
-
|
116 |
-
* **Hardware**: `Stable LM 2 1.6B` was trained on the Stability AI cluster across 512 NVIDIA A100 40GB GPUs (AWS P4d instances).
|
117 |
-
|
118 |
-
* **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))
|
119 |
-
|
120 |
-
## Use and Limitations
|
121 |
-
|
122 |
-
### Intended Use
|
123 |
-
|
124 |
-
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.
|
125 |
-
|
126 |
-
### Limitations and Bias
|
127 |
-
|
128 |
-
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.
|
129 |
-
|
130 |
-
## How to Cite
|
131 |
-
|
132 |
-
```bibtex
|
133 |
-
@misc{StableLM-2-1.6B,
|
134 |
-
url={[https://huggingface.co/stabilityai/stablelm-2-1.6b](https://huggingface.co/stabilityai/stablelm-2-1.6b)},
|
135 |
-
title={Stable LM 2 1.6B},
|
136 |
-
author={Stability AI Language Team}
|
137 |
-
}
|
138 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|