FlaxAutoModelForMultipleChoice

 False) —
Load the model weights from a PyTorch checkpoint save file (see docstring of
pretrained_model_name_or_path argument).   force_download (bool, optional, defaults to False) —
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.   resume_download (bool, optional, defaults to False) —
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.   proxies (Dict[str, str], optional) —
A dictionary of proxy servers to use by protocol or endpoint, e.g., {'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}. The proxies are used on each request.   output_loading_info(bool, optional, defaults to False) —
Whether ot not to also return a dictionary containing missing keys, unexpected keys and error messages.   local_files_only(bool, optional, default


FlaxAutoModelForMultipleChoice

s to False) —
Whether or not to only look at local files (e.g., not try downloading the model).   revision (str, optional, defaults to "main") —
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so revision can be any
identifier allowed by git.   trust_remote_code (bool, optional, defaults to False) —
Whether or not to allow for custom models defined on the Hub in their own modeling files. This option
should only be set to True for repositories you trust and in which you have read the code, as it will
execute code present on the Hub on your local machine.   code_revision (str, optional, defaults to "main") —
The specific revision to use for the code on the Hub, if the code leaves in a different repository than
the rest of the model. It can be a branch name, a


FlaxAutoModelForMultipleChoice

 tag name, or a commit id, since we use a git-based
system for storing models and other artifacts on huggingface.co, so revision can be any identifier
allowed by git.   kwargs (additional keyword arguments, optional) —
Can be used to update the configuration object (after it being loaded) and initiate the model (e.g.,
output_attentions=True). Behaves differently depending on whether a config is provided or
automatically loaded:
If a configuration is provided with config, **kwargs will be directly passed to the
underlying model’s __init__ method (we assume all relevant updates to the configuration have
already been done)
If a configuration is not provided, kwargs will be first passed to the configuration class
initialization function (from_pretrained()). Each key of kwargs that
corresponds to a configuration attribute will be used to override said attribute with the
supplied kwargs val


FlaxAutoModelForMultipleChoice

ue. Remaining keys that do not correspond to any configuration attribute
will be passed to the underlying model’s __init__ function.
    Instantiate one of the model classes of the library (with a multiple choice head) from a pretrained model. The model class to instantiate is selected based on the model_type property of the config object (either
passed as an argument or loaded from pretrained_model_name_or_path if possible), or when it’s missing, by
falling back to using pattern matching on pretrained_model_name_or_path: albert — FlaxAlbertForMultipleChoice (ALBERT model) bert — FlaxBertForMultipleChoice (BERT model) big_bird — FlaxBigBirdForMultipleChoice (BigBird model) distilbert — FlaxDistilBertForMultipleChoice (DistilBERT model) electra — FlaxElectraForMultipleChoice (ELECTRA model) roberta — FlaxRobertaForMultipleChoice (RoBERTa model) roberta-prelayernorm — FlaxRobertaPreLaye


FlaxAutoModelForMultipleChoice

rNormForMultipleChoice (RoBERTa-PreLayerNorm model) roformer — FlaxRoFormerForMultipleChoice (RoFormer model) xlm-roberta — FlaxXLMRobertaForMultipleChoice (XLM-RoBERTa model)  Examples:   Copied >>> from transformers import AutoConfig, FlaxAutoModelForMultipleChoice
>>> # Download model and configuration from huggingface.co and cache.
>>> model = FlaxAutoModelForMultipleChoice.from_pretrained("bert-base-cased")
>>> # Update configuration during loading
>>> model = FlaxAutoModelForMultipleChoice.from_pretrained("bert-base-cased", output_attentions=True)
>>> model.config.output_attentions
True
>>> # Loading from a PyTorch checkpoint file instead of a TensorFlow model (slower)
>>> config = AutoConfig.from_pretrained("./pt_model/bert_pt_model_config.json")
>>> model = FlaxAutoModelForMultipleChoice.from_pretrained(
...     "./pt_model/bert_pytorch_model.bin", from_pt=True, config=config


AutoModelForNextSentencePrediction

class transformers.AutoModelForNextSentencePrediction  < source > ( *args **kwargs  )    This is a generic model class that will be instantiated as one of the model classes of the library (with a next sentence prediction head) when created
with the from_pretrained() class method or the from_config() class
method. This class cannot be instantiated directly using __init__() (throws an error).  from_config  < source > ( **kwargs  )   Parameters   config (PretrainedConfig) —
The model class to instantiate is selected based on the configuration class:
BertConfig configuration class: BertForNextSentencePrediction (BERT model)
ErnieConfig configuration class: ErnieForNextSentencePrediction (ERNIE model)
FNetConfig configuration class: FNetForNextSentencePrediction (FNet model)
MegatronBertConfig configuration class: MegatronBertForNextSentencePrediction (Megatron-BERT model)
MobileBertConfig configuration class: MobileBertFo


AutoModelForNextSentencePrediction

rNextSentencePrediction (MobileBERT model)
NezhaConfig configuration class: NezhaForNextSentencePrediction (Nezha model)
QDQBertConfig configuration class: QDQBertForNextSentencePrediction (QDQBert model)
    Instantiates one of the model classes of the library (with a next sentence prediction head) from a configuration. Note:
Loading a model from its configuration file does not load the model weights. It only affects the
model’s configuration. Use from_pretrained() to load the model weights.  Examples:   Copied >>> from transformers import AutoConfig, AutoModelForNextSentencePrediction
>>> # Download configuration from huggingface.co and cache.
>>> config = AutoConfig.from_pretrained("bert-base-cased")
>>> model = AutoModelForNextSentencePrediction.from_config(config)  from_pretrained  < source > ( *model_args **kwargs  )   Parameters   pretrained_model_name_or_path (str or os.PathLike) —
Can be either:
A string, the


AutoModelForNextSentencePrediction

 model id of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like bert-base-uncased, or namespaced under a
user or organization name, like dbmdz/bert-base-german-cased.
A path to a directory containing model weights saved using
save_pretrained(), e.g., ./my_model_directory/.
A path or url to a tensorflow index checkpoint file (e.g, ./tf_model/model.ckpt.index). In
this case, from_tf should be set to True and a configuration object should be provided as
config argument. This loading path is slower than converting the TensorFlow checkpoint in a
PyTorch model using the provided conversion scripts and loading the PyTorch model afterwards.
   model_args (additional positional arguments, optional) —
Will be passed along to the underlying model __init__() method.   config (PretrainedConfig, optional) —
Configuration for the model to use instead of an automati


AutoModelForNextSentencePrediction

cally loaded configuration. Configuration can
be automatically loaded when:
The model is a model provided by the library (loaded with the model id string of a pretrained
model).
The model was saved using save_pretrained() and is reloaded by supplying the
save directory.
The model is loaded by supplying a local directory as pretrained_model_name_or_path and a
configuration JSON file named config.json is found in the directory.
   state_dict (Dict[str, torch.Tensor], optional) —
A state dictionary to use instead of a state dictionary loaded from saved weights file.
This option can be used if you want to create a model from a pretrained configuration but load your own
weights. In this case though, you should check if using save_pretrained() and
from_pretrained() is not a simpler option.   cache_dir (str or os.PathLike, optional) —
Path to a directory in which a downloaded pretrained model configuration should be cached i


AutoModelForNextSentencePrediction

f the
standard cache should not be used.   from_tf (bool, optional, defaults to False) —
Load the model weights from a TensorFlow checkpoint save file (see docstring of
pretrained_model_name_or_path argument).   force_download (bool, optional, defaults to False) —
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.   resume_download (bool, optional, defaults to False) —
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.   proxies (Dict[str, str], optional) —
A dictionary of proxy servers to use by protocol or endpoint, e.g., {'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}. The proxies are used on each request.   output_loading_info(bool, optional, defaults to False) —
Whether ot not to also return a dictionary containing missing keys, unexpected keys and error mess


AutoModelForNextSentencePrediction

ages.   local_files_only(bool, optional, defaults to False) —
Whether or not to only look at local files (e.g., not try downloading the model).   revision (str, optional, defaults to "main") —
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so revision can be any
identifier allowed by git.   trust_remote_code (bool, optional, defaults to False) —
Whether or not to allow for custom models defined on the Hub in their own modeling files. This option
should only be set to True for repositories you trust and in which you have read the code, as it will
execute code present on the Hub on your local machine.   code_revision (str, optional, defaults to "main") —
The specific revision to use for the code on the Hub, if the code leaves in a different repository than
the rest of the model. It can be a


AutoModelForNextSentencePrediction

branch name, a tag name, or a commit id, since we use a git-based
system for storing models and other artifacts on huggingface.co, so revision can be any identifier
allowed by git.   kwargs (additional keyword arguments, optional) —
Can be used to update the configuration object (after it being loaded) and initiate the model (e.g.,
output_attentions=True). Behaves differently depending on whether a config is provided or
automatically loaded:
If a configuration is provided with config, **kwargs will be directly passed to the
underlying model’s __init__ method (we assume all relevant updates to the configuration have
already been done)
If a configuration is not provided, kwargs will be first passed to the configuration class
initialization function (from_pretrained()). Each key of kwargs that
corresponds to a configuration attribute will be used to override said attribute with the
supplied kwargs value. Remaining keys t


AutoModelForNextSentencePrediction

hat do not correspond to any configuration attribute
will be passed to the underlying model’s __init__ function.
    Instantiate one of the model classes of the library (with a next sentence prediction head) from a pretrained model. The model class to instantiate is selected based on the model_type property of the config object (either
passed as an argument or loaded from pretrained_model_name_or_path if possible), or when it’s missing, by
falling back to using pattern matching on pretrained_model_name_or_path: bert — BertForNextSentencePrediction (BERT model) ernie — ErnieForNextSentencePrediction (ERNIE model) fnet — FNetForNextSentencePrediction (FNet model) megatron-bert — MegatronBertForNextSentencePrediction (Megatron-BERT model) mobilebert — MobileBertForNextSentencePrediction (MobileBERT model) nezha — NezhaForNextSentencePrediction (Nezha model) qdqbert — QDQBertForNextSentencePrediction (QDQBert model) The m


AutoModelForNextSentencePrediction

odel is set in evaluation mode by default using model.eval() (so for instance, dropout modules are
deactivated). To train the model, you should first set it back in training mode with model.train()  Examples:   Copied >>> from transformers import AutoConfig, AutoModelForNextSentencePrediction
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForNextSentencePrediction.from_pretrained("bert-base-cased")
>>> # Update configuration during loading
>>> model = AutoModelForNextSentencePrediction.from_pretrained("bert-base-cased", output_attentions=True)
>>> model.config.output_attentions
True
>>> # Loading from a TF checkpoint file instead of a PyTorch model (slower)
>>> config = AutoConfig.from_pretrained("./tf_model/bert_tf_model_config.json")
>>> model = AutoModelForNextSentencePrediction.from_pretrained(
...     "./tf_model/bert_tf_checkpoint.ckpt.index", from_tf=True, config=conf


TFAutoModelForNextSentencePrediction

class transformers.TFAutoModelForNextSentencePrediction  < source > ( *args **kwargs  )    This is a generic model class that will be instantiated as one of the model classes of the library (with a next sentence prediction head) when created
with the from_pretrained() class method or the from_config() class
method. This class cannot be instantiated directly using __init__() (throws an error).  from_config  < source > ( **kwargs  )   Parameters   config (PretrainedConfig) —
The model class to instantiate is selected based on the configuration class:
BertConfig configuration class: TFBertForNextSentencePrediction (BERT model)
MobileBertConfig configuration class: TFMobileBertForNextSentencePrediction (MobileBERT model)
    Instantiates one of the model classes of the library (with a next sentence prediction head) from a configuration. Note:
Loading a model from its configuration f


TFAutoModelForNextSentencePrediction

ile does not load the model weights. It only affects the
model’s configuration. Use from_pretrained() to load the model weights.  Examples:   Copied >>> from transformers import AutoConfig, TFAutoModelForNextSentencePrediction
>>> # Download configuration from huggingface.co and cache.
>>> config = AutoConfig.from_pretrained("bert-base-cased")
>>> model = TFAutoModelForNextSentencePrediction.from_config(config)  from_pretrained  < source > ( *model_args **kwargs  )   Parameters   pretrained_model_name_or_path (str or os.PathLike) —
Can be either:
A string, the model id of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like bert-base-uncased, or namespaced under a
user or organization name, like dbmdz/bert-base-german-cased.
A path to a directory containing model weights saved using
save_pretrained(), e.g., ./my_


TFAutoModelForNextSentencePrediction

model_directory/.
A path or url to a PyTorch state_dict save file (e.g, ./pt_model/pytorch_model.bin). In this
case, from_pt should be set to True and a configuration object should be provided as config
argument. This loading path is slower than converting the PyTorch model in a TensorFlow model
using the provided conversion scripts and loading the TensorFlow model afterwards.
   model_args (additional positional arguments, optional) —
Will be passed along to the underlying model __init__() method.   config (PretrainedConfig, optional) —
Configuration for the model to use instead of an automatically loaded configuration. Configuration can
be automatically loaded when:
The model is a model provided by the library (loaded with the model id string of a pretrained
model).
The model was saved using save_pretrained() and is reloaded by supplying the
save directory.
The model is loaded


TFAutoModelForNextSentencePrediction

 by supplying a local directory as pretrained_model_name_or_path and a
configuration JSON file named config.json is found in the directory.
   cache_dir (str or os.PathLike, optional) —
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.   from_pt (bool, optional, defaults to False) —
Load the model weights from a PyTorch checkpoint save file (see docstring of
pretrained_model_name_or_path argument).   force_download (bool, optional, defaults to False) —
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.   resume_download (bool, optional, defaults to False) —
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.   proxies (Dict[str, str], optional) —
A dictiona


TFAutoModelForNextSentencePrediction

ry of proxy servers to use by protocol or endpoint, e.g., {'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}. The proxies are used on each request.   output_loading_info(bool, optional, defaults to False) —
Whether ot not to also return a dictionary containing missing keys, unexpected keys and error messages.   local_files_only(bool, optional, defaults to False) —
Whether or not to only look at local files (e.g., not try downloading the model).   revision (str, optional, defaults to "main") —
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so revision can be any
identifier allowed by git.   trust_remote_code (bool, optional, defaults to False) —
Whether or not to allow for custom models defined on the Hub in their own modeling files. This opt


TFAutoModelForNextSentencePrediction

ion
should only be set to True for repositories you trust and in which you have read the code, as it will
execute code present on the Hub on your local machine.   code_revision (str, optional, defaults to "main") —
The specific revision to use for the code on the Hub, if the code leaves in a different repository than
the rest of the model. It can be a branch name, a tag name, or a commit id, since we use a git-based
system for storing models and other artifacts on huggingface.co, so revision can be any identifier
allowed by git.   kwargs (additional keyword arguments, optional) —
Can be used to update the configuration object (after it being loaded) and initiate the model (e.g.,
output_attentions=True). Behaves differently depending on whether a config is provided or
automatically loaded:
If a configuration is provided with config, **kwargs will be directly passed to the
underly


TFAutoModelForNextSentencePrediction

ing model’s __init__ method (we assume all relevant updates to the configuration have
already been done)
If a configuration is not provided, kwargs will be first passed to the configuration class
initialization function (from_pretrained()). Each key of kwargs that
corresponds to a configuration attribute will be used to override said attribute with the
supplied kwargs value. Remaining keys that do not correspond to any configuration attribute
will be passed to the underlying model’s __init__ function.
    Instantiate one of the model classes of the library (with a next sentence prediction head) from a pretrained model. The model class to instantiate is selected based on the model_type property of the config object (either
passed as an argument or loaded from pretrained_model_name_or_path if possible), or when it’s missing, by
falling back to using pattern matching on pretrained_


TFAutoModelForNextSentencePrediction

model_name_or_path: bert — TFBertForNextSentencePrediction (BERT model) mobilebert — TFMobileBertForNextSentencePrediction (MobileBERT model)  Examples:   Copied >>> from transformers import AutoConfig, TFAutoModelForNextSentencePrediction
>>> # Download model and configuration from huggingface.co and cache.
>>> model = TFAutoModelForNextSentencePrediction.from_pretrained("bert-base-cased")
>>> # Update configuration during loading
>>> model = TFAutoModelForNextSentencePrediction.from_pretrained("bert-base-cased", output_attentions=True)
>>> model.config.output_attentions
True
>>> # Loading from a PyTorch checkpoint file instead of a TensorFlow model (slower)
>>> config = AutoConfig.from_pretrained("./pt_model/bert_pt_model_config.json")
>>> model = TFAutoModelForNextSentencePrediction.from_pretrained(
...     "./pt_model/bert_pytorch_model.bin", from_pt=True, config=config
...


FlaxAutoModelForNextSentencePrediction

class transformers.FlaxAutoModelForNextSentencePrediction  < source > ( *args **kwargs  )    This is a generic model class that will be instantiated as one of the model classes of the library (with a next sentence prediction head) when created
with the from_pretrained() class method or the from_config() class
method. This class cannot be instantiated directly using __init__() (throws an error).  from_config  < source > ( **kwargs  )   Parameters   config (PretrainedConfig) —
The model class to instantiate is selected based on the configuration class:
BertConfig configuration class: FlaxBertForNextSentencePrediction (BERT model)
    Instantiates one of the model classes of the library (with a next sentence prediction head) from a configuration. Note:
Loading a model from its configuration file does not load the model weights. It only affects the
model’s configuration. Use from_pretrained() to load the model weights.  Examples:   Copied >>> from transformers import AutoConfig, FlaxAut


FlaxAutoModelForNextSentencePrediction

oModelForNextSentencePrediction
>>> # Download configuration from huggingface.co and cache.
>>> config = AutoConfig.from_pretrained("bert-base-cased")
>>> model = FlaxAutoModelForNextSentencePrediction.from_config(config)  from_pretrained  < source > ( *model_args **kwargs  )   Parameters   pretrained_model_name_or_path (str or os.PathLike) —
Can be either:
A string, the model id of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like bert-base-uncased, or namespaced under a
user or organization name, like dbmdz/bert-base-german-cased.
A path to a directory containing model weights saved using
save_pretrained(), e.g., ./my_model_directory/.
A path or url to a PyTorch state_dict save file (e.g, ./pt_model/pytorch_model.bin). In this
case, from_pt should be set to True and a configuration object should be provided as config
argument. This loading path is slower than converting the PyTorch model in a TensorFlow model
us


FlaxAutoModelForNextSentencePrediction

ing the provided conversion scripts and loading the TensorFlow model afterwards.
   model_args (additional positional arguments, optional) —
Will be passed along to the underlying model __init__() method.   config (PretrainedConfig, optional) —
Configuration for the model to use instead of an automatically loaded configuration. Configuration can
be automatically loaded when:
The model is a model provided by the library (loaded with the model id string of a pretrained
model).
The model was saved using save_pretrained() and is reloaded by supplying the
save directory.
The model is loaded by supplying a local directory as pretrained_model_name_or_path and a
configuration JSON file named config.json is found in the directory.
   cache_dir (str or os.PathLike, optional) —
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.   from_pt (bool, optional, defaults to False) —
Load the model weights from a PyTorch c


FlaxAutoModelForNextSentencePrediction

heckpoint save file (see docstring of
pretrained_model_name_or_path argument).   force_download (bool, optional, defaults to False) —
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.   resume_download (bool, optional, defaults to False) —
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.   proxies (Dict[str, str], optional) —
A dictionary of proxy servers to use by protocol or endpoint, e.g., {'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}. The proxies are used on each request.   output_loading_info(bool, optional, defaults to False) —
Whether ot not to also return a dictionary containing missing keys, unexpected keys and error messages.   local_files_only(bool, optional, defaults to False) —
Whether or not to only look at local files (e.g., not try downloading the model).   revision (str, optional, defaults to "main") —
The


FlaxAutoModelForNextSentencePrediction

specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so revision can be any
identifier allowed by git.   trust_remote_code (bool, optional, defaults to False) —
Whether or not to allow for custom models defined on the Hub in their own modeling files. This option
should only be set to True for repositories you trust and in which you have read the code, as it will
execute code present on the Hub on your local machine.   code_revision (str, optional, defaults to "main") —
The specific revision to use for the code on the Hub, if the code leaves in a different repository than
the rest of the model. It can be a branch name, a tag name, or a commit id, since we use a git-based
system for storing models and other artifacts on huggingface.co, so revision can be any identifier
allowed by git.   kwargs (additional keyword arguments, optional) —
Can be used to update the conf


FlaxAutoModelForNextSentencePrediction

iguration object (after it being loaded) and initiate the model (e.g.,
output_attentions=True). Behaves differently depending on whether a config is provided or
automatically loaded:
If a configuration is provided with config, **kwargs will be directly passed to the
underlying model’s __init__ method (we assume all relevant updates to the configuration have
already been done)
If a configuration is not provided, kwargs will be first passed to the configuration class
initialization function (from_pretrained()). Each key of kwargs that
corresponds to a configuration attribute will be used to override said attribute with the
supplied kwargs value. Remaining keys that do not correspond to any configuration attribute
will be passed to the underlying model’s __init__ function.
    Instantiate one of the model classes of the library (with a next sentence prediction head) from a pretrained model. The model class to instantiate is selected based on the model_type property of the config object


FlaxAutoModelForNextSentencePrediction

 (either
passed as an argument or loaded from pretrained_model_name_or_path if possible), or when it’s missing, by
falling back to using pattern matching on pretrained_model_name_or_path: bert — FlaxBertForNextSentencePrediction (BERT model)  Examples:   Copied >>> from transformers import AutoConfig, FlaxAutoModelForNextSentencePrediction
>>> # Download model and configuration from huggingface.co and cache.
>>> model = FlaxAutoModelForNextSentencePrediction.from_pretrained("bert-base-cased")
>>> # Update configuration during loading
>>> model = FlaxAutoModelForNextSentencePrediction.from_pretrained("bert-base-cased", output_attentions=True)
>>> model.config.output_attentions
True
>>> # Loading from a PyTorch checkpoint file instead of a TensorFlow model (slower)
>>> config = AutoConfig.from_pretrained("./pt_model/bert_pt_model_config.json")
>>> model = FlaxAutoModelForNextSentencePrediction.from_pretrained(
...     "./pt_model/bert_pytorch_model.bin", from_pt=True, config=config
..


AutoModelForTokenClassification

class transformers.AutoModelForTokenClassification  < source > ( *args **kwargs  )    This is a generic model class that will be instantiated as one of the model classes of the library (with a token classification head) when created
with the from_pretrained() class method or the from_config() class
method. This class cannot be instantiated directly using __init__() (throws an error).  from_config  < source > ( **kwargs  )   Parameters   config (PretrainedConfig) —
The model class to instantiate is selected based on the configuration class:
AlbertConfig configuration class: AlbertForTokenClassification (ALBERT model)
BertConfig configuration class: BertForTokenClassification (BERT model)
BigBirdConfig configuration class: BigBirdForTokenClassification (BigBird model)
BioGptConfig configuration class: BioGptForTokenClassification (BioGpt model)
BloomConfig configuration class: BloomForTokenClassification (BLOOM model)
BrosConfig configuration class: BrosForTokenClassification (BROS


AutoModelForTokenClassification

 model)
CamembertConfig configuration class: CamembertForTokenClassification (CamemBERT model)
CanineConfig configuration class: CanineForTokenClassification (CANINE model)
ConvBertConfig configuration class: ConvBertForTokenClassification (ConvBERT model)
Data2VecTextConfig configuration class: Data2VecTextForTokenClassification (Data2VecText model)
DebertaConfig configuration class: DebertaForTokenClassification (DeBERTa model)
DebertaV2Config configuration class: DebertaV2ForTokenClassification (DeBERTa-v2 model)
DistilBertConfig configuration class: DistilBertForTokenClassification (DistilBERT model)
ElectraConfig configuration class: ElectraForTokenClassification (ELECTRA model)
ErnieConfig configuration class: ErnieForTokenClassification (ERNIE model)
ErnieMConfig configuration class: ErnieMForTokenClassification (ErnieM model)
EsmConfig configuration class: EsmForTokenClassification (ESM model)
FNetConfig configuration class: FNetForTokenClassification (FNet model)
FalconC


AutoModelForTokenClassification

onfig configuration class: FalconForTokenClassification (Falcon model)
FlaubertConfig configuration class: FlaubertForTokenClassification (FlauBERT model)
FunnelConfig configuration class: FunnelForTokenClassification (Funnel Transformer model)
GPT2Config configuration class: GPT2ForTokenClassification (OpenAI GPT-2 model)
GPTBigCodeConfig configuration class: GPTBigCodeForTokenClassification (GPTBigCode model)
GPTNeoConfig configuration class: GPTNeoForTokenClassification (GPT Neo model)
GPTNeoXConfig configuration class: GPTNeoXForTokenClassification (GPT NeoX model)
IBertConfig configuration class: IBertForTokenClassification (I-BERT model)
LayoutLMConfig configuration class: LayoutLMForTokenClassification (LayoutLM model)
LayoutLMv2Config configuration class: LayoutLMv2ForTokenClassification (LayoutLMv2 model)
LayoutLMv3Config configuration class: LayoutLMv3ForTokenClassification (LayoutLMv3 model)
LiltConfig configuration class: LiltForTokenClassification (LiLT model)
Longfo


AutoModelForTokenClassification

rmerConfig configuration class: LongformerForTokenClassification (Longformer model)
LukeConfig configuration class: LukeForTokenClassification (LUKE model)
MPNetConfig configuration class: MPNetForTokenClassification (MPNet model)
MarkupLMConfig configuration class: MarkupLMForTokenClassification (MarkupLM model)
MegaConfig configuration class: MegaForTokenClassification (MEGA model)
MegatronBertConfig configuration class: MegatronBertForTokenClassification (Megatron-BERT model)
MobileBertConfig configuration class: MobileBertForTokenClassification (MobileBERT model)
MptConfig configuration class: MptForTokenClassification (MPT model)
MraConfig configuration class: MraForTokenClassification (MRA model)
NezhaConfig configuration class: NezhaForTokenClassification (Nezha model)
NystromformerConfig configuration class: NystromformerForTokenClassification (Nyströmformer model)
QDQBertConfig configuration class: QDQBertForTokenClassification (QDQBert model)
RemBertConfig configuration


AutoModelForTokenClassification

 class: RemBertForTokenClassification (RemBERT model)
RoCBertConfig configuration class: RoCBertForTokenClassification (RoCBert model)
RoFormerConfig configuration class: RoFormerForTokenClassification (RoFormer model)
RobertaConfig configuration class: RobertaForTokenClassification (RoBERTa model)
RobertaPreLayerNormConfig configuration class: RobertaPreLayerNormForTokenClassification (RoBERTa-PreLayerNorm model)
SqueezeBertConfig configuration class: SqueezeBertForTokenClassification (SqueezeBERT model)
XLMConfig configuration class: XLMForTokenClassification (XLM model)
XLMRobertaConfig configuration class: XLMRobertaForTokenClassification (XLM-RoBERTa model)
XLMRobertaXLConfig configuration class: XLMRobertaXLForTokenClassification (XLM-RoBERTa-XL model)
XLNetConfig configuration class: XLNetForTokenClassification (XLNet model)
XmodConfig configuration class: XmodForTokenClassification (X-MOD model)
YosoConfig configuration class: YosoForTokenClassification (YOSO model)
    I


AutoModelForTokenClassification

nstantiates one of the model classes of the library (with a token classification head) from a configuration. Note:
Loading a model from its configuration file does not load the model weights. It only affects the
model’s configuration. Use from_pretrained() to load the model weights.  Examples:   Copied >>> from transformers import AutoConfig, AutoModelForTokenClassification
>>> # Download configuration from huggingface.co and cache.
>>> config = AutoConfig.from_pretrained("bert-base-cased")
>>> model = AutoModelForTokenClassification.from_config(config)  from_pretrained  < source > ( *model_args **kwargs  )   Parameters   pretrained_model_name_or_path (str or os.PathLike) —
Can be either:
A string, the model id of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like bert-base-uncased, or namespaced under a
user or organization name, like dbmdz/bert-base-german-cased.
A path to a directory containing model weights


AutoModelForTokenClassification

saved using
save_pretrained(), e.g., ./my_model_directory/.
A path or url to a tensorflow index checkpoint file (e.g, ./tf_model/model.ckpt.index). In
this case, from_tf should be set to True and a configuration object should be provided as
config argument. This loading path is slower than converting the TensorFlow checkpoint in a
PyTorch model using the provided conversion scripts and loading the PyTorch model afterwards.
   model_args (additional positional arguments, optional) —
Will be passed along to the underlying model __init__() method.   config (PretrainedConfig, optional) —
Configuration for the model to use instead of an automatically loaded configuration. Configuration can
be automatically loaded when:
The model is a model provided by the library (loaded with the model id string of a pretrained
model).
The model was saved using save_pretrained() and is reloaded by supplying the
save directory.
The model is loaded by supplying a local directory as pretrained_model_name


AutoModelForTokenClassification

_or_path and a
configuration JSON file named config.json is found in the directory.
   state_dict (Dict[str, torch.Tensor], optional) —
A state dictionary to use instead of a state dictionary loaded from saved weights file.
This option can be used if you want to create a model from a pretrained configuration but load your own
weights. In this case though, you should check if using save_pretrained() and
from_pretrained() is not a simpler option.   cache_dir (str or os.PathLike, optional) —
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.   from_tf (bool, optional, defaults to False) —
Load the model weights from a TensorFlow checkpoint save file (see docstring of
pretrained_model_name_or_path argument).   force_download (bool, optional, defaults to False) —
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.   resume_d


AutoModelForTokenClassification

ownload (bool, optional, defaults to False) —
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.   proxies (Dict[str, str], optional) —
A dictionary of proxy servers to use by protocol or endpoint, e.g., {'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}. The proxies are used on each request.   output_loading_info(bool, optional, defaults to False) —
Whether ot not to also return a dictionary containing missing keys, unexpected keys and error messages.   local_files_only(bool, optional, defaults to False) —
Whether or not to only look at local files (e.g., not try downloading the model).   revision (str, optional, defaults to "main") —
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so revision can be any
identifier allowed by git.   trust_remote_code (bool, optional, defaults to Fa


AutoModelForTokenClassification

lse) —
Whether or not to allow for custom models defined on the Hub in their own modeling files. This option
should only be set to True for repositories you trust and in which you have read the code, as it will
execute code present on the Hub on your local machine.   code_revision (str, optional, defaults to "main") —
The specific revision to use for the code on the Hub, if the code leaves in a different repository than
the rest of the model. It can be a branch name, a tag name, or a commit id, since we use a git-based
system for storing models and other artifacts on huggingface.co, so revision can be any identifier
allowed by git.   kwargs (additional keyword arguments, optional) —
Can be used to update the configuration object (after it being loaded) and initiate the model (e.g.,
output_attentions=True). Behaves differently depending on whether a config is provided or
automatically loaded:
If a configuration is provided with config, **kwargs will be directly passed to the
under


AutoModelForTokenClassification

lying model’s __init__ method (we assume all relevant updates to the configuration have
already been done)
If a configuration is not provided, kwargs will be first passed to the configuration class
initialization function (from_pretrained()). Each key of kwargs that
corresponds to a configuration attribute will be used to override said attribute with the
supplied kwargs value. Remaining keys that do not correspond to any configuration attribute
will be passed to the underlying model’s __init__ function.
    Instantiate one of the model classes of the library (with a token classification head) from a pretrained model. The model class to instantiate is selected based on the model_type property of the config object (either
passed as an argument or loaded from pretrained_model_name_or_path if possible), or when it’s missing, by
falling back to using pattern matching on pretrained_model_name_or_path: albert — AlbertForTokenClassification (ALBERT model) bert — BertForTokenClassificatio


AutoModelForTokenClassification

n (BERT model) big_bird — BigBirdForTokenClassification (BigBird model) biogpt — BioGptForTokenClassification (BioGpt model) bloom — BloomForTokenClassification (BLOOM model) bros — BrosForTokenClassification (BROS model) camembert — CamembertForTokenClassification (CamemBERT model) canine — CanineForTokenClassification (CANINE model) convbert — ConvBertForTokenClassification (ConvBERT model) data2vec-text — Data2VecTextForTokenClassification (Data2VecText model) deberta — DebertaForTokenClassification (DeBERTa model) deberta-v2 — DebertaV2ForTokenClassification (DeBERTa-v2 model) distilbert — DistilBertForTokenClassification (DistilBERT model) electra — ElectraForTokenClassification (ELECTRA model) ernie — ErnieForTokenClassification (ERNIE model) ernie_m — ErnieMForTokenClassification (ErnieM model) esm — EsmForTokenClassification (ESM model) falcon — FalconForTokenClassification (Falcon model) flaubert — FlaubertForTokenClassification (FlauBERT model) fnet — FNetForTokenClassi


AutoModelForTokenClassification

fication (FNet model) funnel — FunnelForTokenClassification (Funnel Transformer model) gpt-sw3 — GPT2ForTokenClassification (GPT-Sw3 model) gpt2 — GPT2ForTokenClassification (OpenAI GPT-2 model) gpt_bigcode — GPTBigCodeForTokenClassification (GPTBigCode model) gpt_neo — GPTNeoForTokenClassification (GPT Neo model) gpt_neox — GPTNeoXForTokenClassification (GPT NeoX model) ibert — IBertForTokenClassification (I-BERT model) layoutlm — LayoutLMForTokenClassification (LayoutLM model) layoutlmv2 — LayoutLMv2ForTokenClassification (LayoutLMv2 model) layoutlmv3 — LayoutLMv3ForTokenClassification (LayoutLMv3 model) lilt — LiltForTokenClassification (LiLT model) longformer — LongformerForTokenClassification (Longformer model) luke — LukeForTokenClassification (LUKE model) markuplm — MarkupLMForTokenClassification (MarkupLM model) mega — MegaForTokenClassification (MEGA model) megatron-bert — MegatronBertForTokenClassification (Megatron-BERT model) mobilebert — MobileBertForTokenClassificat


AutoModelForTokenClassification

ion (MobileBERT model) mpnet — MPNetForTokenClassification (MPNet model) mpt — MptForTokenClassification (MPT model) mra — MraForTokenClassification (MRA model) nezha — NezhaForTokenClassification (Nezha model) nystromformer — NystromformerForTokenClassification (Nyströmformer model) qdqbert — QDQBertForTokenClassification (QDQBert model) rembert — RemBertForTokenClassification (RemBERT model) roberta — RobertaForTokenClassification (RoBERTa model) roberta-prelayernorm — RobertaPreLayerNormForTokenClassification (RoBERTa-PreLayerNorm model) roc_bert — RoCBertForTokenClassification (RoCBert model) roformer — RoFormerForTokenClassification (RoFormer model) squeezebert — SqueezeBertForTokenClassification (SqueezeBERT model) xlm — XLMForTokenClassification (XLM model) xlm-roberta — XLMRobertaForTokenClassification (XLM-RoBERTa model) xlm-roberta-xl — XLMRobertaXLForTokenClassification (XLM-RoBERTa-XL model) xlnet — XLNetForTokenClassification (XLNet model) xmod — XmodForTokenClassifi


AutoModelForTokenClassification

cation (X-MOD model) yoso — YosoForTokenClassification (YOSO model) The model is set in evaluation mode by default using model.eval() (so for instance, dropout modules are
deactivated). To train the model, you should first set it back in training mode with model.train()  Examples:   Copied >>> from transformers import AutoConfig, AutoModelForTokenClassification
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForTokenClassification.from_pretrained("bert-base-cased")
>>> # Update configuration during loading
>>> model = AutoModelForTokenClassification.from_pretrained("bert-base-cased", output_attentions=True)
>>> model.config.output_attentions
True
>>> # Loading from a TF checkpoint file instead of a PyTorch model (slower)
>>> config = AutoConfig.from_pretrained("./tf_model/bert_tf_model_config.json")
>>> model = AutoModelForTokenClassification.from_pretrained(
...     "./tf_model/bert_tf_checkpoint.ckpt.index", from_tf=True, config=config


TFAutoModelForTokenClassification

class transformers.TFAutoModelForTokenClassification  < source > ( *args **kwargs  )    This is a generic model class that will be instantiated as one of the model classes of the library (with a token classification head) when created
with the from_pretrained() class method or the from_config() class
method. This class cannot be instantiated directly using __init__() (throws an error).  from_config  < source > ( **kwargs  )   Parameters   config (PretrainedConfig) —
The model class to instantiate is selected based on the configuration class:
AlbertConfig configuration class: TFAlbertForTokenClassification (ALBERT model)
BertConfig configuration class: TFBertForTokenClassification (BERT model)
CamembertConfig configuration class: TFCamembertForTokenClassification (CamemBERT model)
ConvBertConfig configuration class: TFConvBertForTokenClassification (ConvBERT model)
DebertaConfig configuration class: TFDebertaForTo


TFAutoModelForTokenClassification

kenClassification (DeBERTa model)
DebertaV2Config configuration class: TFDebertaV2ForTokenClassification (DeBERTa-v2 model)
DistilBertConfig configuration class: TFDistilBertForTokenClassification (DistilBERT model)
ElectraConfig configuration class: TFElectraForTokenClassification (ELECTRA model)
EsmConfig configuration class: TFEsmForTokenClassification (ESM model)
FlaubertConfig configuration class: TFFlaubertForTokenClassification (FlauBERT model)
FunnelConfig configuration class: TFFunnelForTokenClassification (Funnel Transformer model)
LayoutLMConfig configuration class: TFLayoutLMForTokenClassification (LayoutLM model)
LayoutLMv3Config configuration class: TFLayoutLMv3ForTokenClassification (LayoutLMv3 model)
LongformerConfig configuration class: TFLongformerForTokenClassification (Longformer model)
MPNetConfig configuration class: TFMPNetForTokenClassification (MPNet model)
MobileBertConfig configuration


TFAutoModelForTokenClassification

class: TFMobileBertForTokenClassification (MobileBERT model)
RemBertConfig configuration class: TFRemBertForTokenClassification (RemBERT model)
RoFormerConfig configuration class: TFRoFormerForTokenClassification (RoFormer model)
RobertaConfig configuration class: TFRobertaForTokenClassification (RoBERTa model)
RobertaPreLayerNormConfig configuration class: TFRobertaPreLayerNormForTokenClassification (RoBERTa-PreLayerNorm model)
XLMConfig configuration class: TFXLMForTokenClassification (XLM model)
XLMRobertaConfig configuration class: TFXLMRobertaForTokenClassification (XLM-RoBERTa model)
XLNetConfig configuration class: TFXLNetForTokenClassification (XLNet model)
    Instantiates one of the model classes of the library (with a token classification head) from a configuration. Note:
Loading a model from its configuration file does not load the model weights. It only affects the
model’s configuration. Use from_pre


TFAutoModelForTokenClassification

trained() to load the model weights.  Examples:   Copied >>> from transformers import AutoConfig, TFAutoModelForTokenClassification
>>> # Download configuration from huggingface.co and cache.
>>> config = AutoConfig.from_pretrained("bert-base-cased")
>>> model = TFAutoModelForTokenClassification.from_config(config)  from_pretrained  < source > ( *model_args **kwargs  )   Parameters   pretrained_model_name_or_path (str or os.PathLike) —
Can be either:
A string, the model id of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like bert-base-uncased, or namespaced under a
user or organization name, like dbmdz/bert-base-german-cased.
A path to a directory containing model weights saved using
save_pretrained(), e.g., ./my_model_directory/.
A path or url to a PyTorch state_dict save file (e.g, ./pt_model/pytorch_model.bin). In this
case, from_pt should b


TFAutoModelForTokenClassification

e set to True and a configuration object should be provided as config
argument. This loading path is slower than converting the PyTorch model in a TensorFlow model
using the provided conversion scripts and loading the TensorFlow model afterwards.
   model_args (additional positional arguments, optional) —
Will be passed along to the underlying model __init__() method.   config (PretrainedConfig, optional) —
Configuration for the model to use instead of an automatically loaded configuration. Configuration can
be automatically loaded when:
The model is a model provided by the library (loaded with the model id string of a pretrained
model).
The model was saved using save_pretrained() and is reloaded by supplying the
save directory.
The model is loaded by supplying a local directory as pretrained_model_name_or_path and a
configuration JSON file named config.json is found in the directory.
   cache_dir (str or os.Path


TFAutoModelForTokenClassification

Like, optional) —
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.   from_pt (bool, optional, defaults to False) —
Load the model weights from a PyTorch checkpoint save file (see docstring of
pretrained_model_name_or_path argument).   force_download (bool, optional, defaults to False) —
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.   resume_download (bool, optional, defaults to False) —
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.   proxies (Dict[str, str], optional) —
A dictionary of proxy servers to use by protocol or endpoint, e.g., {'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}. The proxies are used on each request.   output_loading_info(bool, optional, defaults


TFAutoModelForTokenClassification

 to False) —
Whether ot not to also return a dictionary containing missing keys, unexpected keys and error messages.   local_files_only(bool, optional, defaults to False) —
Whether or not to only look at local files (e.g., not try downloading the model).   revision (str, optional, defaults to "main") —
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so revision can be any
identifier allowed by git.   trust_remote_code (bool, optional, defaults to False) —
Whether or not to allow for custom models defined on the Hub in their own modeling files. This option
should only be set to True for repositories you trust and in which you have read the code, as it will
execute code present on the Hub on your local machine.   code_revision (str, optional, defaults to "main") —
The specific revision t


TFAutoModelForTokenClassification

o use for the code on the Hub, if the code leaves in a different repository than
the rest of the model. It can be a branch name, a tag name, or a commit id, since we use a git-based
system for storing models and other artifacts on huggingface.co, so revision can be any identifier
allowed by git.   kwargs (additional keyword arguments, optional) —
Can be used to update the configuration object (after it being loaded) and initiate the model (e.g.,
output_attentions=True). Behaves differently depending on whether a config is provided or
automatically loaded:
If a configuration is provided with config, **kwargs will be directly passed to the
underlying model’s __init__ method (we assume all relevant updates to the configuration have
already been done)
If a configuration is not provided, kwargs will be first passed to the configuration class
initialization function (from_pretrained()). Each key of kwargs that
correspo


TFAutoModelForTokenClassification

nds to a configuration attribute will be used to override said attribute with the
supplied kwargs value. Remaining keys that do not correspond to any configuration attribute
will be passed to the underlying model’s __init__ function.
    Instantiate one of the model classes of the library (with a token classification head) from a pretrained model. The model class to instantiate is selected based on the model_type property of the config object (either
passed as an argument or loaded from pretrained_model_name_or_path if possible), or when it’s missing, by
falling back to using pattern matching on pretrained_model_name_or_path: albert — TFAlbertForTokenClassification (ALBERT model) bert — TFBertForTokenClassification (BERT model) camembert — TFCamembertForTokenClassification (CamemBERT model) convbert — TFConvBertForTokenClassification (ConvBERT model) deberta — TFDebertaForTokenClassification (DeBERTa model) deber


TFAutoModelForTokenClassification

ta-v2 — TFDebertaV2ForTokenClassification (DeBERTa-v2 model) distilbert — TFDistilBertForTokenClassification (DistilBERT model) electra — TFElectraForTokenClassification (ELECTRA model) esm — TFEsmForTokenClassification (ESM model) flaubert — TFFlaubertForTokenClassification (FlauBERT model) funnel — TFFunnelForTokenClassification (Funnel Transformer model) layoutlm — TFLayoutLMForTokenClassification (LayoutLM model) layoutlmv3 — TFLayoutLMv3ForTokenClassification (LayoutLMv3 model) longformer — TFLongformerForTokenClassification (Longformer model) mobilebert — TFMobileBertForTokenClassification (MobileBERT model) mpnet — TFMPNetForTokenClassification (MPNet model) rembert — TFRemBertForTokenClassification (RemBERT model) roberta — TFRobertaForTokenClassification (RoBERTa model) roberta-prelayernorm — TFRobertaPreLayerNormForTokenClassification (RoBERTa-PreLayerNorm model) roformer — TFRoFormerForTokenClassificat


TFAutoModelForTokenClassification

ion (RoFormer model) xlm — TFXLMForTokenClassification (XLM model) xlm-roberta — TFXLMRobertaForTokenClassification (XLM-RoBERTa model) xlnet — TFXLNetForTokenClassification (XLNet model)  Examples:   Copied >>> from transformers import AutoConfig, TFAutoModelForTokenClassification
>>> # Download model and configuration from huggingface.co and cache.
>>> model = TFAutoModelForTokenClassification.from_pretrained("bert-base-cased")
>>> # Update configuration during loading
>>> model = TFAutoModelForTokenClassification.from_pretrained("bert-base-cased", output_attentions=True)
>>> model.config.output_attentions
True
>>> # Loading from a PyTorch checkpoint file instead of a TensorFlow model (slower)
>>> config = AutoConfig.from_pretrained("./pt_model/bert_pt_model_config.json")
>>> model = TFAutoModelForTokenClassification.from_pretrained(
...     "./pt_model/bert_pytorch_model.bin", from_pt=True, config=config
... )


FlaxAutoModelForTokenClassification

class transformers.FlaxAutoModelForTokenClassification  < source > ( *args **kwargs  )    This is a generic model class that will be instantiated as one of the model classes of the library (with a token classification head) when created
with the from_pretrained() class method or the from_config() class
method. This class cannot be instantiated directly using __init__() (throws an error).  from_config  < source > ( **kwargs  )   Parameters   config (PretrainedConfig) —
The model class to instantiate is selected based on the configuration class:
AlbertConfig configuration class: FlaxAlbertForTokenClassification (ALBERT model)
BertConfig configuration class: FlaxBertForTokenClassification (BERT model)
BigBirdConfig configuration class: FlaxBigBirdForTokenClassification (BigBird model)
DistilBertConfig configuration class: FlaxDistilBertForTokenClassification (DistilBERT model)
ElectraConfig configuratio


FlaxAutoModelForTokenClassification

n class: FlaxElectraForTokenClassification (ELECTRA model)
RoFormerConfig configuration class: FlaxRoFormerForTokenClassification (RoFormer model)
RobertaConfig configuration class: FlaxRobertaForTokenClassification (RoBERTa model)
RobertaPreLayerNormConfig configuration class: FlaxRobertaPreLayerNormForTokenClassification (RoBERTa-PreLayerNorm model)
XLMRobertaConfig configuration class: FlaxXLMRobertaForTokenClassification (XLM-RoBERTa model)
    Instantiates one of the model classes of the library (with a token classification head) from a configuration. Note:
Loading a model from its configuration file does not load the model weights. It only affects the
model’s configuration. Use from_pretrained() to load the model weights.  Examples:   Copied >>> from transformers import AutoConfig, FlaxAutoModelForTokenClassification
>>> # Download configuration from huggingface.co and cache.
>>> config = AutoC


FlaxAutoModelForTokenClassification

onfig.from_pretrained("bert-base-cased")
>>> model = FlaxAutoModelForTokenClassification.from_config(config)  from_pretrained  < source > ( *model_args **kwargs  )   Parameters   pretrained_model_name_or_path (str or os.PathLike) —
Can be either:
A string, the model id of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like bert-base-uncased, or namespaced under a
user or organization name, like dbmdz/bert-base-german-cased.
A path to a directory containing model weights saved using
save_pretrained(), e.g., ./my_model_directory/.
A path or url to a PyTorch state_dict save file (e.g, ./pt_model/pytorch_model.bin). In this
case, from_pt should be set to True and a configuration object should be provided as config
argument. This loading path is slower than converting the PyTorch model in a TensorFlow model
using the provided conversion s


FlaxAutoModelForTokenClassification

cripts and loading the TensorFlow model afterwards.
   model_args (additional positional arguments, optional) —
Will be passed along to the underlying model __init__() method.   config (PretrainedConfig, optional) —
Configuration for the model to use instead of an automatically loaded configuration. Configuration can
be automatically loaded when:
The model is a model provided by the library (loaded with the model id string of a pretrained
model).
The model was saved using save_pretrained() and is reloaded by supplying the
save directory.
The model is loaded by supplying a local directory as pretrained_model_name_or_path and a
configuration JSON file named config.json is found in the directory.
   cache_dir (str or os.PathLike, optional) —
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.   from_pt (bool, optional, defau


FlaxAutoModelForTokenClassification

lts to False) —
Load the model weights from a PyTorch checkpoint save file (see docstring of
pretrained_model_name_or_path argument).   force_download (bool, optional, defaults to False) —
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.   resume_download (bool, optional, defaults to False) —
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.   proxies (Dict[str, str], optional) —
A dictionary of proxy servers to use by protocol or endpoint, e.g., {'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}. The proxies are used on each request.   output_loading_info(bool, optional, defaults to False) —
Whether ot not to also return a dictionary containing missing keys, unexpected keys and error messages.   local_files_only(bool, optional, defaults to False


FlaxAutoModelForTokenClassification

) —
Whether or not to only look at local files (e.g., not try downloading the model).   revision (str, optional, defaults to "main") —
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so revision can be any
identifier allowed by git.   trust_remote_code (bool, optional, defaults to False) —
Whether or not to allow for custom models defined on the Hub in their own modeling files. This option
should only be set to True for repositories you trust and in which you have read the code, as it will
execute code present on the Hub on your local machine.   code_revision (str, optional, defaults to "main") —
The specific revision to use for the code on the Hub, if the code leaves in a different repository than
the rest of the model. It can be a branch name, a tag name, or a commit id,


FlaxAutoModelForTokenClassification

 since we use a git-based
system for storing models and other artifacts on huggingface.co, so revision can be any identifier
allowed by git.   kwargs (additional keyword arguments, optional) —
Can be used to update the configuration object (after it being loaded) and initiate the model (e.g.,
output_attentions=True). Behaves differently depending on whether a config is provided or
automatically loaded:
If a configuration is provided with config, **kwargs will be directly passed to the
underlying model’s __init__ method (we assume all relevant updates to the configuration have
already been done)
If a configuration is not provided, kwargs will be first passed to the configuration class
initialization function (from_pretrained()). Each key of kwargs that
corresponds to a configuration attribute will be used to override said attribute with the
supplied kwargs value. Remaining keys that do not correspond


FlaxAutoModelForTokenClassification

to any configuration attribute
will be passed to the underlying model’s __init__ function.
    Instantiate one of the model classes of the library (with a token classification head) from a pretrained model. The model class to instantiate is selected based on the model_type property of the config object (either
passed as an argument or loaded from pretrained_model_name_or_path if possible), or when it’s missing, by
falling back to using pattern matching on pretrained_model_name_or_path: albert — FlaxAlbertForTokenClassification (ALBERT model) bert — FlaxBertForTokenClassification (BERT model) big_bird — FlaxBigBirdForTokenClassification (BigBird model) distilbert — FlaxDistilBertForTokenClassification (DistilBERT model) electra — FlaxElectraForTokenClassification (ELECTRA model) roberta — FlaxRobertaForTokenClassification (RoBERTa model) roberta-prelayernorm — FlaxRobertaPreLayerNormForTokenClassifica


FlaxAutoModelForTokenClassification

tion (RoBERTa-PreLayerNorm model) roformer — FlaxRoFormerForTokenClassification (RoFormer model) xlm-roberta — FlaxXLMRobertaForTokenClassification (XLM-RoBERTa model)  Examples:   Copied >>> from transformers import AutoConfig, FlaxAutoModelForTokenClassification
>>> # Download model and configuration from huggingface.co and cache.
>>> model = FlaxAutoModelForTokenClassification.from_pretrained("bert-base-cased")
>>> # Update configuration during loading
>>> model = FlaxAutoModelForTokenClassification.from_pretrained("bert-base-cased", output_attentions=True)
>>> model.config.output_attentions
True
>>> # Loading from a PyTorch checkpoint file instead of a TensorFlow model (slower)
>>> config = AutoConfig.from_pretrained("./pt_model/bert_pt_model_config.json")
>>> model = FlaxAutoModelForTokenClassification.from_pretrained(
...     "./pt_model/bert_pytorch_model.bin", from_pt=True, config=config
...


AutoModelForQuestionAnswering

class transformers.AutoModelForQuestionAnswering  < source > ( *args **kwargs  )    This is a generic model class that will be instantiated as one of the model classes of the library (with a question answering head) when created
with the from_pretrained() class method or the from_config() class
method. This class cannot be instantiated directly using __init__() (throws an error).  from_config  < source > ( **kwargs  )   Parameters   config (PretrainedConfig) —
The model class to instantiate is selected based on the configuration class:
AlbertConfig configuration class: AlbertForQuestionAnswering (ALBERT model)
BartConfig configuration class: BartForQuestionAnswering (BART model)
BertConfig configuration class: BertForQuestionAnswering (BERT model)
BigBirdConfig configuration class: BigBirdForQuestionAnswering (BigBird model)
BigBirdPegasusConfig configuration class: BigBirdPegasusForQuestionAnswering (BigBird-Pegasus model)
BloomConfig configuration class: Bloo


AutoModelForQuestionAnswering

mForQuestionAnswering (BLOOM model)
CamembertConfig configuration class: CamembertForQuestionAnswering (CamemBERT model)
CanineConfig configuration class: CanineForQuestionAnswering (CANINE model)
ConvBertConfig configuration class: ConvBertForQuestionAnswering (ConvBERT model)
Data2VecTextConfig configuration class: Data2VecTextForQuestionAnswering (Data2VecText model)
DebertaConfig configuration class: DebertaForQuestionAnswering (DeBERTa model)
DebertaV2Config configuration class: DebertaV2ForQuestionAnswering (DeBERTa-v2 model)
DistilBertConfig configuration class: DistilBertForQuestionAnswering (DistilBERT model)
ElectraConfig configuration class: ElectraForQuestionAnswering (ELECTRA model)
ErnieConfig configuration class: ErnieForQuestionAnswering (ERNIE model)
ErnieMConfig configuration class: ErnieMForQuestionAnswering (ErnieM model)
FNetConfig configuration class: FNetForQuestionAnswering (FNet model)
FalconConfig configuration class: FalconForQuestion


AutoModelForQuestionAnswering

Answering (Falcon model)
FlaubertConfig configuration class: FlaubertForQuestionAnsweringSimple (FlauBERT model)
FunnelConfig configuration class: FunnelForQuestionAnswering (Funnel Transformer model)
GPT2Config configuration class: GPT2ForQuestionAnswering (OpenAI GPT-2 model)
GPTJConfig configuration class: GPTJForQuestionAnswering (GPT-J model)
GPTNeoConfig configuration class: GPTNeoForQuestionAnswering (GPT Neo model)
GPTNeoXConfig configuration class: GPTNeoXForQuestionAnswering (GPT NeoX model)
IBertConfig configuration class: IBertForQuestionAnswering (I-BERT model)
LEDConfig configuration class: LEDForQuestionAnswering (LED model)
LayoutLMv2Config configuration class: LayoutLMv2ForQuestionAnswering (LayoutLMv2 model)
LayoutLMv3Config configuration class: LayoutLMv3ForQuestionAnswering (LayoutLMv3 model)
LiltConfig configuration class: LiltForQuestionAnswering (LiLT model)
LongformerConfig configuration class: LongformerForQuestionAnswering (Longformer


AutoModelForQuestionAnswering

model)
LukeConfig configuration class: LukeForQuestionAnswering (LUKE model)
LxmertConfig configuration class: LxmertForQuestionAnswering (LXMERT model)
MBartConfig configuration class: MBartForQuestionAnswering (mBART model)
MPNetConfig configuration class: MPNetForQuestionAnswering (MPNet model)
MT5Config configuration class: MT5ForQuestionAnswering (MT5 model)
MarkupLMConfig configuration class: MarkupLMForQuestionAnswering (MarkupLM model)
MegaConfig configuration class: MegaForQuestionAnswering (MEGA model)
MegatronBertConfig configuration class: MegatronBertForQuestionAnswering (Megatron-BERT model)
MobileBertConfig configuration class: MobileBertForQuestionAnswering (MobileBERT model)
MptConfig configuration class: MptForQuestionAnswering (MPT model)
MraConfig configuration class: MraForQuestionAnswering (MRA model)
MvpConfig configuration class: MvpForQuestionAnswering (MVP model)
NezhaConfig configuration class: NezhaForQuestionAnswering (Nezha model)


AutoModelForQuestionAnswering

NystromformerConfig configuration class: NystromformerForQuestionAnswering (Nyströmformer model)
OPTConfig configuration class: OPTForQuestionAnswering (OPT model)
QDQBertConfig configuration class: QDQBertForQuestionAnswering (QDQBert model)
ReformerConfig configuration class: ReformerForQuestionAnswering (Reformer model)
RemBertConfig configuration class: RemBertForQuestionAnswering (RemBERT model)
RoCBertConfig configuration class: RoCBertForQuestionAnswering (RoCBert model)
RoFormerConfig configuration class: RoFormerForQuestionAnswering (RoFormer model)
RobertaConfig configuration class: RobertaForQuestionAnswering (RoBERTa model)
RobertaPreLayerNormConfig configuration class: RobertaPreLayerNormForQuestionAnswering (RoBERTa-PreLayerNorm model)
SplinterConfig configuration class: SplinterForQuestionAnswering (Splinter model)
SqueezeBertConfig configuration class: SqueezeBertForQuestionAnswering (SqueezeBERT model)
T5Config configuration class: T5ForQuestio


AutoModelForQuestionAnswering

nAnswering (T5 model)
UMT5Config configuration class: UMT5ForQuestionAnswering (UMT5 model)
XLMConfig configuration class: XLMForQuestionAnsweringSimple (XLM model)
XLMRobertaConfig configuration class: XLMRobertaForQuestionAnswering (XLM-RoBERTa model)
XLMRobertaXLConfig configuration class: XLMRobertaXLForQuestionAnswering (XLM-RoBERTa-XL model)
XLNetConfig configuration class: XLNetForQuestionAnsweringSimple (XLNet model)
XmodConfig configuration class: XmodForQuestionAnswering (X-MOD model)
YosoConfig configuration class: YosoForQuestionAnswering (YOSO model)
    Instantiates one of the model classes of the library (with a question answering head) from a configuration. Note:
Loading a model from its configuration file does not load the model weights. It only affects the
model’s configuration. Use from_pretrained() to load the model weights.  Examples:   Copied >>> from transformers import AutoConfig, AutoModelForQuestionAnswering
>>> # Download configuratio


AutoModelForQuestionAnswering

n from huggingface.co and cache.
>>> config = AutoConfig.from_pretrained("bert-base-cased")
>>> model = AutoModelForQuestionAnswering.from_config(config)  from_pretrained  < source > ( *model_args **kwargs  )   Parameters   pretrained_model_name_or_path (str or os.PathLike) —
Can be either:
A string, the model id of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like bert-base-uncased, or namespaced under a
user or organization name, like dbmdz/bert-base-german-cased.
A path to a directory containing model weights saved using
save_pretrained(), e.g., ./my_model_directory/.
A path or url to a tensorflow index checkpoint file (e.g, ./tf_model/model.ckpt.index). In
this case, from_tf should be set to True and a configuration object should be provided as
config argument. This loading path is slower than converting the TensorFlow checkpoint in a
PyTorch model using the provided conversion scripts an


AutoModelForQuestionAnswering

d loading the PyTorch model afterwards.
   model_args (additional positional arguments, optional) —
Will be passed along to the underlying model __init__() method.   config (PretrainedConfig, optional) —
Configuration for the model to use instead of an automatically loaded configuration. Configuration can
be automatically loaded when:
The model is a model provided by the library (loaded with the model id string of a pretrained
model).
The model was saved using save_pretrained() and is reloaded by supplying the
save directory.
The model is loaded by supplying a local directory as pretrained_model_name_or_path and a
configuration JSON file named config.json is found in the directory.
   state_dict (Dict[str, torch.Tensor], optional) —
A state dictionary to use instead of a state dictionary loaded from saved weights file.
This option can be used if you want to create a model from a pretrained configuration but load your own
weights. In this case though, you should


AutoModelForQuestionAnswering

 check if using save_pretrained() and
from_pretrained() is not a simpler option.   cache_dir (str or os.PathLike, optional) —
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.   from_tf (bool, optional, defaults to False) —
Load the model weights from a TensorFlow checkpoint save file (see docstring of
pretrained_model_name_or_path argument).   force_download (bool, optional, defaults to False) —
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.   resume_download (bool, optional, defaults to False) —
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.   proxies (Dict[str, str], optional) —
A dictionary of proxy servers to use by protocol or endpoint, e.g., {'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}. The proxies are used o


AutoModelForQuestionAnswering

n each request.   output_loading_info(bool, optional, defaults to False) —
Whether ot not to also return a dictionary containing missing keys, unexpected keys and error messages.   local_files_only(bool, optional, defaults to False) —
Whether or not to only look at local files (e.g., not try downloading the model).   revision (str, optional, defaults to "main") —
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so revision can be any
identifier allowed by git.   trust_remote_code (bool, optional, defaults to False) —
Whether or not to allow for custom models defined on the Hub in their own modeling files. This option
should only be set to True for repositories you trust and in which you have read the code, as it will
execute code present on the Hub on your local machine.   code_revision (str, optional, defaults to "main") —
The specif


AutoModelForQuestionAnswering

ic revision to use for the code on the Hub, if the code leaves in a different repository than
the rest of the model. It can be a branch name, a tag name, or a commit id, since we use a git-based
system for storing models and other artifacts on huggingface.co, so revision can be any identifier
allowed by git.   kwargs (additional keyword arguments, optional) —
Can be used to update the configuration object (after it being loaded) and initiate the model (e.g.,
output_attentions=True). Behaves differently depending on whether a config is provided or
automatically loaded:
If a configuration is provided with config, **kwargs will be directly passed to the
underlying model’s __init__ method (we assume all relevant updates to the configuration have
already been done)
If a configuration is not provided, kwargs will be first passed to the configuration class
initialization function (from_pretrained()). Each key of kwargs that
corresponds to a configuration attribute wil


AutoModelForQuestionAnswering

l be used to override said attribute with the
supplied kwargs value. Remaining keys that do not correspond to any configuration attribute
will be passed to the underlying model’s __init__ function.
    Instantiate one of the model classes of the library (with a question answering head) from a pretrained model. The model class to instantiate is selected based on the model_type property of the config object (either
passed as an argument or loaded from pretrained_model_name_or_path if possible), or when it’s missing, by
falling back to using pattern matching on pretrained_model_name_or_path: albert — AlbertForQuestionAnswering (ALBERT model) bart — BartForQuestionAnswering (BART model) bert — BertForQuestionAnswering (BERT model) big_bird — BigBirdForQuestionAnswering (BigBird model) bigbird_pegasus — BigBirdPegasusForQuestionAnswering (BigBird-Pegasus model) bloom — BloomForQuestionAnswering (BLOOM model) camembert — CamembertForQuestionAnswering (CamemBERT model


AutoModelForQuestionAnswering

) canine — CanineForQuestionAnswering (CANINE model) convbert — ConvBertForQuestionAnswering (ConvBERT model) data2vec-text — Data2VecTextForQuestionAnswering (Data2VecText model) deberta — DebertaForQuestionAnswering (DeBERTa model) deberta-v2 — DebertaV2ForQuestionAnswering (DeBERTa-v2 model) distilbert — DistilBertForQuestionAnswering (DistilBERT model) electra — ElectraForQuestionAnswering (ELECTRA model) ernie — ErnieForQuestionAnswering (ERNIE model) ernie_m — ErnieMForQuestionAnswering (ErnieM model) falcon — FalconForQuestionAnswering (Falcon model) flaubert — FlaubertForQuestionAnsweringSimple (FlauBERT model) fnet — FNetForQuestionAnswering (FNet model) funnel — FunnelForQuestionAnswering (Funnel Transformer model) gpt2 — GPT2ForQuestionAnswering (OpenAI GPT-2 model) gpt_neo — GPTNeoForQuestionAnswering (GPT Neo model) gpt_neox — GPTNeoXForQuestionAnswering (GPT NeoX model) gptj — GPTJForQuestionAnswering (GPT-J model) ibert — IBertForQuestionAnswerin


AutoModelForQuestionAnswering

g (I-BERT model) layoutlmv2 — LayoutLMv2ForQuestionAnswering (LayoutLMv2 model) layoutlmv3 — LayoutLMv3ForQuestionAnswering (LayoutLMv3 model) led — LEDForQuestionAnswering (LED model) lilt — LiltForQuestionAnswering (LiLT model) longformer — LongformerForQuestionAnswering (Longformer model) luke — LukeForQuestionAnswering (LUKE model) lxmert — LxmertForQuestionAnswering (LXMERT model) markuplm — MarkupLMForQuestionAnswering (MarkupLM model) mbart — MBartForQuestionAnswering (mBART model) mega — MegaForQuestionAnswering (MEGA model) megatron-bert — MegatronBertForQuestionAnswering (Megatron-BERT model) mobilebert — MobileBertForQuestionAnswering (MobileBERT model) mpnet — MPNetForQuestionAnswering (MPNet model) mpt — MptForQuestionAnswering (MPT model) mra — MraForQuestionAnswering (MRA model) mt5 — MT5ForQuestionAnswering (MT5 model) mvp — MvpForQuestionAnswering (MVP model) nezha — NezhaForQuestionAnswering (Nezha model) nystromformer — NystromformerForQuesti


AutoModelForQuestionAnswering

onAnswering (Nyströmformer model) opt — OPTForQuestionAnswering (OPT model) qdqbert — QDQBertForQuestionAnswering (QDQBert model) reformer — ReformerForQuestionAnswering (Reformer model) rembert — RemBertForQuestionAnswering (RemBERT model) roberta — RobertaForQuestionAnswering (RoBERTa model) roberta-prelayernorm — RobertaPreLayerNormForQuestionAnswering (RoBERTa-PreLayerNorm model) roc_bert — RoCBertForQuestionAnswering (RoCBert model) roformer — RoFormerForQuestionAnswering (RoFormer model) splinter — SplinterForQuestionAnswering (Splinter model) squeezebert — SqueezeBertForQuestionAnswering (SqueezeBERT model) t5 — T5ForQuestionAnswering (T5 model) umt5 — UMT5ForQuestionAnswering (UMT5 model) xlm — XLMForQuestionAnsweringSimple (XLM model) xlm-roberta — XLMRobertaForQuestionAnswering (XLM-RoBERTa model) xlm-roberta-xl — XLMRobertaXLForQuestionAnswering (XLM-RoBERTa-XL model) xlnet — XLNetForQuestionAnsweringSimple (XLNet model) xmod — XmodForQuestionAnsweri


AutoModelForQuestionAnswering

ng (X-MOD model) yoso — YosoForQuestionAnswering (YOSO model) The model is set in evaluation mode by default using model.eval() (so for instance, dropout modules are
deactivated). To train the model, you should first set it back in training mode with model.train()  Examples:   Copied >>> from transformers import AutoConfig, AutoModelForQuestionAnswering
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForQuestionAnswering.from_pretrained("bert-base-cased")
>>> # Update configuration during loading
>>> model = AutoModelForQuestionAnswering.from_pretrained("bert-base-cased", output_attentions=True)
>>> model.config.output_attentions
True
>>> # Loading from a TF checkpoint file instead of a PyTorch model (slower)
>>> config = AutoConfig.from_pretrained("./tf_model/bert_tf_model_config.json")
>>> model = AutoModelForQuestionAnswering.from_pretrained(
...     "./tf_model/bert_tf_checkpoint.ckpt.index", from_tf=True, config=c


TFAutoModelForQuestionAnswering

class transformers.TFAutoModelForQuestionAnswering  < source > ( *args **kwargs  )    This is a generic model class that will be instantiated as one of the model classes of the library (with a question answering head) when created
with the from_pretrained() class method or the from_config() class
method. This class cannot be instantiated directly using __init__() (throws an error).  from_config  < source > ( **kwargs  )   Parameters   config (PretrainedConfig) —
The model class to instantiate is selected based on the configuration class:
AlbertConfig configuration class: TFAlbertForQuestionAnswering (ALBERT model)
BertConfig configuration class: TFBertForQuestionAnswering (BERT model)
CamembertConfig configuration class: TFCamembertForQuestionAnswering (CamemBERT model)
ConvBertConfig configuration class: TFConvBertForQuestionAnswering (ConvBERT model)
DebertaConfig configuration class: TFDebertaForQuestionAnswering (DeBERTa model)
DebertaV2Config configuration class: TFDebertaV2For


TFAutoModelForQuestionAnswering

QuestionAnswering (DeBERTa-v2 model)
DistilBertConfig configuration class: TFDistilBertForQuestionAnswering (DistilBERT model)
ElectraConfig configuration class: TFElectraForQuestionAnswering (ELECTRA model)
FlaubertConfig configuration class: TFFlaubertForQuestionAnsweringSimple (FlauBERT model)
FunnelConfig configuration class: TFFunnelForQuestionAnswering (Funnel Transformer model)
GPTJConfig configuration class: TFGPTJForQuestionAnswering (GPT-J model)
LayoutLMv3Config configuration class: TFLayoutLMv3ForQuestionAnswering (LayoutLMv3 model)
LongformerConfig configuration class: TFLongformerForQuestionAnswering (Longformer model)
MPNetConfig configuration class: TFMPNetForQuestionAnswering (MPNet model)
MobileBertConfig configuration class: TFMobileBertForQuestionAnswering (MobileBERT model)
RemBertConfig configuration class: TFRemBertForQuestionAnswering (RemBERT model)
RoFormerConfig configuration class: TFRoFormerForQuestionAnswering (RoFormer model)
RobertaConfig configuratio


TFAutoModelForQuestionAnswering

n class: TFRobertaForQuestionAnswering (RoBERTa model)
RobertaPreLayerNormConfig configuration class: TFRobertaPreLayerNormForQuestionAnswering (RoBERTa-PreLayerNorm model)
XLMConfig configuration class: TFXLMForQuestionAnsweringSimple (XLM model)
XLMRobertaConfig configuration class: TFXLMRobertaForQuestionAnswering (XLM-RoBERTa model)
XLNetConfig configuration class: TFXLNetForQuestionAnsweringSimple (XLNet model)
    Instantiates one of the model classes of the library (with a question answering head) from a configuration. Note:
Loading a model from its configuration file does not load the model weights. It only affects the
model’s configuration. Use from_pretrained() to load the model weights.  Examples:   Copied >>> from transformers import AutoConfig, TFAutoModelForQuestionAnswering
>>> # Download configuration from huggingface.co and cache.
>>> config = AutoConfig.from_pretrained("bert-base-cased")
>>> model = TFAutoModelForQuestionAnswering.from_config(config)  from_pretrain


TFAutoModelForQuestionAnswering

ed  < source > ( *model_args **kwargs  )   Parameters   pretrained_model_name_or_path (str or os.PathLike) —
Can be either:
A string, the model id of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like bert-base-uncased, or namespaced under a
user or organization name, like dbmdz/bert-base-german-cased.
A path to a directory containing model weights saved using
save_pretrained(), e.g., ./my_model_directory/.
A path or url to a PyTorch state_dict save file (e.g, ./pt_model/pytorch_model.bin). In this
case, from_pt should be set to True and a configuration object should be provided as config
argument. This loading path is slower than converting the PyTorch model in a TensorFlow model
using the provided conversion scripts and loading the TensorFlow model afterwards.
   model_args (additional positional arguments, optional) —
Will be passed along to the underlying model __init__() method.   config (PretrainedConfig, opt


TFAutoModelForQuestionAnswering

ional) —
Configuration for the model to use instead of an automatically loaded configuration. Configuration can
be automatically loaded when:
The model is a model provided by the library (loaded with the model id string of a pretrained
model).
The model was saved using save_pretrained() and is reloaded by supplying the
save directory.
The model is loaded by supplying a local directory as pretrained_model_name_or_path and a
configuration JSON file named config.json is found in the directory.
   cache_dir (str or os.PathLike, optional) —
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.   from_pt (bool, optional, defaults to False) —
Load the model weights from a PyTorch checkpoint save file (see docstring of
pretrained_model_name_or_path argument).   force_download (bool, optional, defaults to False) —
Whether or not to force the (re-)download of the model weights and configuration files, overriding the


TFAutoModelForQuestionAnswering

cached versions if they exist.   resume_download (bool, optional, defaults to False) —
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.   proxies (Dict[str, str], optional) —
A dictionary of proxy servers to use by protocol or endpoint, e.g., {'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}. The proxies are used on each request.   output_loading_info(bool, optional, defaults to False) —
Whether ot not to also return a dictionary containing missing keys, unexpected keys and error messages.   local_files_only(bool, optional, defaults to False) —
Whether or not to only look at local files (e.g., not try downloading the model).   revision (str, optional, defaults to "main") —
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so revision can be any
identifier allowed by git.   trust_remo


TFAutoModelForQuestionAnswering

te_code (bool, optional, defaults to False) —
Whether or not to allow for custom models defined on the Hub in their own modeling files. This option
should only be set to True for repositories you trust and in which you have read the code, as it will
execute code present on the Hub on your local machine.   code_revision (str, optional, defaults to "main") —
The specific revision to use for the code on the Hub, if the code leaves in a different repository than
the rest of the model. It can be a branch name, a tag name, or a commit id, since we use a git-based
system for storing models and other artifacts on huggingface.co, so revision can be any identifier
allowed by git.   kwargs (additional keyword arguments, optional) —
Can be used to update the configuration object (after it being loaded) and initiate the model (e.g.,
output_attentions=True). Behaves differently depending on whether a config is provided or
automatically loaded:
If a configuration is provided with config, **kwargs


TFAutoModelForQuestionAnswering

will be directly passed to the
underlying model’s __init__ method (we assume all relevant updates to the configuration have
already been done)
If a configuration is not provided, kwargs will be first passed to the configuration class
initialization function (from_pretrained()). Each key of kwargs that
corresponds to a configuration attribute will be used to override said attribute with the
supplied kwargs value. Remaining keys that do not correspond to any configuration attribute
will be passed to the underlying model’s __init__ function.
    Instantiate one of the model classes of the library (with a question answering head) from a pretrained model. The model class to instantiate is selected based on the model_type property of the config object (either
passed as an argument or loaded from pretrained_model_name_or_path if possible), or when it’s missing, by
falling back to using pattern matching on pretrained_model_name_or_path: albert — TFAlbertForQuestionAnswering (ALBERT model) b


TFAutoModelForQuestionAnswering

ert — TFBertForQuestionAnswering (BERT model) camembert — TFCamembertForQuestionAnswering (CamemBERT model) convbert — TFConvBertForQuestionAnswering (ConvBERT model) deberta — TFDebertaForQuestionAnswering (DeBERTa model) deberta-v2 — TFDebertaV2ForQuestionAnswering (DeBERTa-v2 model) distilbert — TFDistilBertForQuestionAnswering (DistilBERT model) electra — TFElectraForQuestionAnswering (ELECTRA model) flaubert — TFFlaubertForQuestionAnsweringSimple (FlauBERT model) funnel — TFFunnelForQuestionAnswering (Funnel Transformer model) gptj — TFGPTJForQuestionAnswering (GPT-J model) layoutlmv3 — TFLayoutLMv3ForQuestionAnswering (LayoutLMv3 model) longformer — TFLongformerForQuestionAnswering (Longformer model) mobilebert — TFMobileBertForQuestionAnswering (MobileBERT model) mpnet — TFMPNetForQuestionAnswering (MPNet model) rembert — TFRemBertForQuestionAnswering (RemBERT model) roberta — TFRobertaForQuestionAnswering (RoBERTa model) roberta-prelayernorm — TFRobertaPreLayerNormForQuestio


TFAutoModelForQuestionAnswering

nAnswering (RoBERTa-PreLayerNorm model) roformer — TFRoFormerForQuestionAnswering (RoFormer model) xlm — TFXLMForQuestionAnsweringSimple (XLM model) xlm-roberta — TFXLMRobertaForQuestionAnswering (XLM-RoBERTa model) xlnet — TFXLNetForQuestionAnsweringSimple (XLNet model)  Examples:   Copied >>> from transformers import AutoConfig, TFAutoModelForQuestionAnswering
>>> # Download model and configuration from huggingface.co and cache.
>>> model = TFAutoModelForQuestionAnswering.from_pretrained("bert-base-cased")
>>> # Update configuration during loading
>>> model = TFAutoModelForQuestionAnswering.from_pretrained("bert-base-cased", output_attentions=True)
>>> model.config.output_attentions
True
>>> # Loading from a PyTorch checkpoint file instead of a TensorFlow model (slower)
>>> config = AutoConfig.from_pretrained("./pt_model/bert_pt_model_config.json")
>>> model = TFAutoModelForQuestionAnswering.from_pretrained(
...     "./pt_model/bert_pytorch_model.bin", from_pt=True, config=config


FlaxAutoModelForQuestionAnswering

class transformers.FlaxAutoModelForQuestionAnswering  < source > ( *args **kwargs  )    This is a generic model class that will be instantiated as one of the model classes of the library (with a question answering head) when created
with the from_pretrained() class method or the from_config() class
method. This class cannot be instantiated directly using __init__() (throws an error).  from_config  < source > ( **kwargs  )   Parameters   config (PretrainedConfig) —
The model class to instantiate is selected based on the configuration class:
AlbertConfig configuration class: FlaxAlbertForQuestionAnswering (ALBERT model)
BartConfig configuration class: FlaxBartForQuestionAnswering (BART model)
BertConfig configuration class: FlaxBertForQuestionAnswering (BERT model)
BigBirdConfig configuration class: FlaxBigBirdForQuestionAnswering (BigBird model)
DistilBertConfig configuration class: FlaxDistilBertForQuestionAnswering (Dis


FlaxAutoModelForQuestionAnswering

tilBERT model)
ElectraConfig configuration class: FlaxElectraForQuestionAnswering (ELECTRA model)
MBartConfig configuration class: FlaxMBartForQuestionAnswering (mBART model)
RoFormerConfig configuration class: FlaxRoFormerForQuestionAnswering (RoFormer model)
RobertaConfig configuration class: FlaxRobertaForQuestionAnswering (RoBERTa model)
RobertaPreLayerNormConfig configuration class: FlaxRobertaPreLayerNormForQuestionAnswering (RoBERTa-PreLayerNorm model)
XLMRobertaConfig configuration class: FlaxXLMRobertaForQuestionAnswering (XLM-RoBERTa model)
    Instantiates one of the model classes of the library (with a question answering head) from a configuration. Note:
Loading a model from its configuration file does not load the model weights. It only affects the
model’s configuration. Use from_pretrained() to load the model weights.  Examples:   Copied >>> from transformers import AutoConfig, FlaxAutoModelForQuestionAnswe


FlaxAutoModelForQuestionAnswering

ring
>>> # Download configuration from huggingface.co and cache.
>>> config = AutoConfig.from_pretrained("bert-base-cased")
>>> model = FlaxAutoModelForQuestionAnswering.from_config(config)  from_pretrained  < source > ( *model_args **kwargs  )   Parameters   pretrained_model_name_or_path (str or os.PathLike) —
Can be either:
A string, the model id of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like bert-base-uncased, or namespaced under a
user or organization name, like dbmdz/bert-base-german-cased.
A path to a directory containing model weights saved using
save_pretrained(), e.g., ./my_model_directory/.
A path or url to a PyTorch state_dict save file (e.g, ./pt_model/pytorch_model.bin). In this
case, from_pt should be set to True and a configuration object should be provided as config
argument. This loading path is slower than converting the PyTorch


FlaxAutoModelForQuestionAnswering

 model in a TensorFlow model
using the provided conversion scripts and loading the TensorFlow model afterwards.
   model_args (additional positional arguments, optional) —
Will be passed along to the underlying model __init__() method.   config (PretrainedConfig, optional) —
Configuration for the model to use instead of an automatically loaded configuration. Configuration can
be automatically loaded when:
The model is a model provided by the library (loaded with the model id string of a pretrained
model).
The model was saved using save_pretrained() and is reloaded by supplying the
save directory.
The model is loaded by supplying a local directory as pretrained_model_name_or_path and a
configuration JSON file named config.json is found in the directory.
   cache_dir (str or os.PathLike, optional) —
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be


FlaxAutoModelForQuestionAnswering

 used.   from_pt (bool, optional, defaults to False) —
Load the model weights from a PyTorch checkpoint save file (see docstring of
pretrained_model_name_or_path argument).   force_download (bool, optional, defaults to False) —
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.   resume_download (bool, optional, defaults to False) —
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.   proxies (Dict[str, str], optional) —
A dictionary of proxy servers to use by protocol or endpoint, e.g., {'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}. The proxies are used on each request.   output_loading_info(bool, optional, defaults to False) —
Whether ot not to also return a dictionary containing missing keys, unexpected keys and error messages.   local_files_only(bool, optional,


FlaxAutoModelForQuestionAnswering

 defaults to False) —
Whether or not to only look at local files (e.g., not try downloading the model).   revision (str, optional, defaults to "main") —
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so revision can be any
identifier allowed by git.   trust_remote_code (bool, optional, defaults to False) —
Whether or not to allow for custom models defined on the Hub in their own modeling files. This option
should only be set to True for repositories you trust and in which you have read the code, as it will
execute code present on the Hub on your local machine.   code_revision (str, optional, defaults to "main") —
The specific revision to use for the code on the Hub, if the code leaves in a different repository than
the rest of the model. It can be a branch name, a tag name, or a commit id, si


FlaxAutoModelForQuestionAnswering

nce we use a git-based
system for storing models and other artifacts on huggingface.co, so revision can be any identifier
allowed by git.   kwargs (additional keyword arguments, optional) —
Can be used to update the configuration object (after it being loaded) and initiate the model (e.g.,
output_attentions=True). Behaves differently depending on whether a config is provided or
automatically loaded:
If a configuration is provided with config, **kwargs will be directly passed to the
underlying model’s __init__ method (we assume all relevant updates to the configuration have
already been done)
If a configuration is not provided, kwargs will be first passed to the configuration class
initialization function (from_pretrained()). Each key of kwargs that
corresponds to a configuration attribute will be used to override said attribute with the
supplied kwargs value. Remaining keys that do not correspond to any configuration att


FlaxAutoModelForQuestionAnswering

ribute
will be passed to the underlying model’s __init__ function.
    Instantiate one of the model classes of the library (with a question answering head) from a pretrained model. The model class to instantiate is selected based on the model_type property of the config object (either
passed as an argument or loaded from pretrained_model_name_or_path if possible), or when it’s missing, by
falling back to using pattern matching on pretrained_model_name_or_path: albert — FlaxAlbertForQuestionAnswering (ALBERT model) bart — FlaxBartForQuestionAnswering (BART model) bert — FlaxBertForQuestionAnswering (BERT model) big_bird — FlaxBigBirdForQuestionAnswering (BigBird model) distilbert — FlaxDistilBertForQuestionAnswering (DistilBERT model) electra — FlaxElectraForQuestionAnswering (ELECTRA model) mbart — FlaxMBartForQuestionAnswering (mBART model) roberta — FlaxRobertaForQuestionAnswering (RoBERTa model) roberta-prelayernorm —


FlaxAutoModelForQuestionAnswering

 FlaxRobertaPreLayerNormForQuestionAnswering (RoBERTa-PreLayerNorm model) roformer — FlaxRoFormerForQuestionAnswering (RoFormer model) xlm-roberta — FlaxXLMRobertaForQuestionAnswering (XLM-RoBERTa model)  Examples:   Copied >>> from transformers import AutoConfig, FlaxAutoModelForQuestionAnswering
>>> # Download model and configuration from huggingface.co and cache.
>>> model = FlaxAutoModelForQuestionAnswering.from_pretrained("bert-base-cased")
>>> # Update configuration during loading
>>> model = FlaxAutoModelForQuestionAnswering.from_pretrained("bert-base-cased", output_attentions=True)
>>> model.config.output_attentions
True
>>> # Loading from a PyTorch checkpoint file instead of a TensorFlow model (slower)
>>> config = AutoConfig.from_pretrained("./pt_model/bert_pt_model_config.json")
>>> model = FlaxAutoModelForQuestionAnswering.from_pretrained(
...     "./pt_model/bert_pytorch_model.bin", from_pt=True, config=conf


AutoModelForDepthEstimation

class transformers.AutoModelForDepthEstimation  < source > ( *args **kwargs  )    This is a generic model class that will be instantiated as one of the model classes of the library (with a depth estimation head) when created
with the from_pretrained() class method or the from_config() class
method. This class cannot be instantiated directly using __init__() (throws an error).  from_config  < source > ( **kwargs  )   Parameters   config (PretrainedConfig) —
The model class to instantiate is selected based on the configuration class:
DPTConfig configuration class: DPTForDepthEstimation (DPT model)
GLPNConfig configuration class: GLPNForDepthEstimation (GLPN model)
    Instantiates one of the model classes of the library (with a depth estimation head) from a configuration. Note:
Loading a model from its configuration file does not load the model weights. It only affects the
model’s configuration. Use from_pretrained() to load the m


AutoModelForDepthEstimation

odel weights.  Examples:   Copied >>> from transformers import AutoConfig, AutoModelForDepthEstimation
>>> # Download configuration from huggingface.co and cache.
>>> config = AutoConfig.from_pretrained("bert-base-cased")
>>> model = AutoModelForDepthEstimation.from_config(config)  from_pretrained  < source > ( *model_args **kwargs  )   Parameters   pretrained_model_name_or_path (str or os.PathLike) —
Can be either:
A string, the model id of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like bert-base-uncased, or namespaced under a
user or organization name, like dbmdz/bert-base-german-cased.
A path to a directory containing model weights saved using
save_pretrained(), e.g., ./my_model_directory/.
A path or url to a tensorflow index checkpoint file (e.g, ./tf_model/model.ckpt.index). In
this case, from_tf should be set to True and a configuration object should