michaelfeil
commited on
Commit
•
b8bfc98
1
Parent(s):
a8514bf
Upload stabilityai/stablelm-base-alpha-3b ctranslate fp16 weights
Browse files- README.md +129 -0
- generation_config.json +6 -0
- model.bin +2 -2
- special_tokens_map.json +5 -0
README.md
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
license:
|
5 |
+
- cc-by-sa-4.0
|
6 |
+
tags:
|
7 |
+
- ctranslate2
|
8 |
+
- int8
|
9 |
+
- float16
|
10 |
+
- causal-lm
|
11 |
+
---
|
12 |
+
# # Fast-Inference with Ctranslate2
|
13 |
+
Speedup inference while reducing memory by 2x-4x using int8 inference in C++ on CPU or GPU.
|
14 |
+
|
15 |
+
quantized version of [stabilityai/stablelm-base-alpha-3b](https://huggingface.co/stabilityai/stablelm-base-alpha-3b)
|
16 |
+
```bash
|
17 |
+
pip install hf-hub-ctranslate2>=2.0.8
|
18 |
+
```
|
19 |
+
Converted on 2023-05-22 using
|
20 |
+
```
|
21 |
+
ct2-transformers-converter --model stabilityai/stablelm-base-alpha-3b --output_dir /home/michael/tmp-ct2fast-stablelm-base-alpha-3b --force --copy_files tokenizer.json README.md tokenizer_config.json generation_config.json special_tokens_map.json .gitattributes --quantization float16
|
22 |
+
```
|
23 |
+
|
24 |
+
Checkpoint compatible to [ctranslate2>=3.13.0](https://github.com/OpenNMT/CTranslate2) and [hf-hub-ctranslate2>=2.0.6](https://github.com/michaelfeil/hf-hub-ctranslate2)
|
25 |
+
- `compute_type=int8_float16` for `device="cuda"`
|
26 |
+
- `compute_type=int8` for `device="cpu"`
|
27 |
+
|
28 |
+
```python
|
29 |
+
from hf_hub_ctranslate2 import TranslatorCT2fromHfHub, GeneratorCT2fromHfHub
|
30 |
+
from transformers import AutoTokenizer
|
31 |
+
|
32 |
+
model_name = "michaelfeil/ct2fast-stablelm-base-alpha-3b"
|
33 |
+
# use either TranslatorCT2fromHfHub or GeneratorCT2fromHfHub here, depending on model.
|
34 |
+
model = GeneratorCT2fromHfHub(
|
35 |
+
# load in int8 on CUDA
|
36 |
+
model_name_or_path=model_name,
|
37 |
+
device="cuda",
|
38 |
+
compute_type="int8_float16",
|
39 |
+
# tokenizer=AutoTokenizer.from_pretrained("stabilityai/stablelm-base-alpha-3b")
|
40 |
+
)
|
41 |
+
outputs = model.generate(
|
42 |
+
text=["def print_hello_world():", "def hello_name(name:"],
|
43 |
+
max_length=64
|
44 |
+
)
|
45 |
+
print(outputs)
|
46 |
+
```
|
47 |
+
|
48 |
+
# Licence and other remarks:
|
49 |
+
This is just a quantized version. Licence conditions are intended to be idential to original huggingface repo.
|
50 |
+
|
51 |
+
# Original description
|
52 |
+
|
53 |
+
|
54 |
+
# StableLM-Base-Alpha
|
55 |
+
|
56 |
+
## Model Description
|
57 |
+
|
58 |
+
`StableLM-Base-Alpha` is a suite of 3B and 7B parameter decoder-only language models pre-trained on a diverse collection of English and Code datasets with a sequence length of 4096 to push beyond the context window limitations of existing open-source language models.
|
59 |
+
|
60 |
+
## Usage
|
61 |
+
|
62 |
+
Get started generating text with `StableLM-Base-Alpha` by using the following code snippet:
|
63 |
+
|
64 |
+
```python
|
65 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
66 |
+
|
67 |
+
tokenizer = AutoTokenizer.from_pretrained("StabilityAI/stablelm-base-alpha-3b")
|
68 |
+
model = AutoModelForCausalLM.from_pretrained("StabilityAI/stablelm-base-alpha-3b")
|
69 |
+
model.half().cuda()
|
70 |
+
|
71 |
+
inputs = tokenizer("What's your mood today?", return_tensors="pt").to("cuda")
|
72 |
+
tokens = model.generate(
|
73 |
+
**inputs,
|
74 |
+
max_new_tokens=64,
|
75 |
+
temperature=0.7,
|
76 |
+
do_sample=True,
|
77 |
+
)
|
78 |
+
print(tokenizer.decode(tokens[0], skip_special_tokens=True))
|
79 |
+
```
|
80 |
+
|
81 |
+
## Model Details
|
82 |
+
|
83 |
+
* **Developed by**: [Stability AI](https://stability.ai/)
|
84 |
+
* **Model type**: StableLM-Base-Alpha models are auto-regressive language models based on the NeoX transformer architecture.
|
85 |
+
* **Language(s)**: English
|
86 |
+
* **Library**: [GPT-NeoX](https://github.com/EleutherAI/gpt-neox)
|
87 |
+
* **License**: Base model checkpoints (StableLM-Base-Alpha) are licensed under the Creative Commons license (CC BY-SA-4.0). Under the license, you must give credit to Stability AI, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the Stability AI endorses you or your use.
|
88 |
+
|
89 |
+
|
90 |
+
* **Contact**: For questions and comments about the model, please email `[email protected]`
|
91 |
+
|
92 |
+
## Training
|
93 |
+
|
94 |
+
| Parameters | Hidden Size | Layers | Heads | Sequence Length |
|
95 |
+
|------------|-------------|--------|-------|-----------------|
|
96 |
+
| 3B | 4096 | 16 | 32 | 4096 |
|
97 |
+
| 7B | 6144 | 16 | 48 | 4096 |
|
98 |
+
|
99 |
+
### Training Dataset
|
100 |
+
|
101 |
+
`StableLM-Base-Alpha` is pre-trained on a new experimental dataset built atop [The Pile](https://huggingface.co/datasets/EleutherAI/the_pile) and is threes times larger at approximately 1.5T tokens.
|
102 |
+
|
103 |
+
### Training Procedure
|
104 |
+
|
105 |
+
Models are pre-trained on the aforementioned dataset in mixed-precision (FP16), optimized with Adam, and trained using the NeoX tokenizer with a vocabulary size of 50,257. We outline the complete hyperparameters choices in the project's [GitHub repository](https://github.com/Stability-AI/StableLM/blob/main/configs/stablelm-base-alpha-3b.yaml).
|
106 |
+
|
107 |
+
## Use and Limitations
|
108 |
+
|
109 |
+
### Intended Use
|
110 |
+
|
111 |
+
These models are intended to be used by all individuals as foundational models for application-specific fine-tuning without strict limitations on commercial use.
|
112 |
+
|
113 |
+
### Limitations and bias
|
114 |
+
|
115 |
+
The pre-training dataset may contain offensive or inappropriate content even after applying data cleansing filters which can be reflected in generated text. We recommend users exercise reasonable caution when using these models in production systems. Do not use the models for any applications that may cause harm or distress to individuals or groups.
|
116 |
+
|
117 |
+
## Citations
|
118 |
+
|
119 |
+
```bibtext
|
120 |
+
@software{gpt-neox-library,
|
121 |
+
title = {{GPT-NeoX: Large Scale Autoregressive Language Modeling in PyTorch}},
|
122 |
+
author = {Andonian, Alex and Anthony, Quentin and Biderman, Stella and Black, Sid and Gali, Preetham and Gao, Leo and Hallahan, Eric and Levy-Kramer, Josh and Leahy, Connor and Nestler, Lucas and Parker, Kip and Pieler, Michael and Purohit, Shivanshu and Songz, Tri and Phil, Wang and Weinbach, Samuel},
|
123 |
+
url = {https://www.github.com/eleutherai/gpt-neox},
|
124 |
+
doi = {10.5281/zenodo.5879544},
|
125 |
+
month = {8},
|
126 |
+
year = {2021},
|
127 |
+
version = {0.0.1},
|
128 |
+
}
|
129 |
+
```
|
generation_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 0,
|
4 |
+
"eos_token_id": 0,
|
5 |
+
"transformers_version": "4.27.4"
|
6 |
+
}
|
model.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:739259e66a3b99efe78a31f147b56544cc7428454670164feec0b8487424b51a
|
3 |
+
size 7274590954
|
special_tokens_map.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": "<|endoftext|>",
|
3 |
+
"eos_token": "<|endoftext|>",
|
4 |
+
"unk_token": "<|endoftext|>"
|
5 |
+
}
|