4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

自然言語処理モデルBERTの事前学習手法:MLM

Posted at

多くの自然言語処理の場合には、学習済みのBERTモデルを使用しますが、特定のデータに対して、適切な学習済みモデルがないか、または精度があまり良くない時に、手動で事前学習を行うこともあります。

事前学習の手法はいくつか存在しますが、一番使いやすいMLMを紹介したいと思います。

MLM(Masked Language Model)は、BERTに元々ついてる手法の一つです。
中身はすごいシンプルで、一つ文書中のある程度の単語をランダムに隠し(Mask)、
その隠された単語が何なのかを予測することで、モデルを学習させます。

単純なテキスト分類タスクであれば、下のhuggingfaceが提供したコードをそのまま実行できます。

興味がある方お試してみてください。
https://github.com/huggingface/transformers/blob/main/examples/pytorch/language-modeling/run_mlm.py

4
5
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
4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?