source
stringclasses 470
values | url
stringlengths 49
167
| file_type
stringclasses 1
value | chunk
stringlengths 1
512
| chunk_id
stringlengths 5
9
|
---|---|---|---|---|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
sequence_length)`.
Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.
models.xlnet.modeling_xlnet.XLNetForSequenceClassificationOutput
Output type of [`XLNetForSequenceClassification`].
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `label` is provided):
|
333_8_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `label` is provided):
Classification (or regression if config.num_labels==1) loss.
logits (`torch.FloatTensor` of shape `(batch_size, config.num_labels)`):
Classification (or regression if config.num_labels==1) scores (before SoftMax).
mems (`List[torch.FloatTensor]` of length `config.n_layers`):
Contains pre-computed hidden-states. Can be used (see `mems` input) to speed up sequential decoding. The
|
333_8_8
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Contains pre-computed hidden-states. Can be used (see `mems` input) to speed up sequential decoding. The
token ids which have their past given to this model should not be passed as `input_ids` as they have
already been computed.
hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
|
333_8_9
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
shape `(batch_size, sequence_length, hidden_size)`.
Hidden-states of the model at the output of each layer plus the initial embedding outputs.
attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`):
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
|
333_8_10
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
sequence_length)`.
Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.
models.xlnet.modeling_xlnet.XLNetForMultipleChoiceOutput
Output type of [`XLNetForMultipleChoice`].
Args:
loss (`torch.FloatTensor` of shape *(1,)*, *optional*, returned when `labels` is provided):
Classification loss.
|
333_8_11
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Args:
loss (`torch.FloatTensor` of shape *(1,)*, *optional*, returned when `labels` is provided):
Classification loss.
logits (`torch.FloatTensor` of shape `(batch_size, num_choices)`):
*num_choices* is the second dimension of the input tensors. (see *input_ids* above).
Classification scores (before SoftMax).
mems (`List[torch.FloatTensor]` of length `config.n_layers`):
Contains pre-computed hidden-states. Can be used (see `mems` input) to speed up sequential decoding. The
|
333_8_12
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Contains pre-computed hidden-states. Can be used (see `mems` input) to speed up sequential decoding. The
token ids which have their past given to this model should not be passed as `input_ids` as they have
already been computed.
hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
|
333_8_13
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
shape `(batch_size, sequence_length, hidden_size)`.
Hidden-states of the model at the output of each layer plus the initial embedding outputs.
attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`):
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
|
333_8_14
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
sequence_length)`.
Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.
models.xlnet.modeling_xlnet.XLNetForTokenClassificationOutput
Output type of [`XLNetForTokenClassificationOutput`].
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) :
Classification loss.
|
333_8_15
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) :
Classification loss.
logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.num_labels)`):
Classification scores (before SoftMax).
mems (`List[torch.FloatTensor]` of length `config.n_layers`):
Contains pre-computed hidden-states. Can be used (see `mems` input) to speed up sequential decoding. The
|
333_8_16
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Contains pre-computed hidden-states. Can be used (see `mems` input) to speed up sequential decoding. The
token ids which have their past given to this model should not be passed as `input_ids` as they have
already been computed.
hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
|
333_8_17
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
shape `(batch_size, sequence_length, hidden_size)`.
Hidden-states of the model at the output of each layer plus the initial embedding outputs.
attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`):
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
|
333_8_18
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
sequence_length)`.
Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.
models.xlnet.modeling_xlnet.XLNetForQuestionAnsweringSimpleOutput
Output type of [`XLNetForQuestionAnsweringSimple`].
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
|
333_8_19
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.
start_logits (`torch.FloatTensor` of shape `(batch_size, sequence_length,)`):
Span-start scores (before SoftMax).
end_logits (`torch.FloatTensor` of shape `(batch_size, sequence_length,)`):
Span-end scores (before SoftMax).
mems (`List[torch.FloatTensor]` of length `config.n_layers`):
|
333_8_20
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Span-end scores (before SoftMax).
mems (`List[torch.FloatTensor]` of length `config.n_layers`):
Contains pre-computed hidden-states. Can be used (see `mems` input) to speed up sequential decoding. The
token ids which have their past given to this model should not be passed as `input_ids` as they have
already been computed.
hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
|
333_8_21
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
shape `(batch_size, sequence_length, hidden_size)`.
Hidden-states of the model at the output of each layer plus the initial embedding outputs.
attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`):
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
|
333_8_22
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
sequence_length)`.
Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.
models.xlnet.modeling_xlnet.XLNetForQuestionAnsweringOutput
Output type of [`XLNetForQuestionAnswering`].
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned if both `start_positions` and `end_positions` are provided):
|
333_8_23
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned if both `start_positions` and `end_positions` are provided):
Classification loss as the sum of start token, end token (and is_impossible if provided) classification
losses.
start_top_log_probs (`torch.FloatTensor` of shape `(batch_size, config.start_n_top)`, *optional*, returned if `start_positions` or `end_positions` is not provided):
Log probabilities for the top config.start_n_top start token possibilities (beam-search).
|
333_8_24
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Log probabilities for the top config.start_n_top start token possibilities (beam-search).
start_top_index (`torch.LongTensor` of shape `(batch_size, config.start_n_top)`, *optional*, returned if `start_positions` or `end_positions` is not provided):
Indices for the top config.start_n_top start token possibilities (beam-search).
end_top_log_probs (`torch.FloatTensor` of shape `(batch_size, config.start_n_top * config.end_n_top)`, *optional*, returned if `start_positions` or `end_positions` is not provided):
|
333_8_25
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Log probabilities for the top `config.start_n_top * config.end_n_top` end token possibilities
(beam-search).
end_top_index (`torch.LongTensor` of shape `(batch_size, config.start_n_top * config.end_n_top)`, *optional*, returned if `start_positions` or `end_positions` is not provided):
Indices for the top `config.start_n_top * config.end_n_top` end token possibilities (beam-search).
|
333_8_26
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Indices for the top `config.start_n_top * config.end_n_top` end token possibilities (beam-search).
cls_logits (`torch.FloatTensor` of shape `(batch_size,)`, *optional*, returned if `start_positions` or `end_positions` is not provided):
Log probabilities for the `is_impossible` label of the answers.
mems (`List[torch.FloatTensor]` of length `config.n_layers`):
Contains pre-computed hidden-states. Can be used (see `mems` input) to speed up sequential decoding. The
|
333_8_27
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Contains pre-computed hidden-states. Can be used (see `mems` input) to speed up sequential decoding. The
token ids which have their past given to this model should not be passed as `input_ids` as they have
already been computed.
hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
|
333_8_28
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
shape `(batch_size, sequence_length, hidden_size)`.
Hidden-states of the model at the output of each layer plus the initial embedding outputs.
attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`):
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
|
333_8_29
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
sequence_length)`.
Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.
[[autodoc]] models.xlnet.modeling_tf_xlnet.TFXLNetModelOutput:
modeling_tf_xlnet requires the TensorFlow library but it was not found in your environment.
However, we were able to find a PyTorch installation. PyTorch classes do not begin
|
333_8_30
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
However, we were able to find a PyTorch installation. PyTorch classes do not begin
with "TF", but are otherwise identically named to our TF classes.
If you want to use PyTorch, please use those classes instead!
If you really do want to use TensorFlow, please follow the instructions on the
installation page https://www.tensorflow.org/install that match your environment.
[[autodoc]] models.xlnet.modeling_tf_xlnet.TFXLNetLMHeadModelOutput:
|
333_8_31
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
[[autodoc]] models.xlnet.modeling_tf_xlnet.TFXLNetLMHeadModelOutput:
modeling_tf_xlnet requires the TensorFlow library but it was not found in your environment.
However, we were able to find a PyTorch installation. PyTorch classes do not begin
with "TF", but are otherwise identically named to our TF classes.
If you want to use PyTorch, please use those classes instead!
If you really do want to use TensorFlow, please follow the instructions on the
|
333_8_32
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
If you really do want to use TensorFlow, please follow the instructions on the
installation page https://www.tensorflow.org/install that match your environment.
[[autodoc]] models.xlnet.modeling_tf_xlnet.TFXLNetForSequenceClassificationOutput:
modeling_tf_xlnet requires the TensorFlow library but it was not found in your environment.
However, we were able to find a PyTorch installation. PyTorch classes do not begin
with "TF", but are otherwise identically named to our TF classes.
|
333_8_33
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
with "TF", but are otherwise identically named to our TF classes.
If you want to use PyTorch, please use those classes instead!
If you really do want to use TensorFlow, please follow the instructions on the
installation page https://www.tensorflow.org/install that match your environment.
[[autodoc]] models.xlnet.modeling_tf_xlnet.TFXLNetForMultipleChoiceOutput:
modeling_tf_xlnet requires the TensorFlow library but it was not found in your environment.
|
333_8_34
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
modeling_tf_xlnet requires the TensorFlow library but it was not found in your environment.
However, we were able to find a PyTorch installation. PyTorch classes do not begin
with "TF", but are otherwise identically named to our TF classes.
If you want to use PyTorch, please use those classes instead!
If you really do want to use TensorFlow, please follow the instructions on the
installation page https://www.tensorflow.org/install that match your environment.
|
333_8_35
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
installation page https://www.tensorflow.org/install that match your environment.
[[autodoc]] models.xlnet.modeling_tf_xlnet.TFXLNetForTokenClassificationOutput:
modeling_tf_xlnet requires the TensorFlow library but it was not found in your environment.
However, we were able to find a PyTorch installation. PyTorch classes do not begin
with "TF", but are otherwise identically named to our TF classes.
If you want to use PyTorch, please use those classes instead!
|
333_8_36
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
If you want to use PyTorch, please use those classes instead!
If you really do want to use TensorFlow, please follow the instructions on the
installation page https://www.tensorflow.org/install that match your environment.
[[autodoc]] models.xlnet.modeling_tf_xlnet.TFXLNetForQuestionAnsweringSimpleOutput:
modeling_tf_xlnet requires the TensorFlow library but it was not found in your environment.
However, we were able to find a PyTorch installation. PyTorch classes do not begin
|
333_8_37
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet-specific-outputs
|
.md
|
However, we were able to find a PyTorch installation. PyTorch classes do not begin
with "TF", but are otherwise identically named to our TF classes.
If you want to use PyTorch, please use those classes instead!
If you really do want to use TensorFlow, please follow the instructions on the
installation page https://www.tensorflow.org/install that match your environment.
<frameworkcontent>
<pt>
|
333_8_38
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetmodel
|
.md
|
The bare XLNet Model transformer outputting raw hidden-states without any specific head on top.
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
333_9_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetmodel
|
.md
|
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
config ([`XLNetConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
|
333_9_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetmodel
|
.md
|
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward
|
333_9_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetlmheadmodel
|
.md
|
XLNet Model with a language modeling head on top (linear layer with weights tied to the input embeddings).
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
333_10_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetlmheadmodel
|
.md
|
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
config ([`XLNetConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
|
333_10_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetlmheadmodel
|
.md
|
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward
|
333_10_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetforsequenceclassification
|
.md
|
XLNet Model with a sequence classification/regression head on top (a linear layer on top of the pooled output) e.g.
for GLUE tasks.
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
333_11_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetforsequenceclassification
|
.md
|
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
config ([`XLNetConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
|
333_11_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetforsequenceclassification
|
.md
|
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward
|
333_11_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetformultiplechoice
|
.md
|
XLNet Model with a multiple choice classification head on top (a linear layer on top of the pooled output and a
softmax) e.g. for RACE/SWAG tasks.
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
333_12_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetformultiplechoice
|
.md
|
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
config ([`XLNetConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
|
333_12_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetformultiplechoice
|
.md
|
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward
|
333_12_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetfortokenclassification
|
.md
|
XLNet Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for
Named-Entity-Recognition (NER) tasks.
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
333_13_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetfortokenclassification
|
.md
|
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
config ([`XLNetConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
|
333_13_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetfortokenclassification
|
.md
|
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward
|
333_13_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetforquestionansweringsimple
|
.md
|
XLNet Model with a span classification head on top for extractive question-answering tasks like SQuAD (a linear
layers on top of the hidden-states output to compute `span start logits` and `span end logits`).
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)
|
333_14_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetforquestionansweringsimple
|
.md
|
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
config ([`XLNetConfig`]): Model configuration class with all the parameters of the model.
|
333_14_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetforquestionansweringsimple
|
.md
|
and behavior.
Parameters:
config ([`XLNetConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward
|
333_14_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetforquestionanswering
|
.md
|
XLNet Model with a span classification head on top for extractive question-answering tasks like SQuAD (a linear
layers on top of the hidden-states output to compute `span start logits` and `span end logits`).
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)
|
333_15_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetforquestionanswering
|
.md
|
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
config ([`XLNetConfig`]): Model configuration class with all the parameters of the model.
|
333_15_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetforquestionanswering
|
.md
|
and behavior.
Parameters:
config ([`XLNetConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward
</pt>
<tf>
|
333_15_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#tfxlnetmodel
|
.md
|
No docstring available for TFXLNetModel
Methods: call
|
333_16_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#tfxlnetlmheadmodel
|
.md
|
No docstring available for TFXLNetLMHeadModel
Methods: call
|
333_17_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#tfxlnetforsequenceclassification
|
.md
|
No docstring available for TFXLNetForSequenceClassification
Methods: call
|
333_18_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#tfxlnetformultiplechoice
|
.md
|
No docstring available for TFXLNetForMultipleChoice
Methods: call
|
333_19_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#tfxlnetfortokenclassification
|
.md
|
No docstring available for TFXLNetForTokenClassification
Methods: call
|
333_20_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#tfxlnetforquestionansweringsimple
|
.md
|
No docstring available for TFXLNetForQuestionAnsweringSimple
Methods: call
</tf>
</frameworkcontent>
|
333_21_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/
|
.md
|
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
334_0_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/
|
.md
|
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
rendered properly in your Markdown viewer.
-->
|
334_0_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#overview
|
.md
|
The I-JEPA model was proposed in [Image-based Joint-Embedding Predictive Architecture](https://arxiv.org/abs/2301.08243) by Mahmoud Assran, Quentin Duval, Ishan Misra, Piotr Bojanowski, Pascal Vincent, Michael Rabbat, Yann LeCun, Nicolas Ballas.
|
334_1_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#overview
|
.md
|
I-JEPA is a self-supervised learning method that predicts the representations of one part of an image based on other parts of the same image. This approach focuses on learning semantic features without relying on pre-defined invariances from hand-crafted data transformations, which can bias specific tasks, or on filling in pixel-level details, which often leads to less meaningful representations.
The abstract from the paper is the following:
|
334_1_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#overview
|
.md
|
This paper demonstrates an approach for learning highly semantic image representations without relying on hand-crafted data-augmentations. We introduce the Image- based Joint-Embedding Predictive Architecture (I-JEPA), a non-generative approach for self-supervised learning from images. The idea behind I-JEPA is simple: from a single context block, predict the representations of various target blocks in the same image. A core design choice to guide I-JEPA towards producing semantic representations is the
|
334_1_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#overview
|
.md
|
various target blocks in the same image. A core design choice to guide I-JEPA towards producing semantic representations is the masking strategy; specifically, it is crucial to (a) sample tar- get blocks with sufficiently large scale (semantic), and to (b) use a sufficiently informative (spatially distributed) context block. Empirically, when combined with Vision Transform- ers, we find I-JEPA to be highly scalable. For instance, we train a ViT-Huge/14 on ImageNet using 16 A100 GPUs in under 72 hours to
|
334_1_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#overview
|
.md
|
we find I-JEPA to be highly scalable. For instance, we train a ViT-Huge/14 on ImageNet using 16 A100 GPUs in under 72 hours to achieve strong downstream performance across a wide range of tasks, from linear classification to object counting and depth prediction.
|
334_1_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#overview
|
.md
|
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/ijepa_architecture.jpg"
alt="drawing" width="600"/>
<small> I-JEPA architecture. Taken from the <a href="https://arxiv.org/abs/2301.08243">original paper.</a> </small>
This model was contributed by [jmtzt](https://huggingface.co/jmtzt).
The original code can be found [here](https://github.com/facebookresearch/ijepa).
|
334_1_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#how-to-use
|
.md
|
Here is how to use this model for image feature extraction:
```python
import requests
import torch
from PIL import Image
from torch.nn.functional import cosine_similarity
from transformers import AutoModel, AutoProcessor
url_1 = "http://images.cocodataset.org/val2017/000000039769.jpg"
url_2 = "http://images.cocodataset.org/val2017/000000219578.jpg"
image_1 = Image.open(requests.get(url_1, stream=True).raw)
image_2 = Image.open(requests.get(url_2, stream=True).raw)
|
334_2_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#how-to-use
|
.md
|
model_id = "facebook/ijepa_vith14_1k"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModel.from_pretrained(model_id)
@torch.no_grad()
def infer(image):
inputs = processor(image, return_tensors="pt")
outputs = model(**inputs)
return outputs.last_hidden_state.mean(dim=1)
embed_1 = infer(image_1)
embed_2 = infer(image_2)
similarity = cosine_similarity(embed_1, embed_2)
print(similarity)
```
|
334_2_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#resources
|
.md
|
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with I-JEPA.
<PipelineTag pipeline="image-classification"/>
- [`IJepaForImageClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb).
|
334_3_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#resources
|
.md
|
- See also: [Image classification task guide](../tasks/image_classification)
|
334_3_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#ijepaconfig
|
.md
|
This is the configuration class to store the configuration of a [`IJepaModel`]. It is used to instantiate an IJEPA
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configuration to that of the I-JEPA
[google/ijepa-base-patch16-224](https://huggingface.co/google/ijepa-base-patch16-224) architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
334_4_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#ijepaconfig
|
.md
|
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
documentation from [`PretrainedConfig`] for more information.
Args:
hidden_size (`int`, *optional*, defaults to 768):
Dimensionality of the encoder layers and the pooler layer.
num_hidden_layers (`int`, *optional*, defaults to 12):
Number of hidden layers in the Transformer encoder.
num_attention_heads (`int`, *optional*, defaults to 12):
|
334_4_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#ijepaconfig
|
.md
|
Number of hidden layers in the Transformer encoder.
num_attention_heads (`int`, *optional*, defaults to 12):
Number of attention heads for each attention layer in the Transformer encoder.
intermediate_size (`int`, *optional*, defaults to 3072):
Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
|
334_4_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#ijepaconfig
|
.md
|
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
`"relu"`, `"selu"` and `"gelu_new"` are supported.
hidden_dropout_prob (`float`, *optional*, defaults to 0.0):
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
attention_probs_dropout_prob (`float`, *optional*, defaults to 0.0):
The dropout ratio for the attention probabilities.
initializer_range (`float`, *optional*, defaults to 0.02):
|
334_4_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#ijepaconfig
|
.md
|
The dropout ratio for the attention probabilities.
initializer_range (`float`, *optional*, defaults to 0.02):
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
layer_norm_eps (`float`, *optional*, defaults to 1e-12):
The epsilon used by the layer normalization layers.
image_size (`int`, *optional*, defaults to 224):
The size (resolution) of each image.
patch_size (`int`, *optional*, defaults to 16):
The size (resolution) of each patch.
|
334_4_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#ijepaconfig
|
.md
|
The size (resolution) of each image.
patch_size (`int`, *optional*, defaults to 16):
The size (resolution) of each patch.
num_channels (`int`, *optional*, defaults to 3):
The number of input channels.
qkv_bias (`bool`, *optional*, defaults to `True`):
Whether to add a bias to the queries, keys and values.
Example:
```python
>>> from transformers import IJepaConfig, IJepaModel
|
334_4_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#ijepaconfig
|
.md
|
>>> # Initializing a IJEPA ijepa-base-patch16-224 style configuration
>>> configuration = IJepaConfig()
>>> # Initializing a model (with random weights) from the ijepa-base-patch16-224 style configuration
>>> model = IJepaModel(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
```
|
334_4_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#ijepamodel
|
.md
|
The bare IJepa Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.
Parameters:
config ([`IJepaConfig`]): Model configuration class with all the parameters of the model.
|
334_5_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#ijepamodel
|
.md
|
behavior.
Parameters:
config ([`IJepaConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward
|
334_5_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#ijepaforimageclassification
|
.md
|
IJepa Model transformer with an image classification head on top (a linear layer on top of the final hidden states)
e.g. for ImageNet.
<Tip>
Note that it's possible to fine-tune IJepa on higher resolution images than the ones it has been trained on, by
setting `interpolate_pos_encoding` to `True` in the forward of the model. This will interpolate the pre-trained
position embeddings to the higher resolution.
</Tip>
|
334_6_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#ijepaforimageclassification
|
.md
|
position embeddings to the higher resolution.
</Tip>
This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.
Parameters:
config ([`IJepaConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
|
334_6_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/ijepa.md
|
https://huggingface.co/docs/transformers/en/model_doc/ijepa/#ijepaforimageclassification
|
.md
|
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward
|
334_6_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/
|
.md
|
<!--Copyright 2024 The GLM & ZhipuAI team and The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
335_0_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/
|
.md
|
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
rendered properly in your Markdown viewer.
-->
|
335_0_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#overview
|
.md
|
The GLM Model was proposed
in [ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Tools](https://arxiv.org/html/2406.12793v1)
by GLM Team, THUDM & ZhipuAI.
The abstract from the paper is the following:
*We introduce ChatGLM, an evolving family of large language models that we have been developing over time. This report
primarily focuses on the GLM-4 language series, which includes GLM-4, GLM-4-Air, and GLM-4-9B. They represent our most
|
335_1_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#overview
|
.md
|
primarily focuses on the GLM-4 language series, which includes GLM-4, GLM-4-Air, and GLM-4-9B. They represent our most
capable models that are trained with all the insights and lessons gained from the preceding three generations of
ChatGLM. To date, the GLM-4 models are pre-trained on ten trillions of tokens mostly in Chinese and English, along with
a small set of corpus from 24 languages, and aligned primarily for Chinese and English usage. The high-quality alignment
|
335_1_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#overview
|
.md
|
a small set of corpus from 24 languages, and aligned primarily for Chinese and English usage. The high-quality alignment
is achieved via a multi-stage post-training process, which involves supervised fine-tuning and learning from human
feedback. Evaluations show that GLM-4 1) closely rivals or outperforms GPT-4 in terms of general metrics such as MMLU,
GSM8K, MATH, BBH, GPQA, and HumanEval, 2) gets close to GPT-4-Turbo in instruction following as measured by IFEval, 3)
|
335_1_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#overview
|
.md
|
GSM8K, MATH, BBH, GPQA, and HumanEval, 2) gets close to GPT-4-Turbo in instruction following as measured by IFEval, 3)
matches GPT-4 Turbo (128K) and Claude 3 for long context tasks, and 4) outperforms GPT-4 in Chinese alignments as
measured by AlignBench. The GLM-4 All Tools model is further aligned to understand user intent and autonomously decide
when and which tool(s) to use—including web browser, Python interpreter, text-to-image model, and user-defined
|
335_1_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#overview
|
.md
|
when and which tool(s) to use—including web browser, Python interpreter, text-to-image model, and user-defined
functions—to effectively complete complex tasks. In practical applications, it matches and even surpasses GPT-4 All
Tools in tasks like accessing online information via web browsing and solving math problems using Python interpreter.
Over the course, we have open-sourced a series of models, including ChatGLM-6B (three generations), GLM-4-9B (128K, 1M),
|
335_1_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#overview
|
.md
|
Over the course, we have open-sourced a series of models, including ChatGLM-6B (three generations), GLM-4-9B (128K, 1M),
GLM-4V-9B, WebGLM, and CodeGeeX, attracting over 10 million downloads on Hugging face in the year 2023 alone.*
Tips:
- This model was contributed by [THUDM](https://huggingface.co/THUDM). The most recent code can be
found [here](https://github.com/thudm/GLM-4).
|
335_1_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#usage-tips
|
.md
|
`GLM-4` can be found on the [Huggingface Hub](https://huggingface.co/collections/THUDM/glm-4-665fcf188c414b03c2f7e3b7)
In the following, we demonstrate how to use `glm-4-9b-chat` for the inference. Note that we have used the ChatML format for dialog, in this demo we show how to leverage `apply_chat_template` for this purpose.
```python
>>> from transformers import AutoModelForCausalLM, AutoTokenizer
>>> device = "cuda" # the device to load the model onto
|
335_2_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#usage-tips
|
.md
|
>>> model = AutoModelForCausalLM.from_pretrained("THUDM/glm-4-9b-chat", device_map="auto")
>>> tokenizer = AutoTokenizer.from_pretrained("THUDM/glm-4-9b-chat")
>>> prompt = "Give me a short introduction to large language model."
>>> messages = [{"role": "user", "content": prompt}]
>>> text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
>>> model_inputs = tokenizer([text], return_tensors="pt").to(device)
|
335_2_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#usage-tips
|
.md
|
>>> model_inputs = tokenizer([text], return_tensors="pt").to(device)
>>> generated_ids = model.generate(model_inputs.input_ids, max_new_tokens=512, do_sample=True)
>>> generated_ids = [output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)]
>>> response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
```
|
335_2_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmconfig
|
.md
|
This is the configuration class to store the configuration of a [`GlmModel`]. It is used to instantiate an Glm
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configuration to that of the Glm-4-9b-chat.
e.g. [THUDM/glm-4-9b-chat](https://huggingface.co/THUDM/glm-4-9b-chat)
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
335_3_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmconfig
|
.md
|
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
documentation from [`PretrainedConfig`] for more information.
Args:
vocab_size (`int`, *optional*, defaults to 151552):
Vocabulary size of the Glm model. Defines the number of different tokens that can be represented by the
`inputs_ids` passed when calling [`GlmModel`]
hidden_size (`int`, *optional*, defaults to 4096):
Dimension of the hidden representations.
|
335_3_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmconfig
|
.md
|
hidden_size (`int`, *optional*, defaults to 4096):
Dimension of the hidden representations.
intermediate_size (`int`, *optional*, defaults to 13696):
Dimension of the MLP representations.
num_hidden_layers (`int`, *optional*, defaults to 40):
Number of hidden layers in the Transformer decoder.
num_attention_heads (`int`, *optional*, defaults to 32):
Number of attention heads for each attention layer in the Transformer decoder.
num_key_value_heads (`int`, *optional*, defaults to 2):
|
335_3_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmconfig
|
.md
|
num_key_value_heads (`int`, *optional*, defaults to 2):
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
`num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
335_3_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmconfig
|
.md
|
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
by meanpooling all the original heads within that group. For more details checkout [this
paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
`num_attention_heads`.
partial_rotary_factor (`float`, *optional*, defaults to 0.5): The factor of the partial rotary position.
head_dim (`int`, *optional*, defaults to 128):
The attention head dimension.
|
335_3_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmconfig
|
.md
|
head_dim (`int`, *optional*, defaults to 128):
The attention head dimension.
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
The legacy activation function. It is overwritten by the `hidden_activation`.
attention_dropout (`float`, *optional*, defaults to 0.0):
The dropout ratio for the attention probabilities.
max_position_embeddings (`int`, *optional*, defaults to 131072):
The maximum sequence length that this model might ever be used with.
|
335_3_5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.