---
local: camembert
sections:
- local: overview
  title: Overview
- local: transformers.CamembertConfig
  title: CamembertConfig
- local: transformers.CamembertTokenizer
  title: CamembertTokenizer
- local: transformers.CamembertTokenizerFast
  title: CamembertTokenizerFast
- local: transformers.CamembertModel
  title: CamembertModel
- local: transformers.CamembertForCausalLM
  title: CamembertForCausalLM
- local: transformers.CamembertForMaskedLM
  title: CamembertForMaskedLM
- local: transformers.CamembertForSequenceClassification
  title: CamembertForSequenceClassification
- local: transformers.CamembertForMultipleChoice
  title: CamembertForMultipleChoice
- local: transformers.CamembertForTokenClassification
  title: CamembertForTokenClassification
- local: transformers.CamembertForQuestionAnswering
  title: CamembertForQuestionAnswering
- local: transformers.TFCamembertModel
  title: TFCamembertModel
- local: transformers.TFCamembertForMaskedLM
  title: TFCamembertForMaskedLM
- local: transformers.TFCamembertForSequenceClassification
  title: TFCamembertForSequenceClassification
- local: transformers.TFCamembertForMultipleChoice
  title: TFCamembertForMultipleChoice
- local: transformers.TFCamembertForTokenClassification
  title: TFCamembertForTokenClassification
- local: transformers.TFCamembertForQuestionAnswering
  title: TFCamembertForQuestionAnswering
title: CamemBERT
---
<script>
import Tip from "./Tip.svelte";
import Youtube from "./Youtube.svelte";
import Docstring from "./Docstring.svelte";
import CodeBlock from "./CodeBlock.svelte";
import CodeBlockFw from "./CodeBlockFw.svelte";
import DocNotebookDropdown from "./DocNotebookDropdown.svelte";
import IconCopyLink from "./IconCopyLink.svelte";
export let fw: "pt" | "tf"
</script>
<!--Copyright 2020 The HuggingFace Team. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
-->

<h1 id="camembert">CamemBERT</h1>

<h2 id="overview">Overview</h2>

