Model: Nos-PT/Carvalho_pt-gl-1.3B Source: Original Platform
language, tags, license, inference, widget
| language | tags | license | inference | widget | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
apache-2.0 |
|
|
Traduce ao galego esta frase en inglés:
Inglés: "You are working with my mother on a very interesting project."
Galego: "Estás a traballar coa miña nai nun proxecto moi interesante"
----
Traduce ao galego esta frase en inglés:
Inglés: "You have to fix the computer now"
Galego:
example_title: Translation-gl
-
text: >- Traduz para o português esta frase en inglês:
Inglês: "my sister is studying Biology at the university."
Português: "a minha irmã está a estudar biologia na universidade."
Traduz para o português esta frase en inglês:
Inglês: "You are working with my mother on a very interesting project."
Português: "Estás a trabalhar com a minha mãe em um projeto muito interessante"
Traduz para o português esta frase en inglês:
Inglês: "You have to fix the computer now"
Português: example_title: Translation-pt
-
text: |- Responde á seguinte pregunta. Pregunta: "Cal é a capital de Noruega?" Resposta: "A capital de Noruega é Oslo."
Responde á seguinte pregunta. Pregunta: "Cal é a moeda de Portugal" Resposta: "A moeda de Portugal é o euro."
Responde á seguinte pregunta. Pregunta: "Cal é a capital de Suecia?" Resposta: example_title: QA-GL
-
text: |- Responda a seguinte questão. Pergunta: "Qual é a capital da Noruega?" Resposta: "A capital da Noruega é Oslo."
Responda a seguinte questão. Pergunta: "Qual é a moeda de Portugal" Resposta: “A moeda de Portugal é o euro”.
Responda a seguinte questão. Pergunta: "Qual é a capital da Suécia?" Responder: example_title: QA-PT
-
text: |- Cualifica como Positivo ou Negativo o sentimento da seguinte frase: Texto: "Estou moi feliz" Polaridade: Positivo
Cualifica como Positivo ou Negativo o sentimento da seguinte frase: Texto: "Non me gusta beber cervexa" Polaridade: Negativo
Cualifica como Positivo ou Negativo o sentimento da seguinte frase: Texto: "O meu pai detesta o seu traballo" Polaridade: Negativo
Cualifica como Positivo ou Negativo o sentimento da seguinte frase: Texto: "Uxía desfruta xogando ao fútbol" Polaridade: Positivo
Cualifica como Positivo ou Negativo o sentimento da seguinte frase: Texto: "O neno non está contento coas notas" Polaridade: example_title: Sentiment-GL
-
text: |- Classifique como Positivo ou Negativo o sentimento da seguinte frase: Texto: "Estou muito feliz" Polaridade: Positiva
Classifique como Positivo ou Negativo o sentimento da seguinte frase: Texto: "Não gosto de beber cerveja" Polaridade: Negativa
Classifique como Positivo ou Negativo o sentimento da seguinte frase: Texto: "Meu pai odeia seu trabalho" Polaridade: Negativa
Classifique como Positivo ou Negativo o sentimento da seguinte frase: Texto: "Uxía gosta de jogar futebol" Polaridade: Positiva
Classifique como Positivo ou Negativo o sentimento da seguinte frase: Texto: “O menino não está feliz com as notas” Polaridade: example_title: Sentiment-PT
-
text: |- Extrae as entidades nomeadas do seguinte texto: Texto: "Chámome Wolfgang e vivo en Berlin" Entidades: Wolfgang:PER, Berlin:LOC
Extrae as entidades nomeadas do seguinte texto: Texto: "María e Miguel non teñen ningún problema" Entidades: María:PER, Miguel:PER
Extrae as entidades nomeadas do seguinte texto: Texto: "O mellor de Barcelona é o bar do meu amigo Pablo" Entidades: Pablo:PER, Barcelona:LOC
Extrae as entidades nomeadas do seguinte texto: Texto: "María axudou a Carlos na empresa" Entidades: example_title: NER-GL
-
text: |- Extraia as entidades nomeadas do seguinte texto: Texto: "Meu nome é Wolfgang e moro em Berlim" Entidades: Wolfgang:PER, Berlim:LOC
Extraia as entidades nomeadas do seguinte texto: Texto: "Maria e Miguel não têm problemas" Entidades: Maria:PER, Miguel:PER
Extraia as entidades nomeadas do seguinte texto: Texto: "A melhor coisa de Barcelona é o bar do meu amigo Pablo" Entidades: Pablo:PER, Barcelona:LOC
Extraia as entidades nomeadas do seguinte texto: Texto: "Maria ajudou Carlos na empresa" Entidades: example_title: NER-PT
-
text: A receita tradicional das filloas é example_title: Receita-GL
-
text: A receita tradicional de panquecas é example_title: Receita-PT
-
text: O neno vivía preto example_title: O neno-GL
-
text: O menino morava perto example_title: O menino-PT datasets:
-
proxectonos/corpusnos
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
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}
}