Carballo-bloom-1.3B / README.md
pablo-rf's picture
Update README.md
312bef8 verified
|
raw
history blame
5.11 kB
metadata
language:
  - gl
licence:
  - mit
tags:
  - galician
  - FLOR
  - bloom

FLOR-1.3B-GL

Table of Contents

Click to expand

Model description

FLOR-1.3B-GL is a 1.3B-parameter transformer-based causal language model for Galician. It is the result of continual pretraining of FLOR-1.3B with the galician corpus CorpusNos.

Intended uses and limitations

The FLOR-1.3B-GL 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

import torch
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM

input_text = "Hoxe fai un bo día. O sol brilla con forza no ceo, e "

model_id  = "proxectonos/FLOR-1.3B-GL"
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']}")

Training

Platform

HF Tranformers + run_clm.py

Language adaptation and training

The language adaptation technique used to train FLOR-1.3B-GL is based in the used to train FLOR-1.3B, which is explanied by their authors in this Medium Post. In summary, we proceeded as follows:

  1. We trained our own BPE tokenizer for galician and replaced the original FLOR-1.3B tokenizer and vocabulary with it.
  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 FLOR-1.3-GL's original vocabulary were initialized as the average of all embeddings.
  4. The model was initialized with the weights from FLOR-1.3B and with our adapted tokenizer (step 1) and embeddings (steps 2-3).
  5. The model was then trained on a galician corpus.

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.

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

Training hyperparameters

  • seed: 42
  • num_devices: 1
  • train_batch_size: 2
  • eval_batch_size: 2
  • gradient_acummulation: 4
  • optimizer: AdamW
  • betas: (0.9,0.999)
  • epsilon: 1e-08
  • weight_decay_rate: 0.1
  • scheduler: "Linear"
  • learning_rate: 5e-05
  • num_epochs: 1.2

Framework

CESGA, 1 node with 5GPUs A100

Evaluation

Additional information

Author

Contact

Copyright

License

MIT

Funding

This research was funded by “The Nós project: Galician in the society and economy of Artificial Intelligence”, resulting from the agreement 2021-CP080 between the Xunta de Galicia and the University of Santiago de Compostela, and thanks to the Investigo program, within the National Recovery, Transformation and Resilience Plan, within the framework of the European Recovery Fund (NextGenerationEU).