Instructions to use dccuchile/albert-tiny-spanish with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dccuchile/albert-tiny-spanish with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForPreTraining tokenizer = AutoTokenizer.from_pretrained("dccuchile/albert-tiny-spanish") model = AutoModelForPreTraining.from_pretrained("dccuchile/albert-tiny-spanish", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update model card
#2
by vgaraujov - opened
README.md
CHANGED
|
@@ -7,20 +7,68 @@ tags:
|
|
| 7 |
- OpenCENIA
|
| 8 |
datasets:
|
| 9 |
- large_spanish_corpus
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
#
|
| 13 |
|
| 14 |
-
|
| 15 |
-
The model was trained on a single TPU v3-8 with the following hyperparameters and steps/time:
|
| 16 |
-
- LR: 0.00125
|
| 17 |
-
- Batch Size: 2048
|
| 18 |
-
- Warmup ratio: 0.0125
|
| 19 |
-
- Warmup steps: 125000
|
| 20 |
-
- Goal steps: 10000000
|
| 21 |
-
- Total steps: 8300000
|
| 22 |
-
- Total training time (aprox): 58.2 days
|
| 23 |
|
| 24 |
-
##
|
| 25 |
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
- OpenCENIA
|
| 8 |
datasets:
|
| 9 |
- large_spanish_corpus
|
| 10 |
+
pipeline_tag: fill-mask
|
| 11 |
+
widget:
|
| 12 |
+
- text: Quito es la capital de [MASK].
|
| 13 |
---
|
| 14 |
|
| 15 |
+
# ALBETO (tiny-sized model)
|
| 16 |
|
| 17 |
+
ALBETO model pre-trained on Spanish language. It was introduced in the paper [ALBETO and DistilBETO: Lightweight Spanish Language Models](https://arxiv.org/abs/2204.09145).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
## Model description
|
| 20 |
|
| 21 |
+
ALBETO is an [ALBERT](https://github.com/google-research/albert) model (transformer encoder) pre-trained exclusively on a [Spanish corpus](https://github.com/josecannete/spanish-corpora) of about 3B words, the same data used for BETO. ALBERT factorizes the embedding layer and shares parameters across layers, so ALBETO needs far fewer parameters than BERT-style models of similar depth.
|
| 22 |
+
|
| 23 |
+
| Parameters | Layers | Hidden size | Embedding size | Vocabulary |
|
| 24 |
+
|------------|--------|-------------|----------------|------------|
|
| 25 |
+
| 5M | 4 | 312 | 128 | 31K (uncased) |
|
| 26 |
+
|
| 27 |
+
It was trained with LAMB for 8.3M steps (batch size 2,048, learning rate 1.25e-3) on a single TPU v3-8 (~58 days).
|
| 28 |
+
|
| 29 |
+
## Intended uses & limitations
|
| 30 |
+
|
| 31 |
+
You can use the raw model for masked language modeling. However, the model is mainly meant to be fine-tuned on a supervised dataset (e.g. text classification, token classification, question answering).
|
| 32 |
+
|
| 33 |
+
The model is uncased.
|
| 34 |
+
|
| 35 |
+
### How to use
|
| 36 |
+
|
| 37 |
+
Here is how to use this model in PyTorch:
|
| 38 |
+
|
| 39 |
+
```python
|
| 40 |
+
from transformers import PreTrainedTokenizerFast, AutoModel
|
| 41 |
+
|
| 42 |
+
tokenizer = PreTrainedTokenizerFast.from_pretrained('dccuchile/albert-tiny-spanish')
|
| 43 |
+
model = AutoModel.from_pretrained('dccuchile/albert-tiny-spanish')
|
| 44 |
+
|
| 45 |
+
inputs = tokenizer("Hola amigo, bienvenido a casa.", return_tensors="pt")
|
| 46 |
+
outputs = model(**inputs)
|
| 47 |
+
|
| 48 |
+
last_hidden_states = outputs.last_hidden_state
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
Load the tokenizer with `PreTrainedTokenizerFast`: `AutoTokenizer` fails on this model with transformers 5.x.
|
| 52 |
+
|
| 53 |
+
## Evaluation results
|
| 54 |
+
|
| 55 |
+
| POS | NER | MLDoc | PAWS-X | XNLI | MLQA | SQAC | TAR, XQuAD |
|
| 56 |
+
|-----|-----|-------|--------|------|------|------|------------|
|
| 57 |
+
| 97.04 | 75.11 | 95.82 | 80.20 | 73.43 | 51.84 / 28.28 | 59.28 / 39.16 | 66.43 / 45.71 |
|
| 58 |
+
|
| 59 |
+
POS/NER: F1. MLDoc/PAWS-X/XNLI: accuracy. QA: F1 / exact match. The [GitHub repository](https://github.com/dccuchile/lightweight-spanish-language-models) compares all models with BETO and links the fine-tuned checkpoints.
|
| 60 |
+
|
| 61 |
+
### Citation (BibTeX)
|
| 62 |
+
|
| 63 |
+
```bibtex
|
| 64 |
+
@inproceedings{canete-etal-2022-albeto,
|
| 65 |
+
title = "{ALBETO} and {D}istil{BETO}: Lightweight {S}panish Language Models",
|
| 66 |
+
author = "Ca{\~n}ete, Jos{\'e} and Donoso, Sebasti{\'a}n and Bravo-Marquez, Felipe and Carvallo, Andr{\'e}s and Araujo, Vladimir",
|
| 67 |
+
booktitle = "Proceedings of the Thirteenth Language Resources and Evaluation Conference",
|
| 68 |
+
year = "2022",
|
| 69 |
+
address = "Marseille, France",
|
| 70 |
+
publisher = "European Language Resources Association",
|
| 71 |
+
url = "https://aclanthology.org/2022.lrec-1.457/",
|
| 72 |
+
pages = "4291--4298"
|
| 73 |
+
}
|
| 74 |
+
```
|