Carvalho_pt-gl-1.3B
Carvalho_pt-gl-1.3B is a 1.3B-parameter transformer-based causal language model for Galician and European Portuguese. It is the result of a continual pretraining of a Cerebras-GPT-1.3B adapted to catalan, spanish and english previously by the AINA Project.
This model is part of the Carvalho familily, a family of LLMs specialized in Portuguese and Galician which can be found here.
How to use
import torch
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
token_HF=""#Obter na páxina de HuggingFace
input_text = "Hoxe fai un bo día. O sol "
model_id = "Nos-PT/Carvalho_pt-gl-1.3B"
tokenizer = AutoTokenizer.from_pretrained(model_id, use_auth_token=token_HF)
model = AutoModelForCausalLM.from_pretrained(model_id, use_auth_token=token_HF)
generator = pipeline(
"text-generation",
model=model,
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
Tools
It was trained using HuggingFace Transformers and Pytorch, using the Causal Modeling Language script. We also use DeepSpeed to deal with the huge size of the model.
Training data
The training corpus consists of 5B tokens of texts in Galician and European Portuguese, whose main sources are CorpusNÓS for Galician and Arquivo.pt for Portuguese.
Training hyperparameters
- seed: 42
- train_batch_size: 4
- eval_batch_size: 4
- gradient_acummulation: 8
- optimizer: AdamW
- betas: (0.9,0.999)
- epsilon: 1e-08
- weight_decay_rate: 0.1
- scheduler: "Linear"
- learning_rate: 5e-05
- num_epochs: 1.0
Framework
The training was conducted on the Galician Supercomputing Center (CESGA), using various nodes with 2 GPUs NVIDIA A100 40G.
Evaluation
The evaluation was carried out using the Calame dataset, in its Portuguese and Galician versions, and in the GLUE benchmark. In the latter case, the evaluated models were fine-tuned to rotate the tasks.
Models | CALAME-GL | CALAME-PT |
---|---|---|
Carvalho_pt-gl 1.3B | 0.397 | 0.455 |
GlorIA 1.3B | 0.219 | 0.488 |
Gervasio-PTPT 7B | 0.265 | 0.434 |
mGPT 1.3B | 0.264 | 0.425 |
Bloom-1b1 | 0.262 | 0.456 |
Cerebras-GPT 1.3B | 0.177 | 0.167 |
Models | RTE | MRPC | STS-B | WNLI |
---|---|---|---|---|
Acc | F1 | Pearson | Acc | |
Encoder-only | ||||
AiBERTa Base | 55.3 | 83.2 | 80.2 | 58.9 |
Albertina-PTPT 100m | 55.4 | 87.6 | 84.5 | 65.1 |
Albertina-PTPT 900m | 80.6 | 89.8 | 88.7 | 65.1 |
Albertina-PTPT 1.5B | 82.9 | 90.3 | 88.7 | 59.6 |
Decoder-only | ||||
Carvalho_pt-gl 1.3B | 68.0 | 86.0 | 82.6 | 65.1 |
Gloria 1.3B | 63.8 | 85.2 | 82.0 | 65.1 |
Gervásio 7B | 83.2 | 90.5 | 87.9 | 64.4 |
Bloom 1.1B | 71.5 | 87.7 | 85.7 | 63.6 |
mGPT 1.3B | 58.9 | 85.5 | 78.3 | 65.1 |
Additional information
Contact
For further information, please send an email to
License
MIT License
Copyright (c) 2024
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Funding
This model was development within the Nós Project, funded by the Ministerio para la Transformación Digital y de la Función Pública - Funded by EU – NextGenerationEU within the framework of the project ILENIA with reference 2022/TL22/00215336.
Cite this model
@inproceedings{gamallo2024galician,
title={A Galician-Portuguese Generative Model},
author={Gamallo, Pablo and Rodr{\'\i}guez, Pablo and Santos, Daniel and Sotelo, Susana and Miquelina, Nuno and Paniagua, Silvia and Schmidt, Daniela and de-Dios-Flores, Iria and Quaresma, Paulo and Bardanca, Daniel and others},
booktitle={EPIA Conference on Artificial Intelligence},
pages={292--304},
year={2024},
organization={Springer}
}
- Downloads last month
- 33