0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ModernBERT-base-portugueseは「Eu quis amar mas [MASK] medo」の[MASK]に何を埋めてくるのか

0
Posted at

Elias Jacob de Menezes NetoがModernBERT-base-portugueseを公開したので、ちょっと使ってみることにした。Google Colaboratoryだと、こんな感じ。

!pip install transformers
from transformers import pipeline
nlp=pipeline("fill-mask","eliasjacob/ModernBERT-base-portuguese")
print(nlp("Eu quis amar mas [MASK] medo"))

「Eu quis amar mas [MASK] medo」の[MASK]に何を埋めてくるのか試したところ、私(安岡孝一)の手元では以下の結果が得られた。

[{'score': 0.7114824056625366, 'token': 38885, 'token_str': ' tive', 'sequence': 'Eu quis amar mas tive medo'}, {'score': 0.10795343667268753, 'token': 21231, 'token_str': ' tenho', 'sequence': 'Eu quis amar mas tenho medo'}, {'score': 0.09183146804571152, 'token': 1337, 'token_str': ' tinha', 'sequence': 'Eu quis amar mas tinha medo'}, {'score': 0.024914799258112907, 'token': 45374, 'token_str': ' senti', 'sequence': 'Eu quis amar mas senti medo'}, {'score': 0.013590972870588303, 'token': 306, 'token_str': ' com', 'sequence': 'Eu quis amar mas com medo'}]

「 tive」が71%でダントツなあたり、ModernBERT-base-portugueseは、この文を知っているのだろう。ただし、「 tive」のアタマには空白が付いている。2024年12月26日の記事にも書いたが、ModernBERTのトークナイザは、この点でBERTよりGPT風だったりする。まあ、それでも品詞付与や係り受け解析に使う方法がわかってきたので、ポルトガル語も少し頑張ってみようかな。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?