chrisociepa commited on
Commit
6fb9f0c
1 Parent(s): 6dfd1ab

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +140 -0
README.md CHANGED
@@ -1,3 +1,143 @@
1
  ---
2
  license: cc-by-nc-4.0
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: cc-by-nc-4.0
3
+ datasets:
4
+ - chrisociepa/wikipedia-pl-20230401
5
+ language:
6
+ - pl
7
+ library_name: transformers
8
+ tags:
9
+ - llama
10
+ - ALLaMo
11
+ pipeline_tag: text-generation
12
  ---
13
+
14
+ # APT-1B-Base
15
+
16
+ ### Introduction
17
+
18
+ At [Azurro](https://azurro.pl), we consistently place importance on using the Open Source technologies, both while working on the projects and in our everyday lives. We have decided to share a base language model trained by us. We are confident that smaller language models have great potential, and direct access to them for all people that are interested in such models democratizes this significant and dynamically changing field even more.
19
+
20
+ ### Statements
21
+
22
+ Training large language models requires a lot of computing power and it is meant for the major players on the market. However, does it mean that individuals or small companies cannot train language models capable of performing specific tasks? We decided to answer this question and train our own language model from scratch.
23
+ We have made the following statements:
24
+
25
+ * we use 1 consumer graphic card
26
+ * we train the model only with the Polish corpus
27
+ * we use manually selected, high quality texts for training the model.
28
+
29
+ Why have we made such statements?
30
+ It is worth noting that training a model requires several times more resources than using it. To put it simply, it can be assumed that it is about 3-4 times more. Therefore, if a model can be run with a graphic card that has 6 GB VRAM, then training this model requires about 24 GB VRAM (this is the minimum value).
31
+
32
+ Many consumer computers are equipped with good quality graphic cards that can be used for training a model at one’s own home. This is why we have decided to use a top consumer graphic card - Nvidia’s RTX 4090 24GB VRAM.
33
+
34
+ All the currently available language models have been trained mainly with English corpora with a little bit of other languages, including Polish. The effect is that these models are not the best at dealing with the Polish texts. Even the popular GPT-3.5 model from OpenAI often has issues with correct forms. Therefore we have decided to prepare a model based only on the Polish corpus. An additional advantage of using only the Polish corpus is the size of the model - it is better to focus on one language in the case of smaller models.
35
+
36
+ It is important to remember that models are as good as the data with which they are trained. Having regard to the small size of the model, we trained it with carefully selected texts. This is why we have not used corpora such as Common Crawl that contain a lot of poor quality data. Our team has prepared a set of sources that then have been processed and used for training the model.
37
+
38
+ ### Model
39
+
40
+ APT-1B-Base is a base model introducing a new series of the APT (Azurro Pretrained Transformer) models. It has been trained with the use of an original open source framework called [ALLaMo](https://github.com/chrisociepa/allamo). This framework allows the user to train language models similar to the Meta AI’s LLaMA models quickly and efficiently.
41
+
42
+ APT-1B-Base is an autoregressive language model based on the architecture of a transformer. It has been trained with data collected before April 2023.
43
+
44
+ 20 billion tokens have been used for training, and the training dataset (the Polish corpus) has 3 billion tokens. Chinchilla’s scaling law has been applied (20 tokens per every model parameter).
45
+
46
+ A special tokenizer has been prepared and trained for the purpose of training the model.
47
+
48
+ Model description:
49
+
50
+ * developed by [Azurro](https://azurro.pl)
51
+ * language: Polish
52
+ * model type: causal decoder-only
53
+ * license: CC BY NC 4.0 (non-commercial use)
54
+
55
+ Model details:
56
+
57
+ * model parameters: 1060M
58
+ * sequence length: 2048
59
+ * vocabulary size: 8000
60
+ * layers: 20
61
+ * heads: 16
62
+ * d_head: 128
63
+ * d_model: 2048
64
+ * dropout: 0.0
65
+ * no bias
66
+ * positional encoding: RoPE
67
+ * activation function: SwiGLU
68
+ * normalizing function: RMSNorm
69
+ * intermediate size: 5632
70
+ * norm epsilon: 1e-06
71
+
72
+ Training hyperparameters:
73
+
74
+ * micro batch size: 1
75
+ * gradient accumulation steps: 264
76
+ * batch size: 540672 = 1 * 264 * 2048
77
+ * learning rate: 3e-04
78
+ * optimizer: AdamW, (β1, β2) = (0.9, 0.95), adam_eps = 1e−8
79
+ * weight decay: 0.1
80
+ * grad clip: 1.0
81
+
82
+ Tokenizer details:
83
+
84
+ * type: BPE
85
+ * special tokens: 7
86
+ * alphabet size: 112
87
+ * vocabulary size: 8000
88
+
89
+ ### Training dataset
90
+
91
+ Collecting a large amount of high quality training data is a great challenge. Over the past years at Azurro, we have done a lot of projects connected with processing Big Data. Therefore, with our extensive experience, we have been able to prepare carefully selected training dataset quickly and efficiently.
92
+
93
+ Our training dataset contains:
94
+
95
+ * ebooks: 1354 million tokens
96
+ * Polish Wikipedia: 970 million tokens
97
+ * web crawl data: 813 million tokens
98
+
99
+ # How to Use
100
+
101
+ Our model is fully compatible with HuggingFace - you can use it right away.
102
+
103
+ Regarding the full precision, it can be run on a graphic card with 6 GB VRAM.
104
+
105
+ ```python
106
+ import transformers
107
+ model = transformers.AutoModelForCausalLM.from_pretrained('Azurro/APT-1B-Base')
108
+ ```
109
+
110
+ In order to reduce the memory usage, you can use smaller precision (bfloat16) and run the model on a graphic card with 4 GB VRAM.
111
+
112
+ ```python
113
+ import transformers
114
+ model = transformers.AutoModelForCausalLM.from_pretrained('Azurro/APT-1B-Base', torch_dtype=torch.bfloat16)
115
+ ```
116
+
117
+ ### Limitations and Biases
118
+
119
+ APT-1B-Base is not intended for deployment without fine-tuning. It should not be used for human-facing interactions without further guardrails and user consent.
120
+
121
+ APT-1B-Base can produce factually incorrect output, and should not be relied on to produce factually accurate information. APT-1B-Base was trained on various public datasets. While great efforts have been taken to clean the pretraining data, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
122
+
123
+ ### License
124
+
125
+ Because of an unclear legal situation, we have decided to publish the model under CC BY NC 4.0 license - it allows for non-commercial use. The model can be used for scientific purposes and privately, as long as the license conditions are met.
126
+
127
+ ### Disclaimer
128
+
129
+ The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model.
130
+
131
+ ### Citation
132
+ Please cite this model using the following format:
133
+
134
+ ```
135
+ @online{AzurroAPT1BBase,
136
+ author = {Krzysztof Ociepa, Azurro},
137
+ title = {Introducing APT-1B-Base: a new open source LLM for Polish},
138
+ year = {2023},
139
+ url = {www.azurro.pl},
140
+ note = {Accessed: 2023-06-14}, % change this date
141
+ urldate = {2023-06-14} % change this date
142
+ }
143
+ ```