CoolFace
Modelpublic

projecte-aina/FLOR-760M

sourceHugging Faceupdated 2y agoView on Hugging Face
1likes821downloads
Model Card

FLOR-760M

<strong><span style="color:darkred">⚠️NOTICE⚠️: This model has been deprecated and is no longer actively maintained or supported. To access the latest models with enhanced features, better performance, and ongoing support, please visit <a style="color:darkred" href="https://huggingface.co/BSC-LT">https://huggingface.co/BSC-LT</a></span></strong>

Table of Contents

<details> <summary>Click to expand</summary>

</details>

Model description

FLOR-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, which involves modifying the model's vocabulary and embedding layer and continuously pre-training the model with 26B tokens in our target languages.

For more details, take a look at this blogpost about the project.

Intended uses and limitations

The FLOR-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  = "projecte-aina/FLOR-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 FLOR-760M 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.1B parameters to 760M. 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.1B, 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. It consists of 26B tokens of several corpora gathered from web crawlings and public domain data.

DatasetLanguageWords (per-epoch)Epochs
Wikipediaen2169.97M1.428144485
C4_eses53709.80M0.1049686196
Biomedicales455.03M0.7140722425
Legales995.70M0.7140722425
Wikipediaes693.60M1.428144485
Gutenberges53.18M0.7140722425
C4_caca2826.00M2.142216727
Biomedicalca11.80M1.428144485
RacoCatalà Noticiasca17.16M2.142216727
RacoCatalà Forumsca333.73M2.142216727
CaWaCca57.79M2.142216727
Wikipediaca228.01M3.570361212
Vilawebca50.34M2.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:

LanguagePercentage
English (EN)16.84%
Spanish (ES)41.38%
Catalan (CA)41.79%

Training hyperparameters

  • —seed: 1
  • —distributed_type: WSE-2
  • —num_devices: 1
  • —trainbatchsize: 60
  • —evalbatchsize: 60
  • —optimizer: AdamW
  • —betas: (0.9,0.95)
  • —epsilon: 1e-08
  • —weightdecayrate: 0.1
  • —learning_rate:
  • —scheduler: "Linear" initiallearningrate: 0.0 endlearningrate: 4.1e-5 steps: 3050
  • —scheduler: "CosineDecay" initiallearningrate: 4.1e-5 endlearningrate: 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 using the cs-1.9.1 release of their software.

Evaluation

FLOR-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.

The following is a list of evaluation areas and their respective datasets:

Reading Comprehension and Questions Answering

ModelBelebele-caBelebele-esBelebele-enXQuAD-caXQuAD-esXQuAD-enCatalanQACoQCat
Random25.0025.0025.00-----
mGPT-1.3B26.6425.8228.070.330.670.170.650.78
GPT-Neo-1.3B39.5537.5042.8319.7529.7751.5322.3423.57
Pythia-1.4B38.3236.8944.2626.1934.1352.9827.4725.38
OPT-1.3B35.8637.0945.4923.5331.8552.9526.5820.18
Falcon-rw-1.3B34.8435.6650.615.9319.2558.606.9115.61
Cerebras-GPT-1.3B32.7931.7635.048.5619.9836.0010.8714.12
BLOOM-1.1B39.3438.3241.1936.8136.9844.1044.6534.57
FLOR-760M41.1939.5536.6841.1041.1140.2051.0141.34

Natural Language Inference and Paraphrase Identification

ModelXNLI-caXNLI-esXNLI-enTECA-caPAWS-X-caPAWS-X-esPAWS-X-enParafraseja
Random33.3333.3333.3333.3350.0050.0050.0050.00
mGPT-1.3B40.0643.8145.6737.0351.0052.3056.1551.32
GPT-Neo-1.3B41.4445.5749.9235.3854.6553.4054.6051.70
Pythia-1.4B42.4645.6151.0037.4654.1552.5057.7055.23
OPT-1.3B40.0844.5352.4836.1454.1052.5555.9053.23
Falcon-rw-1.3B34.5335.8545.7334.9654.2554.0553.6550.60
Cerebras-GPT-1.3B36.8338.8847.2535.6252.4052.2055.9552.05
BLOOM-1.1B47.1946.3949.4441.3855.0554.0554.7555.65
FLOR-760M46.9346.0346.1142.1452.3552.5054.8556.55

Commonsense Reasoning and Translation

ModelXStoryCloze-esXStoryCloze-enCOPA-caCOPA-enFloRes (ca->es)FloRes (es->ca)FloRes (ca->en)FloRes (en->ca)FloRes (es->en)FloRes (en->es)
Random50.0050.0050.0050.00------
mGPT-1.3B55.3360.0952.2063.403.252.969.253.7917.7515.34
GPT-Neo-1.3B51.4266.5853.4074.803.273.8017.775.4917.7012.04
Pythia-1.4B54.1468.3752.2078.609.685.7424.0311.1021.5015.04
OPT-1.3B53.9469.9552.6076.203.143.5215.392.0016.336.53
Falcon-rw-1.3B51.0971.3452.4079.603.033.598.893.0114.176.50
Cerebras-GPT-1.3B49.1160.6251.4066.802.421.812.690.823.361.77
BLOOM-1.1B57.9162.4862.8066.4021.6215.2831.1621.2820.9216.84
FLOR-760M61.4261.4265.4064.2022.6215.7732.2626.0420.9118.08

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

Funding

This work was funded by Departament de la Vicepresidència i de Polítiques Digitals i Territori de la Generalitat de Catalunya within the framework of Projecte 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>