Edit model card

bert-squad-portuguese

This model aims to help reduce the need for models in Portuguese.

How to use:

from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline

model_name = "rhaymison/bert-squad-portuguese"

nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
QA_input = {
    'question': 'Onde Cristiano Ronaldo começou sua carreira ?',
    'context': 'Cristiano Ronaldo é jogador de futebol considerado por muitos um dos melhores de todos os tempos. Português, começou a carreira no Sporting e já atuou por Manchester United, Real Madrid, Juventus e Al-Nassr. Foi cinco vezes campeão da Liga dos Campeões da Europa. Também foi campeão da Eurocopa com Portugal no que é considerado o maior título já conquistado pela equipe portuguesa. Disputou cinco Copas do Mundo. Atualmente, é o atleta com mais gols marcados por seleções nacionais.'
}
res = nlp(QA_input)

If you need load model and tokenizer

model = AutoModelForQuestionAnswering.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)

This model is a fine-tuned version of neuralmind/bert-base-portuguese-cased. It achieves the following results on the evaluation set:

  • Loss: 1.0687

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 2e-05
  • train_batch_size: 16
  • eval_batch_size: 16
  • seed: 42
  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • lr_scheduler_type: linear
  • num_epochs: 2

GPU: T4

Training results

Training Loss Epoch Step Validation Loss
1.4612 0.19 1000 1.3505
1.2999 0.37 2000 1.2518
1.2234 0.56 3000 1.1492
1.1824 0.74 4000 1.1181
1.1169 0.93 5000 1.0850
0.8933 1.11 6000 1.0925
0.9004 1.3 7000 1.0849
0.8706 1.49 8000 1.0976
0.8617 1.67 9000 1.0779
0.8756 1.86 10000 1.0687

Framework versions

  • Transformers 4.38.2
  • Pytorch 2.2.1+cu121
  • Datasets 2.18.0
  • Tokenizers 0.15.2
Downloads last month
23
Safetensors
Model size
108M params
Tensor type
F32
·

Finetuned from