Carballo-bloom-1.3B / README.md
pablo-rf's picture
Update README.md
c661549 verified
|
raw
history blame
3.84 kB
metadata
language:
  - gl
licence:
  - MIT
tags:
  - galician
  - FLOR
  - bloom
license: mit
pipeline_tag: text-generation

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

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