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/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrimageprocessorfast
|
.md
|
Constructs a fast Detr image processor.
Args:
format (`str`, *optional*, defaults to `AnnotationFormat.COCO_DETECTION`):
Data format of the annotations. One of "coco_detection" or "coco_panoptic".
do_resize (`bool`, *optional*, defaults to `True`):
Controls whether to resize the image's `(height, width)` dimensions to the specified `size`. Can be
overridden by the `do_resize` parameter in the `preprocess` method.
|
332_7_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrimageprocessorfast
|
.md
|
overridden by the `do_resize` parameter in the `preprocess` method.
size (`Dict[str, int]` *optional*, defaults to `{"shortest_edge": 800, "longest_edge": 1333}`):
Size of the image's `(height, width)` dimensions after resizing. Can be overridden by the `size` parameter
in the `preprocess` method. Available options are:
- `{"height": int, "width": int}`: The image will be resized to the exact size `(height, width)`.
Do NOT keep the aspect ratio.
|
332_7_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrimageprocessorfast
|
.md
|
- `{"height": int, "width": int}`: The image will be resized to the exact size `(height, width)`.
Do NOT keep the aspect ratio.
- `{"shortest_edge": int, "longest_edge": int}`: The image will be resized to a maximum size respecting
the aspect ratio and keeping the shortest edge less or equal to `shortest_edge` and the longest edge
less or equal to `longest_edge`.
- `{"max_height": int, "max_width": int}`: The image will be resized to the maximum size respecting the
|
332_7_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrimageprocessorfast
|
.md
|
- `{"max_height": int, "max_width": int}`: The image will be resized to the maximum size respecting the
aspect ratio and keeping the height less or equal to `max_height` and the width less or equal to
`max_width`.
resample (`PILImageResampling`, *optional*, defaults to `PILImageResampling.BILINEAR`):
Resampling filter to use if resizing the image.
do_rescale (`bool`, *optional*, defaults to `True`):
Controls whether to rescale the image by the specified scale `rescale_factor`. Can be overridden by the
|
332_7_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrimageprocessorfast
|
.md
|
Controls whether to rescale the image by the specified scale `rescale_factor`. Can be overridden by the
`do_rescale` parameter in the `preprocess` method.
rescale_factor (`int` or `float`, *optional*, defaults to `1/255`):
Scale factor to use if rescaling the image. Can be overridden by the `rescale_factor` parameter in the
`preprocess` method.
do_normalize (`bool`, *optional*, defaults to `True`):
Controls whether to normalize the image. Can be overridden by the `do_normalize` parameter in the
|
332_7_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrimageprocessorfast
|
.md
|
Controls whether to normalize the image. Can be overridden by the `do_normalize` parameter in the
`preprocess` method.
image_mean (`float` or `List[float]`, *optional*, defaults to `IMAGENET_DEFAULT_MEAN`):
Mean values to use when normalizing the image. Can be a single value or a list of values, one for each
channel. Can be overridden by the `image_mean` parameter in the `preprocess` method.
image_std (`float` or `List[float]`, *optional*, defaults to `IMAGENET_DEFAULT_STD`):
|
332_7_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrimageprocessorfast
|
.md
|
image_std (`float` or `List[float]`, *optional*, defaults to `IMAGENET_DEFAULT_STD`):
Standard deviation values to use when normalizing the image. Can be a single value or a list of values, one
for each channel. Can be overridden by the `image_std` parameter in the `preprocess` method.
do_convert_annotations (`bool`, *optional*, defaults to `True`):
Controls whether to convert the annotations to the format expected by the DETR model. Converts the
|
332_7_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrimageprocessorfast
|
.md
|
Controls whether to convert the annotations to the format expected by the DETR model. Converts the
bounding boxes to the format `(center_x, center_y, width, height)` and in the range `[0, 1]`.
Can be overridden by the `do_convert_annotations` parameter in the `preprocess` method.
do_pad (`bool`, *optional*, defaults to `True`):
Controls whether to pad the image. Can be overridden by the `do_pad` parameter in the `preprocess`
|
332_7_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrimageprocessorfast
|
.md
|
Controls whether to pad the image. Can be overridden by the `do_pad` parameter in the `preprocess`
method. If `True`, padding will be applied to the bottom and right of the image with zeros.
If `pad_size` is provided, the image will be padded to the specified dimensions.
Otherwise, the image will be padded to the maximum height and width of the batch.
pad_size (`Dict[str, int]`, *optional*):
The size `{"height": int, "width" int}` to pad the images to. Must be larger than any image size
|
332_7_8
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrimageprocessorfast
|
.md
|
The size `{"height": int, "width" int}` to pad the images to. Must be larger than any image size
provided for preprocessing. If `pad_size` is not provided, images will be padded to the largest
height and width in the batch.
Methods: preprocess
- post_process_object_detection
- post_process_semantic_segmentation
- post_process_instance_segmentation
- post_process_panoptic_segmentation
|
332_7_9
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrfeatureextractor
|
.md
|
No docstring available for DetrFeatureExtractor
Methods: __call__
- post_process_object_detection
- post_process_semantic_segmentation
- post_process_instance_segmentation
- post_process_panoptic_segmentation
|
332_8_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
models.detr.modeling_detr.DetrModelOutput
Base class for outputs of the DETR encoder-decoder model. This class adds one attribute to Seq2SeqModelOutput,
namely an optional stack of intermediate decoder activations, i.e. the output of each decoder layer, each of them
gone through a layernorm. This is useful when training the model with auxiliary decoding losses.
Args:
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
|
332_9_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
Args:
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
Sequence of hidden-states at the output of the last layer of the decoder of the model.
decoder_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
|
332_9_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-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 decoder at the output of each
layer plus the initial embedding outputs.
decoder_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,
|
332_9_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
sequence_length)`. Attentions weights of the decoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.
cross_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,
|
332_9_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
sequence_length)`. Attentions weights of the decoder's cross-attention layer, after the attention softmax,
used to compute the weighted average in the cross-attention heads.
encoder_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
Sequence of hidden-states at the output of the last layer of the encoder of the model.
|
332_9_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
Sequence of hidden-states at the output of the last layer of the encoder of the model.
encoder_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
shape `(batch_size, sequence_length, hidden_size)`. Hidden-states of the encoder at the output of each
layer plus the initial embedding outputs.
|
332_9_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
layer plus the initial embedding outputs.
encoder_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,
sequence_length)`. Attentions weights of the encoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.
|
332_9_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
weighted average in the self-attention heads.
intermediate_hidden_states (`torch.FloatTensor` of shape `(config.decoder_layers, batch_size, sequence_length, hidden_size)`, *optional*, returned when `config.auxiliary_loss=True`):
Intermediate decoder activations, i.e. the output of each decoder layer, each of them gone through a
layernorm.
models.detr.modeling_detr.DetrObjectDetectionOutput
Output type of [`DetrForObjectDetection`].
Args:
|
332_9_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
layernorm.
models.detr.modeling_detr.DetrObjectDetectionOutput
Output type of [`DetrForObjectDetection`].
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)):
Total loss as a linear combination of a negative log-likehood (cross-entropy) for class prediction and a
bounding box loss. The latter is defined as a linear combination of the L1 loss and the generalized
scale-invariant IoU loss.
loss_dict (`Dict`, *optional*):
|
332_9_8
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
scale-invariant IoU loss.
loss_dict (`Dict`, *optional*):
A dictionary containing the individual losses. Useful for logging.
logits (`torch.FloatTensor` of shape `(batch_size, num_queries, num_classes + 1)`):
Classification logits (including no-object) for all queries.
pred_boxes (`torch.FloatTensor` of shape `(batch_size, num_queries, 4)`):
Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
|
332_9_9
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding
possible padding). You can use [`~DetrImageProcessor.post_process_object_detection`] to retrieve the
unnormalized bounding boxes.
auxiliary_outputs (`list[Dict]`, *optional*):
Optional, only returned when auxilary losses are activated (i.e. `config.auxiliary_loss` is set to `True`)
|
332_9_10
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
Optional, only returned when auxilary losses are activated (i.e. `config.auxiliary_loss` is set to `True`)
and labels are provided. It is a list of dictionaries containing the two above keys (`logits` and
`pred_boxes`) for each decoder layer.
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
Sequence of hidden-states at the output of the last layer of the decoder of the model.
|
332_9_11
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
Sequence of hidden-states at the output of the last layer of the decoder of the model.
decoder_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
shape `(batch_size, sequence_length, hidden_size)`. Hidden-states of the decoder at the output of each
layer plus the initial embedding outputs.
|
332_9_12
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
layer plus the initial embedding outputs.
decoder_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,
sequence_length)`. Attentions weights of the decoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.
|
332_9_13
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
weighted average in the self-attention heads.
cross_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,
sequence_length)`. Attentions weights of the decoder's cross-attention layer, after the attention softmax,
used to compute the weighted average in the cross-attention heads.
|
332_9_14
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
used to compute the weighted average in the cross-attention heads.
encoder_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
Sequence of hidden-states at the output of the last layer of the encoder of the model.
encoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
|
332_9_15
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-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 encoder at the output of each
layer plus the initial embedding outputs.
encoder_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,
|
332_9_16
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
sequence_length)`. Attentions weights of the encoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.
models.detr.modeling_detr.DetrSegmentationOutput
Output type of [`DetrForSegmentation`].
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)):
|
332_9_17
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)):
Total loss as a linear combination of a negative log-likehood (cross-entropy) for class prediction and a
bounding box loss. The latter is defined as a linear combination of the L1 loss and the generalized
scale-invariant IoU loss.
loss_dict (`Dict`, *optional*):
A dictionary containing the individual losses. Useful for logging.
|
332_9_18
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
scale-invariant IoU loss.
loss_dict (`Dict`, *optional*):
A dictionary containing the individual losses. Useful for logging.
logits (`torch.FloatTensor` of shape `(batch_size, num_queries, num_classes + 1)`):
Classification logits (including no-object) for all queries.
pred_boxes (`torch.FloatTensor` of shape `(batch_size, num_queries, 4)`):
Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
|
332_9_19
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding
possible padding). You can use [`~DetrImageProcessor.post_process_object_detection`] to retrieve the
unnormalized bounding boxes.
pred_masks (`torch.FloatTensor` of shape `(batch_size, num_queries, height/4, width/4)`):
Segmentation masks logits for all queries. See also
|
332_9_20
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
Segmentation masks logits for all queries. See also
[`~DetrImageProcessor.post_process_semantic_segmentation`] or
[`~DetrImageProcessor.post_process_instance_segmentation`]
[`~DetrImageProcessor.post_process_panoptic_segmentation`] to evaluate semantic, instance and panoptic
segmentation masks respectively.
auxiliary_outputs (`list[Dict]`, *optional*):
Optional, only returned when auxiliary losses are activated (i.e. `config.auxiliary_loss` is set to `True`)
|
332_9_21
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
Optional, only returned when auxiliary losses are activated (i.e. `config.auxiliary_loss` is set to `True`)
and labels are provided. It is a list of dictionaries containing the two above keys (`logits` and
`pred_boxes`) for each decoder layer.
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
Sequence of hidden-states at the output of the last layer of the decoder of the model.
|
332_9_22
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
Sequence of hidden-states at the output of the last layer of the decoder of the model.
decoder_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
shape `(batch_size, sequence_length, hidden_size)`. Hidden-states of the decoder at the output of each
layer plus the initial embedding outputs.
|
332_9_23
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
layer plus the initial embedding outputs.
decoder_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,
sequence_length)`. Attentions weights of the decoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.
|
332_9_24
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
weighted average in the self-attention heads.
cross_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,
sequence_length)`. Attentions weights of the decoder's cross-attention layer, after the attention softmax,
used to compute the weighted average in the cross-attention heads.
|
332_9_25
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
used to compute the weighted average in the cross-attention heads.
encoder_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
Sequence of hidden-states at the output of the last layer of the encoder of the model.
encoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
|
332_9_26
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-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 encoder at the output of each
layer plus the initial embedding outputs.
encoder_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,
|
332_9_27
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detr-specific-outputs
|
.md
|
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
sequence_length)`. Attentions weights of the encoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.
|
332_9_28
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrmodel
|
.md
|
The bare DETR Model (consisting of a backbone and encoder-decoder 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.
|
332_10_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrmodel
|
.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 ([`DetrConfig`]):
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
|
332_10_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrmodel
|
.md
|
load the weights associated with the model, only the configuration. Check out the
[`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward
|
332_10_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrforobjectdetection
|
.md
|
DETR Model (consisting of a backbone and encoder-decoder Transformer) with object detection heads on top, for tasks
such as COCO detection.
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.
|
332_11_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrforobjectdetection
|
.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 ([`DetrConfig`]):
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
|
332_11_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrforobjectdetection
|
.md
|
load the weights associated with the model, only the configuration. Check out the
[`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward
|
332_11_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrforsegmentation
|
.md
|
DETR Model (consisting of a backbone and encoder-decoder Transformer) with a segmentation head on top, for tasks
such as COCO panoptic.
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.
|
332_12_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrforsegmentation
|
.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 ([`DetrConfig`]):
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
|
332_12_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/detr.md
|
https://huggingface.co/docs/transformers/en/model_doc/detr/#detrforsegmentation
|
.md
|
load the weights associated with the model, only the configuration. Check out the
[`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward
|
332_12_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/
|
.md
|
<!--Copyright 2020 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
333_0_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/
|
.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.
-->
|
333_0_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnet
|
.md
|
<div class="flex flex-wrap space-x-1">
<a href="https://huggingface.co/models?filter=xlnet">
<img alt="Models" src="https://img.shields.io/badge/All_model_pages-xlnet-blueviolet">
</a>
<a href="https://huggingface.co/spaces/docs-demos/xlnet-base-cased">
<img alt="Spaces" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue">
</a>
</div>
|
333_1_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#overview
|
.md
|
The XLNet model was proposed in [XLNet: Generalized Autoregressive Pretraining for Language Understanding](https://arxiv.org/abs/1906.08237) by Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov,
Quoc V. Le. XLnet is an extension of the Transformer-XL model pre-trained using an autoregressive method to learn
bidirectional contexts by maximizing the expected likelihood over all permutations of the input sequence factorization
order.
The abstract from the paper is the following:
|
333_2_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#overview
|
.md
|
order.
The abstract from the paper is the following:
*With the capability of modeling bidirectional contexts, denoising autoencoding based pretraining like BERT achieves
better performance than pretraining approaches based on autoregressive language modeling. However, relying on
corrupting the input with masks, BERT neglects dependency between the masked positions and suffers from a
pretrain-finetune discrepancy. In light of these pros and cons, we propose XLNet, a generalized autoregressive
|
333_2_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#overview
|
.md
|
pretrain-finetune discrepancy. In light of these pros and cons, we propose XLNet, a generalized autoregressive
pretraining method that (1) enables learning bidirectional contexts by maximizing the expected likelihood over all
permutations of the factorization order and (2) overcomes the limitations of BERT thanks to its autoregressive
formulation. Furthermore, XLNet integrates ideas from Transformer-XL, the state-of-the-art autoregressive model, into
|
333_2_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#overview
|
.md
|
formulation. Furthermore, XLNet integrates ideas from Transformer-XL, the state-of-the-art autoregressive model, into
pretraining. Empirically, under comparable experiment settings, XLNet outperforms BERT on 20 tasks, often by a large
margin, including question answering, natural language inference, sentiment analysis, and document ranking.*
This model was contributed by [thomwolf](https://huggingface.co/thomwolf). The original code can be found [here](https://github.com/zihangdai/xlnet/).
|
333_2_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#usage-tips
|
.md
|
- The specific attention pattern can be controlled at training and test time using the `perm_mask` input.
- Due to the difficulty of training a fully auto-regressive model over various factorization order, XLNet is pretrained
using only a sub-set of the output tokens as target which are selected with the `target_mapping` input.
- To use XLNet for sequential decoding (i.e. not in fully bi-directional setting), use the `perm_mask` and
|
333_3_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#usage-tips
|
.md
|
- To use XLNet for sequential decoding (i.e. not in fully bi-directional setting), use the `perm_mask` and
`target_mapping` inputs to control the attention span and outputs (see examples in
*examples/pytorch/text-generation/run_generation.py*)
- XLNet is one of the few models that has no sequence length limit.
|
333_3_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#usage-tips
|
.md
|
- XLNet is not a traditional autoregressive model but uses a training strategy that builds on that. It permutes the tokens in the sentence, then allows the model to use the last n tokens to predict the token n+1. Since this is all done with a mask, the sentence is actually fed in the model in the right order, but instead of masking the first n tokens for n+1, XLNet uses a mask that hides the previous tokens in some given permutation of 1,…,sequence length.
|
333_3_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#usage-tips
|
.md
|
- XLNet also uses the same recurrence mechanism as Transformer-XL to build long-term dependencies.
|
333_3_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#resources
|
.md
|
- [Text classification task guide](../tasks/sequence_classification)
- [Token classification task guide](../tasks/token_classification)
- [Question answering task guide](../tasks/question_answering)
- [Causal language modeling task guide](../tasks/language_modeling)
- [Multiple choice task guide](../tasks/multiple_choice)
|
333_4_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetconfig
|
.md
|
This is the configuration class to store the configuration of a [`XLNetModel`] or a [`TFXLNetModel`]. It is used to
instantiate a XLNet 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
[xlnet/xlnet-large-cased](https://huggingface.co/xlnet/xlnet-large-cased) architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
333_5_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetconfig
|
.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 32000):
Vocabulary size of the XLNet model. Defines the number of different tokens that can be represented by the
`inputs_ids` passed when calling [`XLNetModel`] or [`TFXLNetModel`].
d_model (`int`, *optional*, defaults to 1024):
|
333_5_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetconfig
|
.md
|
`inputs_ids` passed when calling [`XLNetModel`] or [`TFXLNetModel`].
d_model (`int`, *optional*, defaults to 1024):
Dimensionality of the encoder layers and the pooler layer.
n_layer (`int`, *optional*, defaults to 24):
Number of hidden layers in the Transformer encoder.
n_head (`int`, *optional*, defaults to 16):
Number of attention heads for each attention layer in the Transformer encoder.
d_inner (`int`, *optional*, defaults to 4096):
|
333_5_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetconfig
|
.md
|
Number of attention heads for each attention layer in the Transformer encoder.
d_inner (`int`, *optional*, defaults to 4096):
Dimensionality of the "intermediate" (often named feed-forward) layer in the Transformer encoder.
ff_activation (`str` or `Callable`, *optional*, defaults to `"gelu"`):
The non-linear activation function (function or string) in the If string, `"gelu"`, `"relu"`, `"silu"` and
`"gelu_new"` are supported.
untie_r (`bool`, *optional*, defaults to `True`):
|
333_5_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetconfig
|
.md
|
`"gelu_new"` are supported.
untie_r (`bool`, *optional*, defaults to `True`):
Whether or not to untie relative position biases
attn_type (`str`, *optional*, defaults to `"bi"`):
The attention type used by the model. Set `"bi"` for XLNet, `"uni"` for Transformer-XL.
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):
|
333_5_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetconfig
|
.md
|
layer_norm_eps (`float`, *optional*, defaults to 1e-12):
The epsilon used by the layer normalization layers.
dropout (`float`, *optional*, defaults to 0.1):
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
mem_len (`int` or `None`, *optional*):
The number of tokens to cache. The key/value pairs that have already been pre-computed in a previous
forward pass won't be re-computed. See the
|
333_5_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetconfig
|
.md
|
forward pass won't be re-computed. See the
[quickstart](https://huggingface.co/transformers/quickstart.html#using-the-past) for more information.
reuse_len (`int`, *optional*):
The number of tokens in the current batch to be cached and reused in the future.
bi_data (`bool`, *optional*, defaults to `False`):
Whether or not to use bidirectional input pipeline. Usually set to `True` during pretraining and `False`
during finetuning.
clamp_len (`int`, *optional*, defaults to -1):
|
333_5_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetconfig
|
.md
|
during finetuning.
clamp_len (`int`, *optional*, defaults to -1):
Clamp all relative distances larger than clamp_len. Setting this attribute to -1 means no clamping.
same_length (`bool`, *optional*, defaults to `False`):
Whether or not to use the same attention length for each token.
summary_type (`str`, *optional*, defaults to "last"):
Argument used when doing sequence summary. Used in the sequence classification and multiple choice models.
Has to be one of the following options:
|
333_5_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetconfig
|
.md
|
Has to be one of the following options:
- `"last"`: Take the last token hidden state (like XLNet).
- `"first"`: Take the first token hidden state (like BERT).
- `"mean"`: Take the mean of all tokens hidden states.
- `"cls_index"`: Supply a Tensor of classification token position (like GPT/GPT-2).
- `"attn"`: Not implemented now, use multi-head attention.
summary_use_proj (`bool`, *optional*, defaults to `True`):
|
333_5_8
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetconfig
|
.md
|
- `"attn"`: Not implemented now, use multi-head attention.
summary_use_proj (`bool`, *optional*, defaults to `True`):
Argument used when doing sequence summary. Used in the sequence classification and multiple choice models.
Whether or not to add a projection after the vector extraction.
summary_activation (`str`, *optional*):
Argument used when doing sequence summary. Used in the sequence classification and multiple choice models.
|
333_5_9
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetconfig
|
.md
|
Argument used when doing sequence summary. Used in the sequence classification and multiple choice models.
Pass `"tanh"` for a tanh activation to the output, any other value will result in no activation.
summary_proj_to_labels (`boo`, *optional*, defaults to `True`):
Used in the sequence classification and multiple choice models.
Whether the projection outputs should have `config.num_labels` or `config.hidden_size` classes.
summary_last_dropout (`float`, *optional*, defaults to 0.1):
|
333_5_10
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetconfig
|
.md
|
summary_last_dropout (`float`, *optional*, defaults to 0.1):
Used in the sequence classification and multiple choice models.
The dropout ratio to be used after the projection and activation.
start_n_top (`int`, *optional*, defaults to 5):
Used in the SQuAD evaluation script.
end_n_top (`int`, *optional*, defaults to 5):
Used in the SQuAD evaluation script.
use_mems_eval (`bool`, *optional*, defaults to `True`):
Whether or not the model should make use of the recurrent memory mechanism in evaluation mode.
|
333_5_11
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetconfig
|
.md
|
Whether or not the model should make use of the recurrent memory mechanism in evaluation mode.
use_mems_train (`bool`, *optional*, defaults to `False`):
Whether or not the model should make use of the recurrent memory mechanism in train mode.
<Tip>
For pretraining, it is recommended to set `use_mems_train` to `True`. For fine-tuning, it is recommended to
set `use_mems_train` to `False` as discussed
|
333_5_12
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetconfig
|
.md
|
set `use_mems_train` to `False` as discussed
[here](https://github.com/zihangdai/xlnet/issues/41#issuecomment-505102587). If `use_mems_train` is set to
`True`, one has to make sure that the train batches are correctly pre-processed, *e.g.* `batch_1 = [[This
line is], [This is the]]` and `batch_2 = [[ the first line], [ second line]]` and that all batches are of
equal size.
</Tip>
Examples:
```python
>>> from transformers import XLNetConfig, XLNetModel
|
333_5_13
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnetconfig
|
.md
|
>>> # Initializing a XLNet configuration
>>> configuration = XLNetConfig()
>>> # Initializing a model (with random weights) from the configuration
>>> model = XLNetModel(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
```
|
333_5_14
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizer
|
.md
|
Construct an XLNet tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece).
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.
Args:
vocab_file (`str`):
[SentencePiece](https://github.com/google/sentencepiece) file (generally has a .spm extension) that
contains the vocabulary necessary to instantiate a tokenizer.
|
333_6_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizer
|
.md
|
contains the vocabulary necessary to instantiate a tokenizer.
do_lower_case (`bool`, *optional*, defaults to `False`):
Whether to lowercase the input when tokenizing.
remove_space (`bool`, *optional*, defaults to `True`):
Whether to strip the text when tokenizing (removing excess spaces before and after the string).
keep_accents (`bool`, *optional*, defaults to `False`):
Whether to keep accents when tokenizing.
bos_token (`str`, *optional*, defaults to `"<s>"`):
|
333_6_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizer
|
.md
|
Whether to keep accents when tokenizing.
bos_token (`str`, *optional*, defaults to `"<s>"`):
The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.
<Tip>
When building a sequence using special tokens, this is not the token that is used for the beginning of
sequence. The token used is the `cls_token`.
</Tip>
eos_token (`str`, *optional*, defaults to `"</s>"`):
The end of sequence token.
<Tip>
|
333_6_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizer
|
.md
|
</Tip>
eos_token (`str`, *optional*, defaults to `"</s>"`):
The end of sequence token.
<Tip>
When building a sequence using special tokens, this is not the token that is used for the end of sequence.
The token used is the `sep_token`.
</Tip>
unk_token (`str`, *optional*, defaults to `"<unk>"`):
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.
sep_token (`str`, *optional*, defaults to `"<sep>"`):
|
333_6_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizer
|
.md
|
token instead.
sep_token (`str`, *optional*, defaults to `"<sep>"`):
The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
sequence classification or for a text and a question for question answering. It is also used as the last
token of a sequence built with special tokens.
pad_token (`str`, *optional*, defaults to `"<pad>"`):
The token used for padding, for example when batching sequences of different lengths.
|
333_6_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizer
|
.md
|
The token used for padding, for example when batching sequences of different lengths.
cls_token (`str`, *optional*, defaults to `"<cls>"`):
The classifier token which is used when doing sequence classification (classification of the whole sequence
instead of per-token classification). It is the first token of the sequence when built with special tokens.
mask_token (`str`, *optional*, defaults to `"<mask>"`):
|
333_6_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizer
|
.md
|
mask_token (`str`, *optional*, defaults to `"<mask>"`):
The token used for masking values. This is the token used when training this model with masked language
modeling. This is the token which the model will try to predict.
additional_special_tokens (`List[str]`, *optional*, defaults to `['<eop>', '<eod>']`):
Additional special tokens used by the tokenizer.
sp_model_kwargs (`dict`, *optional*):
Will be passed to the `SentencePieceProcessor.__init__()` method. The [Python wrapper for
|
333_6_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizer
|
.md
|
sp_model_kwargs (`dict`, *optional*):
Will be passed to the `SentencePieceProcessor.__init__()` method. The [Python wrapper for
SentencePiece](https://github.com/google/sentencepiece/tree/master/python) can be used, among other things,
to set:
- `enable_sampling`: Enable subword regularization.
- `nbest_size`: Sampling parameters for unigram. Invalid for BPE-Dropout.
- `nbest_size = {0,1}`: No sampling is performed.
- `nbest_size > 1`: samples from the nbest_size results.
|
333_6_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizer
|
.md
|
- `nbest_size = {0,1}`: No sampling is performed.
- `nbest_size > 1`: samples from the nbest_size results.
- `nbest_size < 0`: assuming that nbest_size is infinite and samples from the all hypothesis (lattice)
using forward-filtering-and-backward-sampling algorithm.
- `alpha`: Smoothing parameter for unigram sampling, and dropout probability of merge operations for
BPE-dropout.
Attributes:
sp_model (`SentencePieceProcessor`):
|
333_6_8
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizer
|
.md
|
BPE-dropout.
Attributes:
sp_model (`SentencePieceProcessor`):
The *SentencePiece* processor that is used for every conversion (string, tokens and IDs).
Methods: build_inputs_with_special_tokens
- get_special_tokens_mask
- create_token_type_ids_from_sequences
- save_vocabulary
|
333_6_9
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizerfast
|
.md
|
Construct a "fast" XLNet tokenizer (backed by HuggingFace's *tokenizers* library). Based on
[Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models).
This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.
Args:
vocab_file (`str`):
[SentencePiece](https://github.com/google/sentencepiece) file (generally has a .spm extension) that
|
333_7_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizerfast
|
.md
|
Args:
vocab_file (`str`):
[SentencePiece](https://github.com/google/sentencepiece) file (generally has a .spm extension) that
contains the vocabulary necessary to instantiate a tokenizer.
do_lower_case (`bool`, *optional*, defaults to `True`):
Whether to lowercase the input when tokenizing.
remove_space (`bool`, *optional*, defaults to `True`):
Whether to strip the text when tokenizing (removing excess spaces before and after the string).
keep_accents (`bool`, *optional*, defaults to `False`):
|
333_7_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizerfast
|
.md
|
keep_accents (`bool`, *optional*, defaults to `False`):
Whether to keep accents when tokenizing.
bos_token (`str`, *optional*, defaults to `"<s>"`):
The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.
<Tip>
When building a sequence using special tokens, this is not the token that is used for the beginning of
sequence. The token used is the `cls_token`.
</Tip>
eos_token (`str`, *optional*, defaults to `"</s>"`):
The end of sequence token.
|
333_7_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizerfast
|
.md
|
</Tip>
eos_token (`str`, *optional*, defaults to `"</s>"`):
The end of sequence token.
<Tip>
When building a sequence using special tokens, this is not the token that is used for the end of sequence.
The token used is the `sep_token`.
</Tip>
unk_token (`str`, *optional*, defaults to `"<unk>"`):
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.
sep_token (`str`, *optional*, defaults to `"<sep>"`):
|
333_7_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizerfast
|
.md
|
token instead.
sep_token (`str`, *optional*, defaults to `"<sep>"`):
The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
sequence classification or for a text and a question for question answering. It is also used as the last
token of a sequence built with special tokens.
pad_token (`str`, *optional*, defaults to `"<pad>"`):
The token used for padding, for example when batching sequences of different lengths.
|
333_7_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizerfast
|
.md
|
The token used for padding, for example when batching sequences of different lengths.
cls_token (`str`, *optional*, defaults to `"<cls>"`):
The classifier token which is used when doing sequence classification (classification of the whole sequence
instead of per-token classification). It is the first token of the sequence when built with special tokens.
mask_token (`str`, *optional*, defaults to `"<mask>"`):
|
333_7_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/xlnet.md
|
https://huggingface.co/docs/transformers/en/model_doc/xlnet/#xlnettokenizerfast
|
.md
|
mask_token (`str`, *optional*, defaults to `"<mask>"`):
The token used for masking values. This is the token used when training this model with masked language
modeling. This is the token which the model will try to predict.
additional_special_tokens (`List[str]`, *optional*, defaults to `["<eop>", "<eod>"]`):
Additional special tokens used by the tokenizer.
Attributes:
sp_model (`SentencePieceProcessor`):
The *SentencePiece* processor that is used for every conversion (string, tokens and IDs).
|
333_7_6
|
/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
|
models.xlnet.modeling_xlnet.XLNetModelOutput
Output type of [`XLNetModel`].
Args:
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, num_predict, hidden_size)`):
Sequence of hidden-states at the last layer of the model.
`num_predict` corresponds to `target_mapping.shape[1]`. If `target_mapping` is `None`, then `num_predict`
corresponds to `sequence_length`.
mems (`List[torch.FloatTensor]` of length `config.n_layers`):
|
333_8_0
|
/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
|
corresponds to `sequence_length`.
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_1
|
/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_2
|
/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.XLNetLMHeadModelOutput
Output type of [`XLNetLMHeadModel`].
Args:
loss (`torch.FloatTensor` of shape *(1,)*, *optional*, returned when `labels` is provided)
Language modeling loss (for next-token prediction).
|
333_8_3
|
/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
|
Language modeling loss (for next-token prediction).
logits (`torch.FloatTensor` of shape `(batch_size, num_predict, config.vocab_size)`):
Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
`num_predict` corresponds to `target_mapping.shape[1]`. If `target_mapping` is `None`, then `num_predict`
corresponds to `sequence_length`.
mems (`List[torch.FloatTensor]` of length `config.n_layers`):
|
333_8_4
|
/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
|
corresponds to `sequence_length`.
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_5
|
/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_6
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.