Transformers documentation

BARThez

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

BARThez

Overview

BARThez モデルは、Moussa Kamal Eddine、Antoine J.-P によって BARThez: a Skilled Pretrained French Sequence-to-Sequence Model で提案されました。ティクシエ、ミカリス・ヴァジルジャンニス、10月23日、 2020年。

論文の要約:

帰納的転移学習は、自己教師あり学習によって可能になり、自然言語処理全体を実行します。 (NLP) 分野は、BERT や BART などのモデルにより、無数の自然言語に新たな最先端技術を確立し、嵐を巻き起こしています。 タスクを理解すること。いくつかの注目すべき例外はありますが、利用可能なモデルと研究のほとんどは、 英語を対象に実施されました。この作品では、フランス語用の最初の BART モデルである BARTez を紹介します。 (我々の知る限りに)。 BARThez は、過去の研究から得た非常に大規模な単一言語フランス語コーパスで事前トレーニングされました BART の摂動スキームに合わせて調整しました。既存の BERT ベースのフランス語モデルとは異なり、 CamemBERT と FlauBERT、BARThez は、エンコーダだけでなく、 そのデコーダは事前トレーニングされています。 FLUE ベンチマークからの識別タスクに加えて、BARThez を新しい評価に基づいて評価します。 この論文とともにリリースする要約データセット、OrangeSum。また、すでに行われている事前トレーニングも継続します。 BARTHez のコーパス上で多言語 BART を事前訓練し、結果として得られるモデル (mBARTHez と呼ぶ) が次のことを示します。 バニラの BARThez を大幅に強化し、CamemBERT や FlauBERT と同等かそれを上回ります。

このモデルは moussakam によって寄稿されました。著者のコードはここにあります。

BARThez の実装は、トークン化を除いて BART と同じです。詳細については、BART ドキュメント を参照してください。 構成クラスとそのパラメータ。 BARThez 固有のトークナイザーについては以下に記載されています。

Resources

  • BARThez は、BART と同様の方法でシーケンス間のタスクを微調整できます。以下を確認してください。 examples/pytorch/summarization/

BarthezTokenizer

class transformers.BarthezTokenizer

< >

( bos_token = '<s>' eos_token = '</s>' sep_token = '</s>' cls_token = '<s>' unk_token = '<unk>' pad_token = '<pad>' mask_token = '<mask>' vocab_file = None vocab = None add_prefix_space = True **kwargs )

Parameters

  • bos_token (str, optional, defaults to "<s>") — The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.

    When building a sequence using special tokens, this is not the token that is used for the beginning of sequence. The token used is the cls_token.

  • eos_token (str, optional, defaults to "</s>") — The end of sequence token.

    When building a sequence using special tokens, this is not the token that is used for the end of sequence. The token used is the sep_token.

  • sep_token (str, optional, defaults to "</s>") — The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for sequence classification or for a text and a question for question answering. It is also used as the last token of a sequence built with special tokens.
  • cls_token (str, optional, defaults to "<s>") — The classifier token which is used when doing sequence classification (classification of the whole sequence instead of per-token classification). It is the first token of the sequence when built with special tokens.
  • unk_token (str, optional, defaults to "<unk>") — The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this token instead.
  • pad_token (str, optional, defaults to "<pad>") — The token used for padding, for example when batching sequences of different lengths.
  • mask_token (str, optional, defaults to "<mask>") — The token used for masking values. This is the token used when training this model with masked language modeling. This is the token which the model will try to predict.
  • vocab_file (str, optional) — SentencePiece file (generally has a .spm extension) that contains the vocabulary necessary to instantiate a tokenizer.
  • vocab (dict, optional) — Custom vocabulary dictionary. If not provided, vocabulary is loaded from vocab_file.
  • add_prefix_space (bool, optional, defaults to True) — Whether or not to add an initial space to the input. This allows to treat the leading word just as any other word.

Adapted from CamembertTokenizer and BartTokenizer. Construct a “fast” BARThez tokenizer. Based on SentencePiece.

This tokenizer inherits from PreTrainedTokenizerFast which contains most of the main methods. Users should refer to this superclass for more information regarding those methods.

BarthezTokenizerFast

class transformers.BarthezTokenizer

< >

( bos_token = '<s>' eos_token = '</s>' sep_token = '</s>' cls_token = '<s>' unk_token = '<unk>' pad_token = '<pad>' mask_token = '<mask>' vocab_file = None vocab = None add_prefix_space = True **kwargs )

Parameters

  • bos_token (str, optional, defaults to "<s>") — The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.

    When building a sequence using special tokens, this is not the token that is used for the beginning of sequence. The token used is the cls_token.

  • eos_token (str, optional, defaults to "</s>") — The end of sequence token.

    When building a sequence using special tokens, this is not the token that is used for the end of sequence. The token used is the sep_token.

  • sep_token (str, optional, defaults to "</s>") — The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for sequence classification or for a text and a question for question answering. It is also used as the last token of a sequence built with special tokens.
  • cls_token (str, optional, defaults to "<s>") — The classifier token which is used when doing sequence classification (classification of the whole sequence instead of per-token classification). It is the first token of the sequence when built with special tokens.
  • unk_token (str, optional, defaults to "<unk>") — The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this token instead.
  • pad_token (str, optional, defaults to "<pad>") — The token used for padding, for example when batching sequences of different lengths.
  • mask_token (str, optional, defaults to "<mask>") — The token used for masking values. This is the token used when training this model with masked language modeling. This is the token which the model will try to predict.
  • vocab_file (str, optional) — SentencePiece file (generally has a .spm extension) that contains the vocabulary necessary to instantiate a tokenizer.
  • vocab (dict, optional) — Custom vocabulary dictionary. If not provided, vocabulary is loaded from vocab_file.
  • add_prefix_space (bool, optional, defaults to True) — Whether or not to add an initial space to the input. This allows to treat the leading word just as any other word.

Adapted from CamembertTokenizer and BartTokenizer. Construct a “fast” BARThez tokenizer. Based on SentencePiece.

This tokenizer inherits from PreTrainedTokenizerFast which contains most of the main methods. Users should refer to this superclass for more information regarding those methods.

Update on GitHub