|
--- |
|
language: |
|
- en |
|
- es |
|
- ca |
|
licence: |
|
- apache-2.0 |
|
tags: |
|
- cabloom |
|
- bloom |
|
- spanish |
|
- catalan |
|
pipeline_tag: text-generation |
|
widget: |
|
- text: |- |
|
Respon a la pregunta següent. |
|
Pregunta: "Quina és la capital de Suècia?" |
|
Resposta: "La capital de Suècia és Estocolm." |
|
---- |
|
Respon a la pregunta següent. |
|
Pregunta: "Quina beguda es consumeix als matins per despertar-se?" |
|
Resposta: "La majoria de gent consumeix cafè per despertar-se." |
|
---- |
|
Respon a la pregunta següent. |
|
Pregunta: "Explica com funciona un motor de combustió" |
|
Resposta: |
|
example_title: Pregunta-Resposta |
|
- text: |- |
|
Extrae las entidades nombradas del siguiente texto: |
|
Texto: "Me llamo Wolfgang y vivo en Berlin" |
|
Entidades: Wolfgang:PER, Berlin:LOC |
|
---- |
|
Extrae las entidades nombradas del siguiente texto: |
|
Texto: "Hoy voy a visitar el parc güell tras salir del barcelona supercomputing center" |
|
Entidades: parc güell:LOC, barcelona supercomputing center:LOC |
|
---- |
|
Extrae las entidades nombradas del siguiente texto: |
|
Texto: "Maria y Miguel no tienen ningún problema contigo" |
|
Entidades: Maria:PER, Miguel:PER |
|
---- |
|
Extrae las entidades nombradas del siguiente texto: |
|
Texto: "Damián se cortó el pelo" |
|
Entidades: Damián:PER |
|
---- |
|
Extrae las entidades nombradas del siguiente texto: |
|
Texto: "Lo mejor de Barcelona és el bar de mi amigo Pablo" |
|
Entidades: Pablo:PER, Barcelona:LOC |
|
---- |
|
Extrae las entidades nombradas del siguiente texto: |
|
Texto: "Carlos comparte piso con Marc" |
|
Entidades: |
|
example_title: Entidades-Nombradas |
|
--- |
|
|
|
# CaBLOOM-760M |
|
|
|
## Table of Contents |
|
<details> |
|
<summary>Click to expand</summary> |
|
|
|
- [Model description](#model-description) |
|
- [Intended uses and limitations](#intended-uses-and-limitations) |
|
- [How to use](#how-to-use) |
|
- [Limitations and bias](#limitations-and-bias) |
|
- [Training](#training) |
|
- [Evaluation](#evaluation) |
|
- [Additional information](#additional-information) |
|
|
|
</details> |
|
|
|
## Model description |
|
|
|
**CaBLOOM-760M** is a 760M-parameter transformer-based causal language model for Catalan, Spanish, and English. |
|
It is the result of a language adaptation technique performed on [BLOOM-1.1B](https://huggingface.co/bigscience/bloom-1b1), |
|
which involves modifying the model's vocabulary and embedding layer and continuously pre-training the model with 26B tokens in our target languages. |
|
|
|
This model has been developed as part of a scientific research submitted to [LREC-COLING 2024](https://lrec-coling-2024.org/), and is currently undergoing a peer review process. |
|
|
|
## Intended uses and limitations |
|
|
|
The **CaBLOOM-760M** model is ready-to-use only for causal language modeling. |
|
It can perform text-generation tasks and be fine-tuned for specific scenarios. |
|
|
|
## How to use |
|
```python |
|
import torch |
|
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM |
|
|
|
input_text = "Sovint em trobo pensant en tot allò que" |
|
|
|
model_id = "BSC-LT/CaBLOOM-760M" |
|
tokenizer = AutoTokenizer.from_pretrained(model_id) |
|
generator = pipeline( |
|
"text-generation", |
|
model=model_id, |
|
tokenizer=tokenizer, |
|
torch_dtype=torch.bfloat16, |
|
trust_remote_code=True, |
|
device_map="auto", |
|
) |
|
generation = generator( |
|
input_text, |
|
do_sample=True, |
|
top_k=10, |
|
eos_token_id=tokenizer.eos_token_id, |
|
) |
|
|
|
print(f"Result: {generation[0]['generated_text']}") |
|
``` |
|
|
|
## Limitations and bias |
|
At the time of submission, no measures have been taken to estimate the bias and toxicity embedded in the model. |
|
However, we are well aware that our models may be biased since the corpora have been collected using crawling techniques |
|
on multiple web sources. We intend to conduct research in these areas in the future, and if completed, this model card will be updated. |
|
|
|
|
|
## Training |
|
|
|
### Language adaptation and training |
|
|
|
The language adaptation technique used to create CaBLOOM-1.3B requires the vocabulary of the source model |
|
to be adapted before continuing its pre-training with data in the target languages. Specifically, we proceeded as follows: |
|
1) We trained our own BPE tokenizer for Catalan, Spanish, and English, and replaced the original BLOOM tokenizer and vocabulary with it. This procedure implied a downsizing of the original BLOOM's embedding layer and, therefore, a model compression from 1.7B parameters to 1.3B. |
|
2) The embeddings corresponding to tokens that are present in both the original and the target vocabulary (matching tokens) were used for initialization. |
|
3) The embeddings from tokens not present in BLOOM's original vocabulary were initialized as the average of all embeddings. |
|
4) The model was initialized with the weights from BOOM-1.7B, and with our adapted tokenizer (step 1) and embeddings (steps 2-3). |
|
5) The model was then trained on a corpus that contains a mixture of Catalan, Spanish and English data. |
|
|
|
### Training data |
|
|
|
The training corpus is the same that was used to train [Ǎguila-7B](https://huggingface.co/projecte-aina/aguila-7b). |
|
It consists of 26B tokens of several corpora gathered from web crawlings and public domain data. |
|
|
|
| Dataset | Language | Words (per-epoch) | Epochs | |
|
|---------------------|----------|--------------------|--------------| |
|
| Wikipedia | en | 2169.97M | 1.428144485 | |
|
| C4_es | es | 53709.80M | 0.1049686196 | |
|
| Biomedical | es | 455.03M | 0.7140722425 | |
|
| Legal | es | 995.70M | 0.7140722425 | |
|
| Wikipedia | es | 693.60M | 1.428144485 | |
|
| Gutenberg | es | 53.18M | 0.7140722425 | |
|
| C4_ca | ca | 2826.00M | 2.142216727 | |
|
| Biomedical | ca | 11.80M | 1.428144485 | |
|
| RacoCatalà Noticias | ca | 17.16M | 2.142216727 | |
|
| RacoCatalà Forums | ca | 333.73M | 2.142216727 | |
|
| CaWaC | ca | 57.79M | 2.142216727 | |
|
| Wikipedia | ca | 228.01M | 3.570361212 | |
|
| Vilaweb | ca | 50.34M | 2.142216727 | |
|
|
|
### Languages |
|
|
|
The training data has the same amount of Catalan and Spanish texts, and a smaller amount of English data. |
|
The table below shows the final language distribution: |
|
|
|
|Language|Percentage| |
|
|--------|----------| |
|
| English (EN) | 16.84% | |
|
| Spanish (ES) | 41.38% | |
|
| Catalan (CA) | 41.79% | |
|
|
|
### Training hyperparameters |
|
- seed: 1 |
|
- distributed_type: [WSE-2](https://www.cerebras.net/product-chip/) |
|
- num_devices: 1 |
|
- train_batch_size: 60 |
|
- eval_batch_size: 60 |
|
- optimizer: AdamW |
|
- betas: (0.9,0.95) |
|
- epsilon: 1e-08 |
|
- weight_decay_rate: 0.1 |
|
- learning_rate: |
|
- scheduler: "Linear" |
|
initial_learning_rate: 0.0 |
|
end_learning_rate: 4.1e-5 |
|
steps: 3050 |
|
- scheduler: "CosineDecay" |
|
initial_learning_rate: 4.1e-5 |
|
end_learning_rate: 3.4e-6 |
|
steps: 209133 |
|
- scheduler: "Constant" |
|
learning_rate: 2.2e-6 |
|
- num_epochs: 1.0 |
|
|
|
### Framework versions |
|
The training was conducted in a Cerebras' [CS-2 system](https://www.cerebras.net/product-system/) |
|
using the [cs-1.9.1](https://github.com/Cerebras/modelzoo/releases/tag/Release_1.9.1) release of their software. |
|
|
|
|
|
## Evaluation |
|
CaBLOOM-760M has been evaluated on 5-shot, using EleutherAI's Evaluation Harness implementation, on several datasets in Catalan, Spanish and English, with particular emphasis on Catalan datasets. |
|
|
|
The tasks were chosen to cover several evaluation areas in order to provide a comprehensive overview of the model's capabilities. The baselines used to compare our results are multilingual and English open-source 1.3B models: mGPT-1.3B, GPT-Neo-1.3B, Pythia-1.4B, OPT-1.3B, Falcon-rw-1.3B, and Cerebras-GPT-1.3B. |
|
|
|
Our implementation of EleutherAI's *LM Evaluation Harness* can be found [here](https://github.com/langtech-bsc/lm-evaluation-harness/tree/cabloom-eval). |
|
|
|
The following is a list of evaluation areas and their respective datasets: |
|
- Reading Comprehension: [Belebele](https://huggingface.co/datasets/facebook/belebele) |
|
- Question Answering: [XQuAD](https://huggingface.co/datasets/xquad), [CatalanQA](https://huggingface.co/datasets/projecte-aina/catalanqa), [CoQCat](https://huggingface.co/datasets/projecte-aina/CoQCat) |
|
- Natural Language Inference: [XNLI](https://huggingface.co/datasets/xnli) and its translation to Catalan ([XNLI-ca](https://huggingface.co/datasets/projecte-aina/xnli-ca)), [TE-ca](https://huggingface.co/datasets/projecte-aina/teca) |
|
- Paraphrase Identification: [PAWS-X](https://huggingface.co/datasets/paws-x) and its translation to Catalan ([PAWS-ca](https://huggingface.co/datasets/projecte-aina/PAWS-ca)), [Parafraseja](https://huggingface.co/datasets/projecte-aina/Parafraseja) |
|
- Commonsense Reasoning: [COPA](https://people.ict.usc.edu/~gordon/copa.html) and its translation to Catalan ([COPA-ca](https://huggingface.co/datasets/projecte-aina/COPA-ca)) |
|
- Translation: [FLoRes](https://huggingface.co/datasets/flores) |
|
|
|
|
|
![image/png](https://cdn-uploads.huggingface.co/production/uploads/635ba692dc371b8f91005172/o595pF7dw-iTuR1_x4MVy.png) |
|
|
|
|
|
![image/png](https://cdn-uploads.huggingface.co/production/uploads/635ba692dc371b8f91005172/DhrkZG8Xqob7Ml4n6zQcY.png) |
|
|
|
|
|
![image/png](https://cdn-uploads.huggingface.co/production/uploads/635ba692dc371b8f91005172/PxgzqXAelUoWY-23zXvPm.png){ width: 200px; } |
|
|
|
|
|
## Additional information |
|
|
|
### Author |
|
The Language Technologies Unit from Barcelona Supercomputing Center. |
|
|
|
### Contact |
|
For further information, please send an email to <langtech@bsc.es>. |
|
|
|
### Copyright |
|
Copyright(c) 2023 by Language Technologies Unit, Barcelona Supercomputing Center. |
|
|
|
### License |
|
[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0) |
|
|
|
### Funding |
|
This work was funded by [Departament de la Vicepresidència i de Polítiques Digitals i Territori de la Generalitat de Catalunya](https://politiquesdigitals.gencat.cat/ca/inici/index.html#googtrans(ca|en) within the framework of [Projecte AINA](https://politiquesdigitals.gencat.cat/ca/economia/catalonia-ai/aina). |
|
|
|
### Disclaimer |
|
|
|
<details> |
|
<summary>Click to expand</summary> |
|
|
|
The model published in this repository is intended for a generalist purpose and is available to third parties under a permissive Apache License, Version 2.0. |
|
|
|
Be aware that the model may have biases and/or any other undesirable distortions. |
|
|
|
When third parties deploy or provide systems and/or services to other parties using this model (or any system based on it) |
|
or become users of the model, they should note that it is their responsibility to mitigate the risks arising from its use and, |
|
in any event, to comply with applicable regulations, including regulations regarding the use of Artificial Intelligence. |
|
|
|
In no event shall the owner and creator of the model (Barcelona Supercomputing Center) |
|
be liable for any results arising from the use made by third parties. |
|
|
|
</details> |