The CamemBERT model was proposed in [CamemBERT: a Tasty French Language Model](https://arxiv.org/abs/1911.03894) by
Louis Martin, Benjamin Muller, Pedro Javier Ortiz Suárez, Yoann Dupont, Laurent Romary, Éric Villemonte de la
Clergerie, Djamé Seddah, and Benoît Sagot. It is based on Facebook's RoBERTa model released in 2019. It is a model
trained on 138GB of French text.

The abstract from the paper is the following:

*Pretrained language models are now ubiquitous in Natural Language Processing. Despite their success, most available
models have either been trained on English data or on the concatenation of data in multiple languages. This makes
practical use of such models --in all languages except English-- very limited. Aiming to address this issue for French,
we release CamemBERT, a French version of the Bi-directional Encoders for Transformers (BERT). We measure the
performance of CamemBERT compared to multilingual models in multiple downstream tasks, namely part-of-speech tagging,
dependency parsing, named-entity recognition, and natural language inference. CamemBERT improves the state of the art
for most of the tasks considered. We release the pretrained model for CamemBERT hoping to foster research and
downstream applications for French NLP.*

Tips:

- This implementation is the same as RoBERTa. Refer to the [documentation of RoBERTa](roberta) for usage examples
  as well as the information relative to the inputs and outputs.

This model was contributed by [camembert](https://huggingface.co/camembert). The original code can be found [here](https://camembert-model.fr/).

<h2 id="transformers.CamembertConfig">CamembertConfig</h2>

<div class="docstring">

<docstring><name>class transformers.CamembertConfig</name><anchor>transformers.CamembertConfig</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/configuration_camembert.py#L35</source><parameters>[{"name": "pad_token_id", "val": " = 1"}, {"name": "bos_token_id", "val": " = 0"}, {"name": "eos_token_id", "val": " = 2"}, {"name": "**kwargs", "val": ""}]</parameters></docstring>

This class overrides [RobertaConfig](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.RobertaConfig). Please check the superclass for the appropriate documentation alongside
usage examples.


</div>

<h2 id="transformers.CamembertTokenizer">CamembertTokenizer</h2>

<div class="docstring">

<docstring><name>class transformers.CamembertTokenizer</name><anchor>transformers.CamembertTokenizer</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/tokenization_camembert.py#L45</source><parameters>[{"name": "vocab_file", "val": ""}, {"name": "bos_token", "val": " = '<s>'"}, {"name": "eos_token", "val": " = '</s>'"}, {"name": "sep_token", "val": " = '</s>'"}, {"name": "cls_token", "val": " = '<s>'"}, {"name": "unk_token", "val": " = '<unk>'"}, {"name": "pad_token", "val": " = '<pad>'"}, {"name": "mask_token", "val": " = '<mask>'"}, {"name": "additional_special_tokens", "val": " = ['<s>NOTUSED', '</s>NOTUSED']"}, {"name": "sp_model_kwargs", "val": ": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"}, {"name": "**kwargs", "val": ""}]</parameters><paramsdesc>- **vocab_file** (`str`) --
[SentencePiece](https://github.com/google/sentencepiece) file (generally has a *.spm* extension) that
contains the vocabulary necessary to instantiate a tokenizer.
- **bos_token** (`str`, *optional*, defaults to `"<s>"`) --
  The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.

  <Tip>

  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`.

  </Tip>

- **eos_token** (`str`, *optional*, defaults to `"</s>"`) --
  The end of sequence token.

  <Tip>

  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`.

  </Tip>

- **sep_token** (`str`, *optional*, defaults to `"&amp;lt;/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 `"&amp;lt;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 `"&amp;lt;pad>"`) --
  The token used for padding, for example when batching sequences of different lengths.
- **mask_token** (`str`, *optional*, defaults to `"&amp;lt;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.
- **additional_special_tokens** (`List[str]`, *optional*, defaults to `["&amp;lt;s>NOTUSED", "</s>NOTUSED"]`) --
  Additional special tokens used by the tokenizer.
- **sp_model_kwargs** (`dict`, *optional*) --
  Will be passed to the `SentencePieceProcessor.__init__()` method. The [Python wrapper for
  SentencePiece](https://github.com/google/sentencepiece/tree/master/python) can be used, among other things,
  to set:

  - `enable_sampling`: Enable subword regularization.
  - `nbest_size`: Sampling parameters for unigram. Invalid for BPE-Dropout.

    - `nbest_size = &amp;lcub;0,1}`: No sampling is performed.
    - `nbest_size > 1`: samples from the nbest_size results.
    - `nbest_size &amp;lt; 0`: assuming that nbest_size is infinite and samples from the all hypothesis (lattice)
      using forward-filtering-and-backward-sampling algorithm.

  - `alpha`: Smoothing parameter for unigram sampling, and dropout probability of merge operations for
    BPE-dropout.
- **sp_model** (`SentencePieceProcessor`) --
  The *SentencePiece* processor that is used for every conversion (string, tokens and IDs).</paramsdesc><paramgroups>0</paramgroups></docstring>

Adapted from [RobertaTokenizer](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.RobertaTokenizer) and [XLNetTokenizer](/docs/transformers/pr_15592/en/model_doc/xlnet#transformers.XLNetTokenizer). Construct a CamemBERT tokenizer. Based on
[SentencePiece](https://github.com/google/sentencepiece).

This tokenizer inherits from [PreTrainedTokenizer](/docs/transformers/pr_15592/en/main_classes/tokenizer#transformers.PreTrainedTokenizer) which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.









<div class="docstring">
<docstring><name>build\_inputs\_with\_special\_tokens</name><anchor>transformers.CamembertTokenizer.build_inputs_with_special_tokens</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/tokenization_camembert.py#L161</source><parameters>[{"name": "token_ids_0", "val": ": typing.List[int]"}, {"name": "token_ids_1", "val": ": typing.Optional[typing.List[int]] = None"}]</parameters><paramsdesc>- **token_ids_0** (`List[int]`) --
  List of IDs to which the special tokens will be added.
- **token_ids_1** (`List[int]`, *optional*) --
  Optional second list of IDs for sequence pairs.</paramsdesc><paramgroups>0</paramgroups><rettype>`List[int]`</rettype><retdesc>List of [input IDs](../glossary#input-ids) with the appropriate special tokens.</retdesc></docstring>

Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. An CamemBERT sequence has the following format:

- single sequence: `<s> X </s>`
- pair of sequences: `<s> A </s>&amp;lt;/s> B &amp;lt;/s>`








</div>
<div class="docstring">
<docstring><name>get\_special\_tokens\_mask</name><anchor>transformers.CamembertTokenizer.get_special_tokens_mask</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/tokenization_camembert.py#L187</source><parameters>[{"name": "token_ids_0", "val": ": typing.List[int]"}, {"name": "token_ids_1", "val": ": typing.Optional[typing.List[int]] = None"}, {"name": "already_has_special_tokens", "val": ": bool = False"}]</parameters><paramsdesc>- **token_ids_0** (`List[int]`) --
  List of IDs.
- **token_ids_1** (`List[int]`, *optional*) --
  Optional second list of IDs for sequence pairs.
- **already_has_special_tokens** (`bool`, *optional*, defaults to `False`) --
  Whether or not the token list is already formatted with special tokens for the model.</paramsdesc><paramgroups>0</paramgroups><rettype>`List[int]`</rettype><retdesc>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</retdesc></docstring>

Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `prepare_for_model` method.








</div>
<div class="docstring">
<docstring><name>create\_token\_type\_ids\_from\_sequences</name><anchor>transformers.CamembertTokenizer.create_token_type_ids_from_sequences</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/tokenization_camembert.py#L214</source><parameters>[{"name": "token_ids_0", "val": ": typing.List[int]"}, {"name": "token_ids_1", "val": ": typing.Optional[typing.List[int]] = None"}]</parameters><paramsdesc>- **token_ids_0** (`List[int]`) --
  List of IDs.
- **token_ids_1** (`List[int]`, *optional*) --
  Optional second list of IDs for sequence pairs.</paramsdesc><paramgroups>0</paramgroups><rettype>`List[int]`</rettype><retdesc>List of zeros.</retdesc></docstring>

Create a mask from the two sequences passed to be used in a sequence-pair classification task. CamemBERT, like
RoBERTa, does not make use of token type ids, therefore a list of zeros is returned.








</div>
<div class="docstring"></div></div>

<h2 id="transformers.CamembertTokenizerFast">CamembertTokenizerFast</h2>

<div class="docstring">

<docstring><name>class transformers.CamembertTokenizerFast</name><anchor>transformers.CamembertTokenizerFast</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/tokenization_camembert_fast.py#L54</source><parameters>[{"name": "vocab_file", "val": " = None"}, {"name": "tokenizer_file", "val": " = None"}, {"name": "bos_token", "val": " = '<s>'"}, {"name": "eos_token", "val": " = '</s>'"}, {"name": "sep_token", "val": " = '</s>'"}, {"name": "cls_token", "val": " = '<s>'"}, {"name": "unk_token", "val": " = '<unk>'"}, {"name": "pad_token", "val": " = '<pad>'"}, {"name": "mask_token", "val": " = '<mask>'"}, {"name": "additional_special_tokens", "val": " = ['<s>NOTUSED', '</s>NOTUSED']"}, {"name": "**kwargs", "val": ""}]</parameters><paramsdesc>- **vocab_file** (`str`) --
  [SentencePiece](https://github.com/google/sentencepiece) file (generally has a *.spm* extension) that
  contains the vocabulary necessary to instantiate a tokenizer.
- **bos_token** (`str`, *optional*, defaults to `"<s>"`) --
  The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.

  <Tip>

  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`.

  </Tip>

- **eos_token** (`str`, *optional*, defaults to `"</s>"`) --
  The end of sequence token.

  <Tip>

  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`.

  </Tip>

- **sep_token** (`str`, *optional*, defaults to `"&amp;lt;/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 `"&amp;lt;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 `"&amp;lt;pad>"`) --
  The token used for padding, for example when batching sequences of different lengths.
- **mask_token** (`str`, *optional*, defaults to `"&amp;lt;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.
- **additional_special_tokens** (`List[str]`, *optional*, defaults to `["&amp;lt;s>NOTUSED", "</s>NOTUSED"]`) --
  Additional special tokens used by the tokenizer.</paramsdesc><paramgroups>0</paramgroups></docstring>

Construct a "fast" CamemBERT tokenizer (backed by HuggingFace's *tokenizers* library). Adapted from
[RobertaTokenizer](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.RobertaTokenizer) and [XLNetTokenizer](/docs/transformers/pr_15592/en/model_doc/xlnet#transformers.XLNetTokenizer). Based on
[BPE](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=BPE#models).

This tokenizer inherits from [PreTrainedTokenizerFast](/docs/transformers/pr_15592/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast) which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.





<div class="docstring">
<docstring><name>build\_inputs\_with\_special\_tokens</name><anchor>transformers.CamembertTokenizerFast.build_inputs_with_special_tokens</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/tokenization_camembert_fast.py#L146</source><parameters>[{"name": "token_ids_0", "val": ": typing.List[int]"}, {"name": "token_ids_1", "val": ": typing.Optional[typing.List[int]] = None"}]</parameters><paramsdesc>- **token_ids_0** (`List[int]`) --
  List of IDs to which the special tokens will be added.
- **token_ids_1** (`List[int]`, *optional*) --
  Optional second list of IDs for sequence pairs.</paramsdesc><paramgroups>0</paramgroups><rettype>`List[int]`</rettype><retdesc>List of [input IDs](../glossary#input-ids) with the appropriate special tokens.</retdesc></docstring>

Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. An CamemBERT sequence has the following format:

- single sequence: `<s> X </s>`
- pair of sequences: `<s> A </s>&amp;lt;/s> B &amp;lt;/s>`








</div>
<div class="docstring">
<docstring><name>create\_token\_type\_ids\_from\_sequences</name><anchor>transformers.CamembertTokenizerFast.create_token_type_ids_from_sequences</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/tokenization_camembert_fast.py#L172</source><parameters>[{"name": "token_ids_0", "val": ": typing.List[int]"}, {"name": "token_ids_1", "val": ": typing.Optional[typing.List[int]] = None"}]</parameters><paramsdesc>- **token_ids_0** (`List[int]`) --
  List of IDs.
- **token_ids_1** (`List[int]`, *optional*) --
  Optional second list of IDs for sequence pairs.</paramsdesc><paramgroups>0</paramgroups><rettype>`List[int]`</rettype><retdesc>List of zeros.</retdesc></docstring>

Create a mask from the two sequences passed to be used in a sequence-pair classification task. CamemBERT, like
RoBERTa, does not make use of token type ids, therefore a list of zeros is returned.








</div></div>

<h2 id="transformers.CamembertModel">CamembertModel</h2>

<div class="docstring">

<docstring><name>class transformers.CamembertModel</name><anchor>transformers.CamembertModel</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/modeling_camembert.py#L64</source><parameters>[{"name": "config", "val": ""}, {"name": "add_pooling_layer", "val": " = True"}]</parameters><paramsdesc>- **config** ([CamembertConfig](/docs/transformers/pr_15592/en/model_doc/camembert#transformers.CamembertConfig)) -- Model configuration class with all the parameters of the
  model. Initializing with a config file does not load the weights associated with the model, only the
  configuration. Check out the [from_pretrained()](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel.from_pretrained) method to load the model weights.</paramsdesc><paramgroups>0</paramgroups></docstring>
The bare CamemBERT Model transformer outputting raw hidden-states without any specific head on top.

This model inherits from [PreTrainedModel](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel). Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)

This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.



This class overrides [RobertaModel](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.RobertaModel). Please check the superclass for the appropriate documentation alongside
usage examples.


</div>

<h2 id="transformers.CamembertForCausalLM">CamembertForCausalLM</h2>

<div class="docstring">

<docstring><name>class transformers.CamembertForCausalLM</name><anchor>transformers.CamembertForCausalLM</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/modeling_camembert.py#L153</source><parameters>[{"name": "config", "val": ""}]</parameters><paramsdesc>- **config** ([CamembertConfig](/docs/transformers/pr_15592/en/model_doc/camembert#transformers.CamembertConfig)) -- Model configuration class with all the parameters of the
  model. Initializing with a config file does not load the weights associated with the model, only the
  configuration. Check out the [from_pretrained()](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel.from_pretrained) method to load the model weights.</paramsdesc><paramgroups>0</paramgroups></docstring>
CamemBERT Model with a `language modeling` head on top for CLM fine-tuning.

This model inherits from [PreTrainedModel](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel). Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)

This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.



This class overrides [RobertaForCausalLM](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.RobertaForCausalLM). Please check the superclass for the appropriate documentation
alongside usage examples.


</div>

<h2 id="transformers.CamembertForMaskedLM">CamembertForMaskedLM</h2>

<div class="docstring">

<docstring><name>class transformers.CamembertForMaskedLM</name><anchor>transformers.CamembertForMaskedLM</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/modeling_camembert.py#L77</source><parameters>[{"name": "config", "val": ""}]</parameters><paramsdesc>- **config** ([CamembertConfig](/docs/transformers/pr_15592/en/model_doc/camembert#transformers.CamembertConfig)) -- Model configuration class with all the parameters of the
  model. Initializing with a config file does not load the weights associated with the model, only the
  configuration. Check out the [from_pretrained()](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel.from_pretrained) method to load the model weights.</paramsdesc><paramgroups>0</paramgroups></docstring>
CamemBERT Model with a `language modeling` head on top.

This model inherits from [PreTrainedModel](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel). Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)

This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.



This class overrides [RobertaForMaskedLM](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.RobertaForMaskedLM). Please check the superclass for the appropriate documentation
alongside usage examples.


</div>

<h2 id="transformers.CamembertForSequenceClassification">CamembertForSequenceClassification</h2>

<div class="docstring">

<docstring><name>class transformers.CamembertForSequenceClassification</name><anchor>transformers.CamembertForSequenceClassification</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/modeling_camembert.py#L93</source><parameters>[{"name": "config", "val": ""}]</parameters><paramsdesc>- **config** ([CamembertConfig](/docs/transformers/pr_15592/en/model_doc/camembert#transformers.CamembertConfig)) -- Model configuration class with all the parameters of the
  model. Initializing with a config file does not load the weights associated with the model, only the
  configuration. Check out the [from_pretrained()](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel.from_pretrained) method to load the model weights.</paramsdesc><paramgroups>0</paramgroups></docstring>

CamemBERT Model transformer with a sequence classification/regression head on top (a linear layer on top of the
pooled output) e.g. for GLUE tasks.


This model inherits from [PreTrainedModel](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel). Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)

This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.



This class overrides [RobertaForSequenceClassification](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.RobertaForSequenceClassification). Please check the superclass for the appropriate
documentation alongside usage examples.


</div>

<h2 id="transformers.CamembertForMultipleChoice">CamembertForMultipleChoice</h2>

<div class="docstring">

<docstring><name>class transformers.CamembertForMultipleChoice</name><anchor>transformers.CamembertForMultipleChoice</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/modeling_camembert.py#L109</source><parameters>[{"name": "config", "val": ""}]</parameters><paramsdesc>- **config** ([CamembertConfig](/docs/transformers/pr_15592/en/model_doc/camembert#transformers.CamembertConfig)) -- Model configuration class with all the parameters of the
  model. Initializing with a config file does not load the weights associated with the model, only the
  configuration. Check out the [from_pretrained()](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel.from_pretrained) method to load the model weights.</paramsdesc><paramgroups>0</paramgroups></docstring>

CamemBERT Model with a multiple choice classification head on top (a linear layer on top of the pooled output and a
softmax) e.g. for RocStories/SWAG tasks.


This model inherits from [PreTrainedModel](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel). Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)

This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.



This class overrides [RobertaForMultipleChoice](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.RobertaForMultipleChoice). Please check the superclass for the appropriate documentation
alongside usage examples.


</div>

<h2 id="transformers.CamembertForTokenClassification">CamembertForTokenClassification</h2>

<div class="docstring">

<docstring><name>class transformers.CamembertForTokenClassification</name><anchor>transformers.CamembertForTokenClassification</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/modeling_camembert.py#L125</source><parameters>[{"name": "config", "val": ""}]</parameters><paramsdesc>- **config** ([CamembertConfig](/docs/transformers/pr_15592/en/model_doc/camembert#transformers.CamembertConfig)) -- Model configuration class with all the parameters of the
  model. Initializing with a config file does not load the weights associated with the model, only the
  configuration. Check out the [from_pretrained()](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel.from_pretrained) method to load the model weights.</paramsdesc><paramgroups>0</paramgroups></docstring>

CamemBERT Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g.
for Named-Entity-Recognition (NER) tasks.


This model inherits from [PreTrainedModel](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel). Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)

This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.



This class overrides [RobertaForTokenClassification](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.RobertaForTokenClassification). Please check the superclass for the appropriate
documentation alongside usage examples.


</div>

<h2 id="transformers.CamembertForQuestionAnswering">CamembertForQuestionAnswering</h2>

<div class="docstring">

<docstring><name>class transformers.CamembertForQuestionAnswering</name><anchor>transformers.CamembertForQuestionAnswering</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/modeling_camembert.py#L141</source><parameters>[{"name": "config", "val": ""}]</parameters><paramsdesc>- **config** ([CamembertConfig](/docs/transformers/pr_15592/en/model_doc/camembert#transformers.CamembertConfig)) -- Model configuration class with all the parameters of the
  model. Initializing with a config file does not load the weights associated with the model, only the
  configuration. Check out the [from_pretrained()](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel.from_pretrained) method to load the model weights.</paramsdesc><paramgroups>0</paramgroups></docstring>

CamemBERT Model with a span classification head on top for extractive question-answering tasks like SQuAD (a linear
layers on top of the hidden-states output to compute `span start logits` and `span end logits`


This model inherits from [PreTrainedModel](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel). Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)

This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.



This class overrides [RobertaForQuestionAnswering](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.RobertaForQuestionAnswering). Please check the superclass for the appropriate documentation
alongside usage examples.


</div>

<h2 id="transformers.TFCamembertModel">TFCamembertModel</h2>

<div class="docstring">

<docstring><name>class transformers.TFCamembertModel</name><anchor>transformers.TFCamembertModel</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/modeling_tf_camembert.py#L80</source><parameters>[{"name": "*args", "val": ""}, {"name": "**kwargs", "val": ""}]</parameters><paramsdesc>- **config** ([CamembertConfig](/docs/transformers/pr_15592/en/model_doc/camembert#transformers.CamembertConfig)) -- Model configuration class with all the parameters of the
  model. Initializing with a config file does not load the weights associated with the model, only the
  configuration. Check out the [from_pretrained()](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel.from_pretrained) method to load the model weights.</paramsdesc><paramgroups>0</paramgroups></docstring>
The bare CamemBERT Model transformer outputting raw hidden-states without any specific head on top.

This model inherits from [TFPreTrainedModel](/docs/transformers/pr_15592/en/main_classes/model#transformers.TFPreTrainedModel). Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)

This model is also a [tf.keras.Model](https://www.tensorflow.org/api_docs/python/tf/keras/Model) subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.

<Tip>

TF 2.0 models accepts two formats as inputs:

- having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments.

This second option is useful when using `tf.keras.Model.fit` method which currently requires having all the
tensors in the first argument of the model call function: `model(inputs)`.

If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the
first positional argument :

- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model(&amp;lcub;"input_ids": input_ids, "token_type_ids": token_type_ids})`

</Tip>



This class overrides [TFRobertaModel](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.TFRobertaModel). Please check the superclass for the appropriate documentation alongside
usage examples.


</div>

<h2 id="transformers.TFCamembertForMaskedLM">TFCamembertForMaskedLM</h2>

<div class="docstring">

<docstring><name>class transformers.TFCamembertForMaskedLM</name><anchor>transformers.TFCamembertForMaskedLM</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/modeling_tf_camembert.py#L93</source><parameters>[{"name": "*args", "val": ""}, {"name": "**kwargs", "val": ""}]</parameters><paramsdesc>- **config** ([CamembertConfig](/docs/transformers/pr_15592/en/model_doc/camembert#transformers.CamembertConfig)) -- Model configuration class with all the parameters of the
  model. Initializing with a config file does not load the weights associated with the model, only the
  configuration. Check out the [from_pretrained()](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel.from_pretrained) method to load the model weights.</paramsdesc><paramgroups>0</paramgroups></docstring>
CamemBERT Model with a `language modeling` head on top.

This model inherits from [TFPreTrainedModel](/docs/transformers/pr_15592/en/main_classes/model#transformers.TFPreTrainedModel). Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)

This model is also a [tf.keras.Model](https://www.tensorflow.org/api_docs/python/tf/keras/Model) subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.

<Tip>

TF 2.0 models accepts two formats as inputs:

- having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments.

This second option is useful when using `tf.keras.Model.fit` method which currently requires having all the
tensors in the first argument of the model call function: `model(inputs)`.

If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the
first positional argument :

- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model(&amp;lcub;"input_ids": input_ids, "token_type_ids": token_type_ids})`

</Tip>



This class overrides [TFRobertaForMaskedLM](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.TFRobertaForMaskedLM). Please check the superclass for the appropriate documentation
alongside usage examples.


</div>

<h2 id="transformers.TFCamembertForSequenceClassification">TFCamembertForSequenceClassification</h2>

<div class="docstring">

<docstring><name>class transformers.TFCamembertForSequenceClassification</name><anchor>transformers.TFCamembertForSequenceClassification</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/modeling_tf_camembert.py#L109</source><parameters>[{"name": "*args", "val": ""}, {"name": "**kwargs", "val": ""}]</parameters><paramsdesc>- **config** ([CamembertConfig](/docs/transformers/pr_15592/en/model_doc/camembert#transformers.CamembertConfig)) -- Model configuration class with all the parameters of the
  model. Initializing with a config file does not load the weights associated with the model, only the
  configuration. Check out the [from_pretrained()](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel.from_pretrained) method to load the model weights.</paramsdesc><paramgroups>0</paramgroups></docstring>

CamemBERT Model transformer with a sequence classification/regression head on top (a linear layer on top of the
pooled output) e.g. for GLUE tasks.


This model inherits from [TFPreTrainedModel](/docs/transformers/pr_15592/en/main_classes/model#transformers.TFPreTrainedModel). Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)

This model is also a [tf.keras.Model](https://www.tensorflow.org/api_docs/python/tf/keras/Model) subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.

<Tip>

TF 2.0 models accepts two formats as inputs:

- having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments.

This second option is useful when using `tf.keras.Model.fit` method which currently requires having all the
tensors in the first argument of the model call function: `model(inputs)`.

If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the
first positional argument :

- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model(&amp;lcub;"input_ids": input_ids, "token_type_ids": token_type_ids})`

</Tip>



This class overrides [TFRobertaForSequenceClassification](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.TFRobertaForSequenceClassification). Please check the superclass for the appropriate
documentation alongside usage examples.


</div>

<h2 id="transformers.TFCamembertForMultipleChoice">TFCamembertForMultipleChoice</h2>

<div class="docstring">

<docstring><name>class transformers.TFCamembertForMultipleChoice</name><anchor>transformers.TFCamembertForMultipleChoice</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/modeling_tf_camembert.py#L141</source><parameters>[{"name": "*args", "val": ""}, {"name": "**kwargs", "val": ""}]</parameters><paramsdesc>- **config** ([CamembertConfig](/docs/transformers/pr_15592/en/model_doc/camembert#transformers.CamembertConfig)) -- Model configuration class with all the parameters of the
  model. Initializing with a config file does not load the weights associated with the model, only the
  configuration. Check out the [from_pretrained()](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel.from_pretrained) method to load the model weights.</paramsdesc><paramgroups>0</paramgroups></docstring>

CamemBERT Model with a multiple choice classification head on top (a linear layer on top of the pooled output and a
softmax) e.g. for RocStories/SWAG tasks.


This model inherits from [TFPreTrainedModel](/docs/transformers/pr_15592/en/main_classes/model#transformers.TFPreTrainedModel). Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)

This model is also a [tf.keras.Model](https://www.tensorflow.org/api_docs/python/tf/keras/Model) subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.

<Tip>

TF 2.0 models accepts two formats as inputs:

- having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments.

This second option is useful when using `tf.keras.Model.fit` method which currently requires having all the
tensors in the first argument of the model call function: `model(inputs)`.

If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the
first positional argument :

- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model(&amp;lcub;"input_ids": input_ids, "token_type_ids": token_type_ids})`

</Tip>



This class overrides [TFRobertaForMultipleChoice](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.TFRobertaForMultipleChoice). Please check the superclass for the appropriate documentation
alongside usage examples.


</div>

<h2 id="transformers.TFCamembertForTokenClassification">TFCamembertForTokenClassification</h2>

<div class="docstring">

<docstring><name>class transformers.TFCamembertForTokenClassification</name><anchor>transformers.TFCamembertForTokenClassification</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/modeling_tf_camembert.py#L125</source><parameters>[{"name": "*args", "val": ""}, {"name": "**kwargs", "val": ""}]</parameters><paramsdesc>- **config** ([CamembertConfig](/docs/transformers/pr_15592/en/model_doc/camembert#transformers.CamembertConfig)) -- Model configuration class with all the parameters of the
  model. Initializing with a config file does not load the weights associated with the model, only the
  configuration. Check out the [from_pretrained()](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel.from_pretrained) method to load the model weights.</paramsdesc><paramgroups>0</paramgroups></docstring>

CamemBERT Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g.
for Named-Entity-Recognition (NER) tasks.


This model inherits from [TFPreTrainedModel](/docs/transformers/pr_15592/en/main_classes/model#transformers.TFPreTrainedModel). Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)

This model is also a [tf.keras.Model](https://www.tensorflow.org/api_docs/python/tf/keras/Model) subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.

<Tip>

TF 2.0 models accepts two formats as inputs:

- having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments.

This second option is useful when using `tf.keras.Model.fit` method which currently requires having all the
tensors in the first argument of the model call function: `model(inputs)`.

If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the
first positional argument :

- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model(&amp;lcub;"input_ids": input_ids, "token_type_ids": token_type_ids})`

</Tip>



This class overrides [TFRobertaForTokenClassification](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.TFRobertaForTokenClassification). Please check the superclass for the appropriate
documentation alongside usage examples.


</div>

<h2 id="transformers.TFCamembertForQuestionAnswering">TFCamembertForQuestionAnswering</h2>

<div class="docstring">

<docstring><name>class transformers.TFCamembertForQuestionAnswering</name><anchor>transformers.TFCamembertForQuestionAnswering</anchor><source>https://github.com/huggingface/transformers/blob/pr_15592/src/transformers/models/camembert/modeling_tf_camembert.py#L157</source><parameters>[{"name": "*args", "val": ""}, {"name": "**kwargs", "val": ""}]</parameters><paramsdesc>- **config** ([CamembertConfig](/docs/transformers/pr_15592/en/model_doc/camembert#transformers.CamembertConfig)) -- Model configuration class with all the parameters of the
  model. Initializing with a config file does not load the weights associated with the model, only the
  configuration. Check out the [from_pretrained()](/docs/transformers/pr_15592/en/main_classes/model#transformers.PreTrainedModel.from_pretrained) method to load the model weights.</paramsdesc><paramgroups>0</paramgroups></docstring>

CamemBERT Model with a span classification head on top for extractive question-answering tasks like SQuAD (a linear
layers on top of the hidden-states output to compute `span start logits` and `span end logits`).


This model inherits from [TFPreTrainedModel](/docs/transformers/pr_15592/en/main_classes/model#transformers.TFPreTrainedModel). Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)

This model is also a [tf.keras.Model](https://www.tensorflow.org/api_docs/python/tf/keras/Model) subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.

<Tip>

TF 2.0 models accepts two formats as inputs:

- having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments.

This second option is useful when using `tf.keras.Model.fit` method which currently requires having all the
tensors in the first argument of the model call function: `model(inputs)`.

If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the
first positional argument :

- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model(&amp;lcub;"input_ids": input_ids, "token_type_ids": token_type_ids})`

</Tip>



This class overrides [TFRobertaForQuestionAnswering](/docs/transformers/pr_15592/en/model_doc/roberta#transformers.TFRobertaForQuestionAnswering). Please check the superclass for the appropriate
documentation alongside usage examples.


</div>
