初始化项目,由ModelHub XC社区提供模型
Model: Azurro/APT3-275M-Base Source: Original Platform
This commit is contained in:
35
.gitattributes
vendored
Normal file
35
.gitattributes
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
180
README.md
Normal file
180
README.md
Normal file
@@ -0,0 +1,180 @@
|
||||
---
|
||||
license: cc-by-nc-4.0
|
||||
datasets:
|
||||
- chrisociepa/wikipedia-pl-20230401
|
||||
language:
|
||||
- pl
|
||||
library_name: transformers
|
||||
tags:
|
||||
- llama
|
||||
- ALLaMo
|
||||
inference: false
|
||||
---
|
||||
|
||||
# APT3-275M-Base
|
||||
|
||||
## Introduction
|
||||
|
||||
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.
|
||||
|
||||
## Statements
|
||||
|
||||
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.
|
||||
We have made the following statements:
|
||||
|
||||
* we use 1 consumer graphic card
|
||||
* we train the model only with the Polish corpus
|
||||
* we use manually selected, high quality texts for training the model.
|
||||
|
||||
Why have we made such statements?
|
||||
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).
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
## Model
|
||||
|
||||
APT3-275M-Base 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.
|
||||
|
||||
APT3-275M-Base is an autoregressive language model based on the architecture of a transformer. It has been trained with data collected before November 2023.
|
||||
|
||||
21 billion tokens were used for training on the Polish corpus for one epoch.
|
||||
|
||||
A specialized tokenizer has been prepared and trained specifically for training the models in the APT3 series.
|
||||
|
||||
### Model description:
|
||||
|
||||
* **Developed by:** [Azurro](https://azurro.pl)
|
||||
* **Language:** Polish
|
||||
* **Model type:** causal decoder-only
|
||||
* **License:** CC BY NC 4.0 (non-commercial use)
|
||||
|
||||
|
||||
### Model details:
|
||||
|
||||
| **Hyperparameter** | **Value** |
|
||||
|--------------------|-------------|
|
||||
| Model Parameters | 275M |
|
||||
| Sequence Length | 1024 |
|
||||
| Vocabulary Size | 31980 |
|
||||
| Layers | 32 |
|
||||
| Heads | 16 |
|
||||
| d_head | 64 |
|
||||
| d_model | 768 |
|
||||
| Dropout | 0.0 |
|
||||
| Bias | No |
|
||||
| Positional Encoding | RoPE |
|
||||
| Activation Function | SwiGLU |
|
||||
| Normalizing Function | RMSNorm |
|
||||
| Intermediate Size | 2048 |
|
||||
| Norm Epsilon | 1e-06 |
|
||||
|
||||
### Tokenizer details:
|
||||
|
||||
* type: BPE
|
||||
* special tokens: 8 (`<unk>`, `<s>`, `</s>`, `<pad>`, `[INST]`, `[/INST]`, `<<SYS>>`, `<</SYS>>`)
|
||||
* alphabet size: 113
|
||||
* vocabulary size: 31980
|
||||
|
||||
## Training
|
||||
|
||||
* Framework: [ALLaMo](https://github.com/chrisociepa/allamo)
|
||||
* Visualizations: [W&B](https://wandb.ai)
|
||||
|
||||
<p align="center">
|
||||
<img src="https://huggingface.co/Azurro/APT3-275M-Base/raw/main/apt3-275m-base.png">
|
||||
</p>
|
||||
|
||||
### Training hyperparameters:
|
||||
|
||||
| **Hyperparameter** | **Value** |
|
||||
|-----------------------------|------------------|
|
||||
| Micro Batch Size | 13 |
|
||||
| Gradient Accumulation Steps | 40 |
|
||||
| Batch Size | 532480 |
|
||||
| Learning Rate (cosine) | 4e-04 -> 2e-05 |
|
||||
| Warmup Iterations | 1000 |
|
||||
| All Iterations | 40000 |
|
||||
| Optimizer | AdamW |
|
||||
| β1, β2 | 0.9, 0.95 |
|
||||
| Adam_eps | 1e−8 |
|
||||
| Weight Decay | 0.1 |
|
||||
| Grad Clip | 1.0 |
|
||||
| Precision | bfloat16 |
|
||||
|
||||
### Dataset
|
||||
|
||||
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.
|
||||
|
||||
Our training dataset contains:
|
||||
|
||||
* ebooks 8%
|
||||
* Polish Wikipedia 4%
|
||||
* web crawl data 88%
|
||||
|
||||
### Quickstart
|
||||
|
||||
This model can be easily loaded using the AutoModelForCausalLM functionality.
|
||||
|
||||
```python
|
||||
from transformers import AutoTokenizer, AutoModelForCausalLM
|
||||
|
||||
model_name = "Azurro/APT3-275M-Base"
|
||||
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
||||
model = AutoModelForCausalLM.from_pretrained(model_name)
|
||||
```
|
||||
|
||||
In order to reduce the memory usage, you can use smaller precision (`bfloat16`).
|
||||
|
||||
```python
|
||||
import torch
|
||||
|
||||
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16)
|
||||
```
|
||||
|
||||
And then you can use Hugging Face Pipelines to generate text.
|
||||
|
||||
```python
|
||||
import transformers
|
||||
|
||||
text = "Najważniejszym celem człowieka na ziemi jest"
|
||||
|
||||
pipeline = transformers.pipeline("text-generation", model=model, tokenizer=tokenizer)
|
||||
sequences = pipeline(text_inputs=text, max_new_tokens=100, do_sample=True, top_k=200, eos_token_id=tokenizer.eos_token_id)
|
||||
for seq in sequences:
|
||||
print(f"Result: {seq['generated_text']}")
|
||||
```
|
||||
Generated output:
|
||||
> Najważniejszym celem człowieka na ziemi jest osiągnięcie pokoju. W przeszłości była to również kwestia honoru. Jednak o ile po dziś dzień nie budzi to żadnych wątpliwości, to życie ludzkie w XXI wieku jest częścią większej całości, która składa się z wielu elementów. Nie ma tu żadnej jedności, więc tak naprawdę każdy człowiek ma pewne zasady, które decydują o jego życiu i to właśnie one determinują jego przyszłość. Myślę, że nie sposób pominąć tutaj również religii. Religia w starożytności traktowana była jako jedna z naczelnych zasad chrześcijaństwa.
|
||||
|
||||
## Limitations and Biases
|
||||
|
||||
APT3-275M-Base is not intended for deployment without fine-tuning. It should not be used for human-facing interactions without further guardrails and user consent.
|
||||
|
||||
APT3-275M-Base can produce factually incorrect output, and should not be relied on to produce factually accurate information. APT3-275M-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.
|
||||
|
||||
## License
|
||||
|
||||
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.
|
||||
|
||||
## Disclaimer
|
||||
|
||||
The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model.
|
||||
|
||||
## Citation
|
||||
Please cite this model using the following format:
|
||||
|
||||
```
|
||||
@online{AzurroAPT3Base275M,
|
||||
author = {Ociepa, Krzysztof and {Azurro Team}},
|
||||
title = {Introducing APT3-275M-Base: Polish Language Model},
|
||||
year = {2023},
|
||||
url = {https://azurro.pl/apt3-275m-base-en},
|
||||
note = {Accessed: 2023-11-20}, % change this date
|
||||
urldate = {2023-11-20} % change this date
|
||||
}
|
||||
```
|
||||
3
allamo_config_ckpt.pt
Normal file
3
allamo_config_ckpt.pt
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:842254363436282db55a0f2ef2c4ae87bb064e74214a1c3ec587179c0512925c
|
||||
size 3504
|
||||
3
allamo_model_ckpt.pt
Normal file
3
allamo_model_ckpt.pt
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b56011cafbee0447ecc811a02a46ae33ab8922db5105c2ccf0c558f42e48b3de
|
||||
size 1102778017
|
||||
3
allamo_optimizer_ckpt.pt
Normal file
3
allamo_optimizer_ckpt.pt
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:55e1604653905bfd5d6abdaf9aeb9771a16c467def24d5da1d5ddbba5f42242f
|
||||
size 2205562459
|
||||
BIN
apt3-275m-base.png
Normal file
BIN
apt3-275m-base.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 85 KiB |
26
config.json
Normal file
26
config.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"architectures": [
|
||||
"LlamaForCausalLM"
|
||||
],
|
||||
"attention_bias": false,
|
||||
"bos_token_id": 1,
|
||||
"eos_token_id": 2,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 768,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 2048,
|
||||
"max_position_embeddings": 2048,
|
||||
"model_type": "llama",
|
||||
"num_attention_heads": 12,
|
||||
"num_hidden_layers": 32,
|
||||
"num_key_value_heads": 12,
|
||||
"pretraining_tp": 1,
|
||||
"rms_norm_eps": 1e-06,
|
||||
"rope_scaling": null,
|
||||
"rope_theta": 10000.0,
|
||||
"tie_word_embeddings": false,
|
||||
"torch_dtype": "float32",
|
||||
"transformers_version": "4.35.0",
|
||||
"use_cache": true,
|
||||
"vocab_size": 31980
|
||||
}
|
||||
6
generation_config.json
Normal file
6
generation_config.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"_from_model_config": true,
|
||||
"bos_token_id": 1,
|
||||
"eos_token_id": 2,
|
||||
"transformers_version": "4.35.0"
|
||||
}
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ad6c5afde1ae5bf29af11ccd8ded11316a35f88a233470be0388872ebaa0c4b4
|
||||
size 1102687008
|
||||
6
special_tokens_map.json
Normal file
6
special_tokens_map.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"bos_token": "<s>",
|
||||
"eos_token": "</s>",
|
||||
"pad_token": "<pad>",
|
||||
"unk_token": "<unk>"
|
||||
}
|
||||
63929
tokenizer.json
Normal file
63929
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
15
tokenizer_config.json
Normal file
15
tokenizer_config.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"clean_up_tokenization_spaces": true,
|
||||
"model_max_length": 1000000000000000019884624838656,
|
||||
"special_tokens": [
|
||||
"<unk>",
|
||||
"<s>",
|
||||
"</s>",
|
||||
"<pad>",
|
||||
"[INST]",
|
||||
"[/INST]",
|
||||
"<<SYS>>",
|
||||
"<</SYS>>"
|
||||
],
|
||||
"tokenizer_class": "PreTrainedTokenizerFast"
|
||||
}
|
||||
Reference in New Issue
Block a user