2020 the huggingface team 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 orglicenseslicense2 0 unless required by applicable law or agreed to in writing software distributed under the license is distributed on an as is basis without warranties or conditions of any kind either express or implied see the license for the specific language governing permissions and limitations under the license base class for model s outputs with potential hidden states and attentions args lasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the model hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for model s outputs with potential hidden states args lasthiddenstate torch floattensor of shape batchsize numchannels height width sequence of hiddenstates at the output of the last layer of the model hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize numchannels height width hiddenstates of the model at the output of each layer plus the optional initial embedding outputs base class for model s outputs that also contains a pooling of the last hidden states args lasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the model pooleroutput torch floattensor of shape batchsize hiddensize last layer hiddenstate of the first token of the sequence classification token after further processing through the layers used for the auxiliary pretraining task e g for bertfamily of models this returns the classification token after processing through a linear layer and a tanh activation function the linear layer weights are trained from the next sentence prediction classification objective during pretraining hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for model s outputs that also contains a pooling of the last hidden states args lasthiddenstate torch floattensor of shape batchsize numchannels height width sequence of hiddenstates at the output of the last layer of the model pooleroutput torch floattensor of shape batchsize hiddensize last layer hiddenstate after a pooling operation on the spatial dimensions hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize numchannels height width hiddenstates of the model at the output of each layer plus the optional initial embedding outputs base class for model s outputs that may also contain a past keyvalues to speed up sequential decoding args lasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the model if pastkeyvalues is used only the last hiddenstate of the sequences of shape batchsize 1 hiddensize is output pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead and optionally if config isencoderdecodertrue 2 additional tensors of shape batchsize numheads encodersequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks and optionally if config isencoderdecodertrue in the crossattention blocks that can be used see pastkeyvalues input to speed up sequential decoding hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for model s outputs with potential hidden states and attentions args lasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the model hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads crossattentions tupletorch floattensor optional returned when outputattentionstrue and config addcrossattentiontrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder s crossattention layer after the attention softmax used to compute the weighted average in the crossattention heads base class for model s outputs that also contains a pooling of the last hidden states args lasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the model pooleroutput torch floattensor of shape batchsize hiddensize last layer hiddenstate of the first token of the sequence classification token after further processing through the layers used for the auxiliary pretraining task e g for bertfamily of models this returns the classification token after processing through a linear layer and a tanh activation function the linear layer weights are trained from the next sentence prediction classification objective during pretraining hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads crossattentions tupletorch floattensor optional returned when outputattentionstrue and config addcrossattentiontrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder s crossattention layer after the attention softmax used to compute the weighted average in the crossattention heads pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead and optionally if config isencoderdecodertrue 2 additional tensors of shape batchsize numheads encodersequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks and optionally if config isencoderdecodertrue in the crossattention blocks that can be used see pastkeyvalues input to speed up sequential decoding base class for model s outputs that may also contain a past keyvalues to speed up sequential decoding args lasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the model if pastkeyvalues is used only the last hiddenstate of the sequences of shape batchsize 1 hiddensize is output pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead and optionally if config isencoderdecodertrue 2 additional tensors of shape batchsize numheads encodersequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks and optionally if config isencoderdecodertrue in the crossattention blocks that can be used see pastkeyvalues input to speed up sequential decoding hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads crossattentions tupletorch floattensor optional returned when outputattentionstrue and config addcrossattentiontrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder s crossattention layer after the attention softmax used to compute the weighted average in the crossattention heads base class for causal language model or autoregressive outputs as well as mixture of expert s router hidden states terms to train a moe model args loss torch floattensor of shape 1 optional returned when labels is provided language modeling loss for nexttoken prediction logits torch floattensor of shape batchsize sequencelength config vocabsize prediction scores of the language modeling head scores for each vocabulary token before softmax pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks that can be used see pastkeyvalues input to speed up sequential decoding hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads zloss torch floattensor optional returned when labels is provided zloss for the sparse modules auxloss torch floattensor optional returned when labels is provided auxloss for the sparse modules routerlogits tupletorch floattensor optional returned when outputrouterlogitstrue is passed or when config addrouterprobstrue tuple of torch floattensor one for each layer of shape batchsize sequencelength numexperts router logits of the encoder model useful to compute the auxiliary loss and the zloss for the sparse modules base class for model s outputs with potential hidden states and attentions args lasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the model hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads routerprobs tupletorch floattensor optional returned when outputrouterprobstrue and config addrouterprobstrue is passed or when config outputrouterprobstrue tuple of torch floattensor one for each layer of shape batchsize sequencelength numexperts raw router probabilities that are computed by moe routers these terms are used to compute the auxiliary loss and the zloss for mixture of experts models base class for model s outputs that may also contain a past keyvalues to speed up sequential decoding as well as mixture of expert s router hidden states terms to train a moe model args lasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the model if pastkeyvalues is used only the last hiddenstate of the sequences of shape batchsize 1 hiddensize is output pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead and optionally if config isencoderdecodertrue 2 additional tensors of shape batchsize numheads encodersequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks and optionally if config isencoderdecodertrue in the crossattention blocks that can be used see pastkeyvalues input to speed up sequential decoding hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads crossattentions tupletorch floattensor optional returned when outputattentionstrue and config addcrossattentiontrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder s crossattention layer after the attention softmax used to compute the weighted average in the crossattention heads routerprobs tupletorch floattensor optional returned when outputrouterprobstrue and config addrouterprobstrue is passed or when config outputrouterprobstrue tuple of torch floattensor one for each layer of shape batchsize sequencelength numexperts raw router probabilities that are computed by moe routers these terms are used to compute the auxiliary loss and the zloss for mixture of experts models base class for model encoder s outputs that also contains precomputed hidden states that can speed up sequential decoding args lasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the decoder of the model if pastkeyvalues is used only the last hiddenstate of the sequences of shape batchsize 1 hiddensize is output pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead and 2 additional tensors of shape batchsize numheads encodersequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks and in the crossattention blocks that can be used see pastkeyvalues input to speed up sequential decoding decoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the decoder at the output of each layer plus the optional initial embedding outputs decoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder after the attention softmax used to compute the weighted average in the selfattention heads crossattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder s crossattention layer after the attention softmax used to compute the weighted average in the crossattention heads encoderlasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize optional sequence of hiddenstates at the output of the last layer of the encoder of the model encoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the encoder at the output of each layer plus the optional initial embedding outputs encoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the encoder after the attention softmax used to compute the weighted average in the selfattention heads base class for model encoder s outputs that also contains precomputed hidden states that can speed up sequential decoding args lasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the decoder of the model if pastkeyvalues is used only the last hiddenstate of the sequences of shape batchsize 1 hiddensize is output pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead and 2 additional tensors of shape batchsize numheads encodersequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks and in the crossattention blocks that can be used see pastkeyvalues input to speed up sequential decoding decoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the decoder at the output of each layer plus the optional initial embedding outputs decoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder after the attention softmax used to compute the weighted average in the selfattention heads decoderrouterlogits tupletorch floattensor optional returned when outputrouterlogitstrue is passed or when config addrouterprobstrue tuple of torch floattensor one for each layer of shape batchsize sequencelength numexperts router logits of the decoder model useful to compute the auxiliary loss for mixture of experts models crossattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder s crossattention layer after the attention softmax used to compute the weighted average in the crossattention heads encoderlasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize optional sequence of hiddenstates at the output of the last layer of the encoder of the model encoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the encoder at the output of each layer plus the optional initial embedding outputs encoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the encoder after the attention softmax used to compute the weighted average in the selfattention heads encoderrouterlogits tupletorch floattensor optional returned when outputrouterlogitstrue is passed or when config addrouterprobstrue tuple of torch floattensor one for each layer of shape batchsize sequencelength numexperts router logits of the encoder model useful to compute the auxiliary loss and the zloss for the sparse modules base class for causal language model or autoregressive outputs args loss torch floattensor of shape 1 optional returned when labels is provided language modeling loss for nexttoken prediction logits torch floattensor of shape batchsize sequencelength config vocabsize prediction scores of the language modeling head scores for each vocabulary token before softmax hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for causal language model or autoregressive outputs args loss torch floattensor of shape 1 optional returned when labels is provided language modeling loss for nexttoken prediction logits torch floattensor of shape batchsize sequencelength config vocabsize prediction scores of the language modeling head scores for each vocabulary token before softmax pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks that can be used see pastkeyvalues input to speed up sequential decoding hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for causal language model or autoregressive outputs args loss torch floattensor of shape 1 optional returned when labels is provided language modeling loss for nexttoken prediction logits torch floattensor of shape batchsize sequencelength config vocabsize prediction scores of the language modeling head scores for each vocabulary token before softmax hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads crossattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength cross attentions weights after the attention softmax used to compute the weighted average in the crossattention heads pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of torch floattensor tuples of length config nlayers with each tuple containing the cached key value states of the selfattention and the crossattention layers if model is used in encoderdecoder setting only relevant if config isdecoder true contains precomputed hiddenstates key and values in the attention blocks that can be used see pastkeyvalues input to speed up sequential decoding base class for outputs of sentence classification models args loss torch floattensor of shape 1 optional returned when labels is provided classification or regression if config numlabels1 loss logits torch floattensor of shape batchsize config numlabels classification or regression if config numlabels1 scores before softmax pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks that can be used see pastkeyvalues input to speed up sequential decoding hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for masked language models outputs args loss torch floattensor of shape 1 optional returned when labels is provided masked language modeling mlm loss logits torch floattensor of shape batchsize sequencelength config vocabsize prediction scores of the language modeling head scores for each vocabulary token before softmax hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for sequencetosequence language models outputs args loss torch floattensor of shape 1 optional returned when labels is provided language modeling loss logits torch floattensor of shape batchsize sequencelength config vocabsize prediction scores of the language modeling head scores for each vocabulary token before softmax pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead and 2 additional tensors of shape batchsize numheads encodersequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks and in the crossattention blocks that can be used see pastkeyvalues input to speed up sequential decoding decoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the decoder at the output of each layer plus the initial embedding outputs decoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder after the attention softmax used to compute the weighted average in the selfattention heads crossattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder s crossattention layer after the attention softmax used to compute the weighted average in the crossattention heads encoderlasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize optional sequence of hiddenstates at the output of the last layer of the encoder of the model encoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the encoder at the output of each layer plus the initial embedding outputs encoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the encoder after the attention softmax used to compute the weighted average in the selfattention heads base class for sequencetosequence language models outputs args loss torch floattensor of shape 1 optional returned when labels is provided language modeling loss logits torch floattensor of shape batchsize sequencelength config vocabsize prediction scores of the language modeling head scores for each vocabulary token before softmax pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead and 2 additional tensors of shape batchsize numheads encodersequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks and in the crossattention blocks that can be used see pastkeyvalues input to speed up sequential decoding decoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the decoder at the output of each layer plus the initial embedding outputs decoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder after the attention softmax used to compute the weighted average in the selfattention heads decoderrouterlogits tupletorch floattensor optional returned when outputrouterlogitstrue is passed or when config addrouterprobstrue tuple of torch floattensor one for each layer of shape batchsize sequencelength numexperts router logits of the decoder model useful to compute the auxiliary loss for mixture of experts models crossattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder s crossattention layer after the attention softmax used to compute the weighted average in the crossattention heads encoderlasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize optional sequence of hiddenstates at the output of the last layer of the encoder of the model encoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the encoder at the output of each layer plus the initial embedding outputs encoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the encoder after the attention softmax used to compute the weighted average in the selfattention heads encoderrouterlogits tupletorch floattensor optional returned when outputrouterlogitstrue is passed or when config addrouterprobstrue tuple of torch floattensor one for each layer of shape batchsize sequencelength numexperts router logits of the encoder model useful to compute the auxiliary loss and zloss for mixture of experts models base class for outputs of models predicting if two sentences are consecutive or not args loss torch floattensor of shape 1 optional returned when nextsentencelabel is provided next sequence prediction classification loss logits torch floattensor of shape batchsize 2 prediction scores of the next sequence prediction classification head scores of truefalse continuation before softmax hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for outputs of sentence classification models args loss torch floattensor of shape 1 optional returned when labels is provided classification or regression if config numlabels1 loss logits torch floattensor of shape batchsize config numlabels classification or regression if config numlabels1 scores before softmax hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for outputs of sequencetosequence sentence classification models args loss torch floattensor of shape 1 optional returned when label is provided classification or regression if config numlabels1 loss logits torch floattensor of shape batchsize config numlabels classification or regression if config numlabels1 scores before softmax pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead and 2 additional tensors of shape batchsize numheads encodersequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks and in the crossattention blocks that can be used see pastkeyvalues input to speed up sequential decoding decoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the decoder at the output of each layer plus the initial embedding outputs decoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder after the attention softmax used to compute the weighted average in the selfattention heads crossattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder s crossattention layer after the attention softmax used to compute the weighted average in the crossattention heads encoderlasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize optional sequence of hiddenstates at the output of the last layer of the encoder of the model encoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the encoder at the output of each layer plus the initial embedding outputs encoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the encoder after the attention softmax used to compute the weighted average in the selfattention heads base class for outputs of multiple choice models args loss torch floattensor of shape 1 optional returned when labels is provided classification loss logits torch floattensor of shape batchsize numchoices numchoices is the second dimension of the input tensors see inputids above classification scores before softmax hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for outputs of token classification models args loss torch floattensor of shape 1 optional returned when labels is provided classification loss logits torch floattensor of shape batchsize sequencelength config numlabels classification scores before softmax hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for outputs of question answering models args loss torch floattensor of shape 1 optional returned when labels is provided total span extraction loss is the sum of a crossentropy for the start and end positions startlogits torch floattensor of shape batchsize sequencelength spanstart scores before softmax endlogits torch floattensor of shape batchsize sequencelength spanend scores before softmax hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for outputs of sequencetosequence question answering models args loss torch floattensor of shape 1 optional returned when labels is provided total span extraction loss is the sum of a crossentropy for the start and end positions startlogits torch floattensor of shape batchsize sequencelength spanstart scores before softmax endlogits torch floattensor of shape batchsize sequencelength spanend scores before softmax pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead and 2 additional tensors of shape batchsize numheads encodersequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks and in the crossattention blocks that can be used see pastkeyvalues input to speed up sequential decoding decoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the decoder at the output of each layer plus the initial embedding outputs decoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder after the attention softmax used to compute the weighted average in the selfattention heads crossattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder s crossattention layer after the attention softmax used to compute the weighted average in the crossattention heads encoderlasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize optional sequence of hiddenstates at the output of the last layer of the encoder of the model encoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the encoder at the output of each layer plus the initial embedding outputs encoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the encoder after the attention softmax used to compute the weighted average in the selfattention heads base class for outputs of semantic segmentation models args loss torch floattensor of shape 1 optional returned when labels is provided classification or regression if config numlabels1 loss logits torch floattensor of shape batchsize config numlabels logitsheight logitswidth classification scores for each pixel tip warningtrue the logits returned do not necessarily have the same size as the pixelvalues passed as inputs this is to avoid doing two interpolations and lose some quality when a user needs to resize the logits to the original image size as postprocessing you should always check your logits shape and resize as needed tip hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize patchsize hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads patchsize sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for outputs of image classification models args loss torch floattensor of shape 1 optional returned when labels is provided classification or regression if config numlabels1 loss logits torch floattensor of shape batchsize config numlabels classification or regression if config numlabels1 scores before softmax hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each stage of shape batchsize sequencelength hiddensize hiddenstates also called feature maps of the model at the output of each stage attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads patchsize sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for outputs of image classification models args loss torch floattensor of shape 1 optional returned when labels is provided classification or regression if config numlabels1 loss logits torch floattensor of shape batchsize config numlabels classification or regression if config numlabels1 scores before softmax hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each stage of shape batchsize numchannels height width hiddenstates also called feature maps of the model at the output of each stage base class for outputs of depth estimation models args loss torch floattensor of shape 1 optional returned when labels is provided classification or regression if config numlabels1 loss predicteddepth torch floattensor of shape batchsize height width predicted depth for each pixel hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize numchannels height width hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads patchsize sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for outputs of image super resolution models args loss torch floattensor of shape 1 optional returned when labels is provided reconstruction loss reconstruction torch floattensor of shape batchsize numchannels height width reconstructed images possibly upscaled hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each stage of shape batchsize sequencelength hiddensize hiddenstates also called feature maps of the model at the output of each stage attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads patchsize sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for models that have been trained with the wav2vec2 loss objective args lasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the model extractfeatures torch floattensor of shape batchsize sequencelength convdim1 sequence of extracted feature vectors of the last convolutional layer of the model hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads output type of wav2vec2forxvector args loss torch floattensor of shape 1 optional returned when labels is provided classification loss logits torch floattensor of shape batchsize config xvectoroutputdim classification hidden states before amsoftmax embeddings torch floattensor of shape batchsize config xvectoroutputdim utterance embeddings used for vector similaritybased retrieval hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for outputs of backbones args featuremaps tupletorch floattensor of shape batchsize numchannels height width feature maps of the stages hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings one for the output of each layer of shape batchsize sequencelength hiddensize or batchsize numchannels height width depending on the backbone hiddenstates of the model at the output of each stage plus the initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength only applicable if the backbone uses attention attentions weights after the attention softmax used to compute the weighted average in the selfattention heads base class for model s outputs that also contains a pooling of the last hidden states args lasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the model pooleroutput torch floattensor of shape batchsize hiddensize last layer hiddenstate of the first token of the sequence classification token after further processing through the layers used for the auxiliary pretraining task e g for bertfamily of models this returns the classification token after processing through a linear layer and a tanh activation function the linear layer weights are trained from the next sentence prediction classification objective during pretraining hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the model at the output of each layer plus the optional initial embedding outputs attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads projectionstate tupletorch floattensor returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor of shape batchsize config projectdim text embeddings before the projection layer used to mimic the last hidden state of the teacher encoder base class for sequencetosequence spectrogram outputs args loss torch floattensor of shape 1 optional returned when labels is provided spectrogram generation loss spectrogram torch floattensor of shape batchsize sequencelength numbins the predicted spectrogram pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead and 2 additional tensors of shape batchsize numheads encodersequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks and in the crossattention blocks that can be used see pastkeyvalues input to speed up sequential decoding decoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the decoder at the output of each layer plus the initial embedding outputs decoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder after the attention softmax used to compute the weighted average in the selfattention heads crossattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder s crossattention layer after the attention softmax used to compute the weighted average in the crossattention heads encoderlasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize optional sequence of hiddenstates at the output of the last layer of the encoder of the model encoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the encoder at the output of each layer plus the initial embedding outputs encoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the encoder after the attention softmax used to compute the weighted average in the selfattention heads base class for time series model s encoder outputs that also contains precomputed hidden states that can speed up sequential decoding args lasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the decoder of the model if pastkeyvalues is used only the last hiddenstate of the sequences of shape batchsize 1 hiddensize is output pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead and 2 additional tensors of shape batchsize numheads encodersequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks and in the crossattention blocks that can be used see pastkeyvalues input to speed up sequential decoding decoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the decoder at the output of each layer plus the optional initial embedding outputs decoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder after the attention softmax used to compute the weighted average in the selfattention heads crossattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder s crossattention layer after the attention softmax used to compute the weighted average in the crossattention heads encoderlasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize optional sequence of hiddenstates at the output of the last layer of the encoder of the model encoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the encoder at the output of each layer plus the optional initial embedding outputs encoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the encoder after the attention softmax used to compute the weighted average in the selfattention heads loc torch floattensor of shape batchsize or batchsize inputsize optional shift values of each time series context window which is used to give the model inputs of the same magnitude and then used to shift back to the original magnitude scale torch floattensor of shape batchsize or batchsize inputsize optional scaling values of each time series context window which is used to give the model inputs of the same magnitude and then used to rescale back to the original magnitude staticfeatures torch floattensor of shape batchsize feature size optional static features of each time series in a batch which are copied to the covariates at inference time base class for time series model s decoder outputs that also contain the loss as well as the parameters of the chosen distribution args loss torch floattensor of shape 1 optional returned when a futurevalues is provided distributional loss params torch floattensor of shape batchsize numsamples numparams parameters of the chosen distribution pastkeyvalues tupletupletorch floattensor optional returned when usecachetrue is passed or when config usecachetrue tuple of tupletorch floattensor of length config nlayers with each tuple having 2 tensors of shape batchsize numheads sequencelength embedsizeperhead and 2 additional tensors of shape batchsize numheads encodersequencelength embedsizeperhead contains precomputed hiddenstates key and values in the selfattention blocks and in the crossattention blocks that can be used see pastkeyvalues input to speed up sequential decoding decoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the decoder at the output of each layer plus the initial embedding outputs decoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder after the attention softmax used to compute the weighted average in the selfattention heads crossattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the decoder s crossattention layer after the attention softmax used to compute the weighted average in the crossattention heads encoderlasthiddenstate torch floattensor of shape batchsize sequencelength hiddensize optional sequence of hiddenstates at the output of the last layer of the encoder of the model encoderhiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each layer of shape batchsize sequencelength hiddensize hiddenstates of the encoder at the output of each layer plus the initial embedding outputs encoderattentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads sequencelength sequencelength attentions weights of the encoder after the attention softmax used to compute the weighted average in the selfattention heads loc torch floattensor of shape batchsize or batchsize inputsize optional shift values of each time series context window which is used to give the model inputs of the same magnitude and then used to shift back to the original magnitude scale torch floattensor of shape batchsize or batchsize inputsize optional scaling values of each time series context window which is used to give the model inputs of the same magnitude and then used to rescale back to the original magnitude staticfeatures torch floattensor of shape batchsize feature size optional static features of each time series in a batch which are copied to the covariates at inference time base class for time series model s predictions outputs that contains the sampled values from the chosen distribution args sequences torch floattensor of shape batchsize numsamples predictionlength or batchsize numsamples predictionlength inputsize sampled values from the chosen distribution base class for outputs of masked image completion inpainting models args loss torch floattensor of shape 1 optional returned when boolmaskedpos is provided reconstruction loss reconstruction torch floattensor of shape batchsize numchannels height width reconstructed completed images hiddenstates tupletorch floattensor optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer one for the output of each stage of shape batchsize sequencelength hiddensize hiddenstates also called feature maps of the model at the output of each stage attentions tupletorch floattensor optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of torch floattensor one for each layer of shape batchsize numheads patchsize sequencelength attentions weights after the attention softmax used to compute the weighted average in the selfattention heads 2020 the huggingface team licensed under the apache license version 2 0 the license you may not use this file except in compliance with the license you may obtain a copy of the license at http www apache org licenses license 2 0 unless required by applicable law or agreed to in writing software distributed under the license is distributed on an as is basis without warranties or conditions of any kind either express or implied see the license for the specific language governing permissions and limitations under the license base class for model s outputs with potential hidden states and attentions 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 model 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for model s outputs with potential hidden states args last_hidden_state torch floattensor of shape batch_size num_channels height width sequence of hidden states at the output of the last layer of the model 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 if the model has an embedding layer one for the output of each layer of shape batch_size num_channels height width hidden states of the model at the output of each layer plus the optional initial embedding outputs base class for model s outputs that also contains a pooling of the last hidden states 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 model pooler_output torch floattensor of shape batch_size hidden_size last layer hidden state of the first token of the sequence classification token after further processing through the layers used for the auxiliary pretraining task e g for bert family of models this returns the classification token after processing through a linear layer and a tanh activation function the linear layer weights are trained from the next sentence prediction classification objective during pretraining 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for model s outputs that also contains a pooling of the last hidden states args last_hidden_state torch floattensor of shape batch_size num_channels height width sequence of hidden states at the output of the last layer of the model pooler_output torch floattensor of shape batch_size hidden_size last layer hidden state after a pooling operation on the spatial dimensions 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 if the model has an embedding layer one for the output of each layer of shape batch_size num_channels height width hidden states of the model at the output of each layer plus the optional initial embedding outputs base class for model s outputs that may also contain a past key values to speed up sequential decoding 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 model if past_key_values is used only the last hidden state of the sequences of shape batch_size 1 hidden_size is output past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head and optionally if config is_encoder_decoder true 2 additional tensors of shape batch_size num_heads encoder_sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks and optionally if config is_encoder_decoder true in the cross attention blocks that can be used see past_key_values input to speed up sequential decoding 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for model s outputs with potential hidden states and attentions 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 model 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights 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 and config add_cross_attention 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 base class for model s outputs that also contains a pooling of the last hidden states 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 model pooler_output torch floattensor of shape batch_size hidden_size last layer hidden state of the first token of the sequence classification token after further processing through the layers used for the auxiliary pretraining task e g for bert family of models this returns the classification token after processing through a linear layer and a tanh activation function the linear layer weights are trained from the next sentence prediction classification objective during pretraining 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights 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 and config add_cross_attention 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 past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head and optionally if config is_encoder_decoder true 2 additional tensors of shape batch_size num_heads encoder_sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks and optionally if config is_encoder_decoder true in the cross attention blocks that can be used see past_key_values input to speed up sequential decoding base class for model s outputs that may also contain a past key values to speed up sequential decoding 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 model if past_key_values is used only the last hidden state of the sequences of shape batch_size 1 hidden_size is output past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head and optionally if config is_encoder_decoder true 2 additional tensors of shape batch_size num_heads encoder_sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks and optionally if config is_encoder_decoder true in the cross attention blocks that can be used see past_key_values input to speed up sequential decoding 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights 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 and config add_cross_attention 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 base class for causal language model or autoregressive outputs as well as mixture of expert s router hidden states terms to train a moe model args loss torch floattensor of shape 1 optional returned when labels is provided language modeling loss for next token prediction logits torch floattensor of shape batch_size sequence_length config vocab_size prediction scores of the language modeling head scores for each vocabulary token before softmax past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks that can be used see past_key_values input to speed up sequential decoding 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads z_loss torch floattensor optional returned when labels is provided z_loss for the sparse modules aux_loss torch floattensor optional returned when labels is provided aux_loss for the sparse modules router_logits tuple torch floattensor optional returned when output_router_logits true is passed or when config add_router_probs true tuple of torch floattensor one for each layer of shape batch_size sequence_length num_experts router logits of the encoder model useful to compute the auxiliary loss and the z_loss for the sparse modules base class for model s outputs with potential hidden states and attentions 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 model 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads router_probs tuple torch floattensor optional returned when output_router_probs true and config add_router_probs true is passed or when config output_router_probs true tuple of torch floattensor one for each layer of shape batch_size sequence_length num_experts raw router probabilities that are computed by moe routers these terms are used to compute the auxiliary loss and the z_loss for mixture of experts models base class for model s outputs that may also contain a past key values to speed up sequential decoding as well as mixture of expert s router hidden states terms to train a moe model 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 model if past_key_values is used only the last hidden state of the sequences of shape batch_size 1 hidden_size is output past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head and optionally if config is_encoder_decoder true 2 additional tensors of shape batch_size num_heads encoder_sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks and optionally if config is_encoder_decoder true in the cross attention blocks that can be used see past_key_values input to speed up sequential decoding 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights 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 and config add_cross_attention 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 router_probs tuple torch floattensor optional returned when output_router_probs true and config add_router_probs true is passed or when config output_router_probs true tuple of torch floattensor one for each layer of shape batch_size sequence_length num_experts raw router probabilities that are computed by moe routers these terms are used to compute the auxiliary loss and the z_loss for mixture of experts models base class for model encoder s outputs that also contains pre computed hidden states that can speed up sequential decoding 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 if past_key_values is used only the last hidden state of the sequences of shape batch_size 1 hidden_size is output past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head and 2 additional tensors of shape batch_size num_heads encoder_sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks and in the cross attention blocks that can be used see past_key_values input to speed up sequential decoding 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 if the model has an embedding layer 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 optional 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 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 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 tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer 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 optional 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 base class for model encoder s outputs that also contains pre computed hidden states that can speed up sequential decoding 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 if past_key_values is used only the last hidden state of the sequences of shape batch_size 1 hidden_size is output past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head and 2 additional tensors of shape batch_size num_heads encoder_sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks and in the cross attention blocks that can be used see past_key_values input to speed up sequential decoding 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 if the model has an embedding layer 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 optional 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 decoder_router_logits tuple torch floattensor optional returned when output_router_logits true is passed or when config add_router_probs true tuple of torch floattensor one for each layer of shape batch_size sequence_length num_experts router logits of the decoder model useful to compute the auxiliary loss for mixture of experts models 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 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 tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer 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 optional 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 encoder_router_logits tuple torch floattensor optional returned when output_router_logits true is passed or when config add_router_probs true tuple of torch floattensor one for each layer of shape batch_size sequence_length num_experts router logits of the encoder model useful to compute the auxiliary loss and the z_loss for the sparse modules base class for causal language model or autoregressive outputs args loss torch floattensor of shape 1 optional returned when labels is provided language modeling loss for next token prediction logits torch floattensor of shape batch_size sequence_length config vocab_size prediction scores of the language modeling head scores for each vocabulary token before softmax 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for causal language model or autoregressive outputs args loss torch floattensor of shape 1 optional returned when labels is provided language modeling loss for next token prediction logits torch floattensor of shape batch_size sequence_length config vocab_size prediction scores of the language modeling head scores for each vocabulary token before softmax past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks that can be used see past_key_values input to speed up sequential decoding 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for causal language model or autoregressive outputs args loss torch floattensor of shape 1 optional returned when labels is provided language modeling loss for next token prediction logits torch floattensor of shape batch_size sequence_length config vocab_size prediction scores of the language modeling head scores for each vocabulary token before softmax 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights 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 sequence_length cross attentions weights after the attention softmax used to compute the weighted average in the cross attention heads past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of torch floattensor tuples of length config n_layers with each tuple containing the cached key value states of the self attention and the cross attention layers if model is used in encoder decoder setting only relevant if config is_decoder true contains pre computed hidden states key and values in the attention blocks that can be used see past_key_values input to speed up sequential decoding base class for outputs of sentence classification models args loss torch floattensor of shape 1 optional returned when labels 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 past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks that can be used see past_key_values input to speed up sequential decoding 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for masked language models outputs args loss torch floattensor of shape 1 optional returned when labels is provided masked language modeling mlm loss logits torch floattensor of shape batch_size sequence_length config vocab_size prediction scores of the language modeling head scores for each vocabulary token before softmax 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for sequence to sequence language models outputs args loss torch floattensor of shape 1 optional returned when labels is provided language modeling loss logits torch floattensor of shape batch_size sequence_length config vocab_size prediction scores of the language modeling head scores for each vocabulary token before softmax past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head and 2 additional tensors of shape batch_size num_heads encoder_sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks and in the cross attention blocks that can be used see past_key_values input to speed up sequential decoding 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 if the model has an embedding layer 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 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 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 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 if the model has an embedding layer 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 sequence_length attentions weights of the encoder after the attention softmax used to compute the weighted average in the self attention heads base class for sequence to sequence language models outputs args loss torch floattensor of shape 1 optional returned when labels is provided language modeling loss logits torch floattensor of shape batch_size sequence_length config vocab_size prediction scores of the language modeling head scores for each vocabulary token before softmax past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head and 2 additional tensors of shape batch_size num_heads encoder_sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks and in the cross attention blocks that can be used see past_key_values input to speed up sequential decoding 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 if the model has an embedding layer 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 sequence_length attentions weights of the decoder after the attention softmax used to compute the weighted average in the self attention heads decoder_router_logits tuple torch floattensor optional returned when output_router_logits true is passed or when config add_router_probs true tuple of torch floattensor one for each layer of shape batch_size sequence_length num_experts router logits of the decoder model useful to compute the auxiliary loss for mixture of experts models 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 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 tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer 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 sequence_length attentions weights of the encoder after the attention softmax used to compute the weighted average in the self attention heads encoder_router_logits tuple torch floattensor optional returned when output_router_logits true is passed or when config add_router_probs true tuple of torch floattensor one for each layer of shape batch_size sequence_length num_experts router logits of the encoder model useful to compute the auxiliary loss and z_loss for mixture of experts models base class for outputs of models predicting if two sentences are consecutive or not args loss torch floattensor of shape 1 optional returned when next_sentence_label is provided next sequence prediction classification loss logits torch floattensor of shape batch_size 2 prediction scores of the next sequence prediction classification head scores of true false continuation before softmax 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for outputs of sentence classification models args loss torch floattensor of shape 1 optional returned when labels 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 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for outputs of sequence to sequence sentence classification models 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 past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head and 2 additional tensors of shape batch_size num_heads encoder_sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks and in the cross attention blocks that can be used see past_key_values input to speed up sequential decoding 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 if the model has an embedding layer 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 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 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 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 if the model has an embedding layer 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 sequence_length attentions weights of the encoder after the attention softmax used to compute the weighted average in the self attention heads base class for outputs of multiple choice models 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 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for outputs of token classification models 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 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for outputs of question answering models 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 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for outputs of sequence to sequence question answering models 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 past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head and 2 additional tensors of shape batch_size num_heads encoder_sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks and in the cross attention blocks that can be used see past_key_values input to speed up sequential decoding 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 if the model has an embedding layer 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 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 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 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 if the model has an embedding layer 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 sequence_length attentions weights of the encoder after the attention softmax used to compute the weighted average in the self attention heads base class for outputs of semantic segmentation models args loss torch floattensor of shape 1 optional returned when labels is provided classification or regression if config num_labels 1 loss logits torch floattensor of shape batch_size config num_labels logits_height logits_width classification scores for each pixel tip warning true the logits returned do not necessarily have the same size as the pixel_values passed as inputs this is to avoid doing two interpolations and lose some quality when a user needs to resize the logits to the original image size as post processing you should always check your logits shape and resize as needed tip 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 if the model has an embedding layer one for the output of each layer of shape batch_size patch_size hidden_size hidden states of the model at the output of each layer plus the optional 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 patch_size sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for outputs of image classification models args loss torch floattensor of shape 1 optional returned when labels 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 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 if the model has an embedding layer one for the output of each stage of shape batch_size sequence_length hidden_size hidden states also called feature maps of the model at the output of each stage 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 patch_size sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for outputs of image classification models args loss torch floattensor of shape 1 optional returned when labels 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 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 if the model has an embedding layer one for the output of each stage of shape batch_size num_channels height width hidden states also called feature maps of the model at the output of each stage base class for outputs of depth estimation models args loss torch floattensor of shape 1 optional returned when labels is provided classification or regression if config num_labels 1 loss predicted_depth torch floattensor of shape batch_size height width predicted depth for each pixel 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 if the model has an embedding layer one for the output of each layer of shape batch_size num_channels height width hidden states of the model at the output of each layer plus the optional 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 patch_size sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for outputs of image super resolution models args loss torch floattensor of shape 1 optional returned when labels is provided reconstruction loss reconstruction torch floattensor of shape batch_size num_channels height width reconstructed images possibly upscaled 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 if the model has an embedding layer one for the output of each stage of shape batch_size sequence_length hidden_size hidden states also called feature maps of the model at the output of each stage 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 patch_size sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for models that have been trained with the wav2vec2 loss objective 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 model extract_features torch floattensor of shape batch_size sequence_length conv_dim 1 sequence of extracted feature vectors of the last convolutional layer of the model 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 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads output type of wav2vec2forxvector args loss torch floattensor of shape 1 optional returned when labels is provided classification loss logits torch floattensor of shape batch_size config xvector_output_dim classification hidden states before amsoftmax embeddings torch floattensor of shape batch_size config xvector_output_dim utterance embeddings used for vector similarity based retrieval 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 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for outputs of backbones args feature_maps tuple torch floattensor of shape batch_size num_channels height width feature maps of the stages 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 or batch_size num_channels height width depending on the backbone hidden states of the model at the output of each stage 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 sequence_length only applicable if the backbone uses attention attentions weights after the attention softmax used to compute the weighted average in the self attention heads base class for model s outputs that also contains a pooling of the last hidden states 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 model pooler_output torch floattensor of shape batch_size hidden_size last layer hidden state of the first token of the sequence classification token after further processing through the layers used for the auxiliary pretraining task e g for bert family of models this returns the classification token after processing through a linear layer and a tanh activation function the linear layer weights are trained from the next sentence prediction classification objective during pretraining 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 if the model has an embedding layer 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 optional 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 sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads projection_state tuple torch floattensor returned when output_attentions true is passed or when config output_attentions true tuple of torch floattensor of shape batch_size config project_dim text embeddings before the projection layer used to mimic the last hidden state of the teacher encoder base class for sequence to sequence spectrogram outputs args loss torch floattensor of shape 1 optional returned when labels is provided spectrogram generation loss spectrogram torch floattensor of shape batch_size sequence_length num_bins the predicted spectrogram past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head and 2 additional tensors of shape batch_size num_heads encoder_sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks and in the cross attention blocks that can be used see past_key_values input to speed up sequential decoding 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 if the model has an embedding layer 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 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 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 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 if the model has an embedding layer 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 sequence_length attentions weights of the encoder after the attention softmax used to compute the weighted average in the self attention heads base class for time series model s encoder outputs that also contains pre computed hidden states that can speed up sequential decoding 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 if past_key_values is used only the last hidden state of the sequences of shape batch_size 1 hidden_size is output past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head and 2 additional tensors of shape batch_size num_heads encoder_sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks and in the cross attention blocks that can be used see past_key_values input to speed up sequential decoding 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 if the model has an embedding layer 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 optional 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 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 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 tuple of torch floattensor one for the output of the embeddings if the model has an embedding layer 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 optional 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 loc torch floattensor of shape batch_size or batch_size input_size optional shift values of each time series context window which is used to give the model inputs of the same magnitude and then used to shift back to the original magnitude scale torch floattensor of shape batch_size or batch_size input_size optional scaling values of each time series context window which is used to give the model inputs of the same magnitude and then used to rescale back to the original magnitude static_features torch floattensor of shape batch_size feature size optional static features of each time series in a batch which are copied to the covariates at inference time base class for time series model s decoder outputs that also contain the loss as well as the parameters of the chosen distribution args loss torch floattensor of shape 1 optional returned when a future_values is provided distributional loss params torch floattensor of shape batch_size num_samples num_params parameters of the chosen distribution past_key_values tuple tuple torch floattensor optional returned when use_cache true is passed or when config use_cache true tuple of tuple torch floattensor of length config n_layers with each tuple having 2 tensors of shape batch_size num_heads sequence_length embed_size_per_head and 2 additional tensors of shape batch_size num_heads encoder_sequence_length embed_size_per_head contains pre computed hidden states key and values in the self attention blocks and in the cross attention blocks that can be used see past_key_values input to speed up sequential decoding 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 if the model has an embedding layer 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 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 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 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 if the model has an embedding layer 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 sequence_length attentions weights of the encoder after the attention softmax used to compute the weighted average in the self attention heads loc torch floattensor of shape batch_size or batch_size input_size optional shift values of each time series context window which is used to give the model inputs of the same magnitude and then used to shift back to the original magnitude scale torch floattensor of shape batch_size or batch_size input_size optional scaling values of each time series context window which is used to give the model inputs of the same magnitude and then used to rescale back to the original magnitude static_features torch floattensor of shape batch_size feature size optional static features of each time series in a batch which are copied to the covariates at inference time base class for time series model s predictions outputs that contains the sampled values from the chosen distribution args sequences torch floattensor of shape batch_size num_samples prediction_length or batch_size num_samples prediction_length input_size sampled values from the chosen distribution base class for outputs of masked image completion in painting models args loss torch floattensor of shape 1 optional returned when bool_masked_pos is provided reconstruction loss reconstruction torch floattensor of shape batch_size num_channels height width reconstructed completed images 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 if the model has an embedding layer one for the output of each stage of shape batch_size sequence_length hidden_size hidden states also called feature maps of the model at the output of each stage 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 patch_size sequence_length attentions weights after the attention softmax used to compute the weighted average in the self attention heads
import warnings
from dataclasses import dataclass
from typing import Optional, Tuple

import torch

from .utils import ModelOutput


@dataclass
class BaseModelOutput(ModelOutput):
    

    last_hidden_state: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class BaseModelOutputWithNoAttention(ModelOutput):
    

    last_hidden_state: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class BaseModelOutputWithPooling(ModelOutput):
    

    last_hidden_state: torch.FloatTensor = None
    pooler_output: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class BaseModelOutputWithPoolingAndNoAttention(ModelOutput):
    

    last_hidden_state: torch.FloatTensor = None
    pooler_output: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class BaseModelOutputWithPast(ModelOutput):
    

    last_hidden_state: torch.FloatTensor = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class BaseModelOutputWithCrossAttentions(ModelOutput):
    

    last_hidden_state: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None
    cross_attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class BaseModelOutputWithPoolingAndCrossAttentions(ModelOutput):
    

    last_hidden_state: torch.FloatTensor = None
    pooler_output: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None
    cross_attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class BaseModelOutputWithPastAndCrossAttentions(ModelOutput):
    

    last_hidden_state: torch.FloatTensor = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None
    cross_attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class MoECausalLMOutputWithPast(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None
    z_loss: torch.FloatTensor = None
    aux_loss: torch.FloatTensor = None
    router_logits: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class MoEModelOutput(ModelOutput):
    

    last_hidden_state: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None
    router_probs: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class MoEModelOutputWithPastAndCrossAttentions(ModelOutput):
    

    last_hidden_state: torch.FloatTensor = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None
    cross_attentions: Optional[Tuple[torch.FloatTensor]] = None
    router_probs: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class Seq2SeqModelOutput(ModelOutput):
    

    last_hidden_state: torch.FloatTensor = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    decoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    decoder_attentions: Optional[Tuple[torch.FloatTensor]] = None
    cross_attentions: Optional[Tuple[torch.FloatTensor]] = None
    encoder_last_hidden_state: Optional[torch.FloatTensor] = None
    encoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    encoder_attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class Seq2SeqMoEModelOutput(ModelOutput):
    

    last_hidden_state: torch.FloatTensor = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    decoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    decoder_attentions: Optional[Tuple[torch.FloatTensor]] = None
    decoder_router_logits: Optional[Tuple[torch.FloatTensor]] = None
    cross_attentions: Optional[Tuple[torch.FloatTensor]] = None
    encoder_last_hidden_state: Optional[torch.FloatTensor] = None
    encoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    encoder_attentions: Optional[Tuple[torch.FloatTensor]] = None
    encoder_router_logits: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class CausalLMOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class CausalLMOutputWithPast(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class CausalLMOutputWithCrossAttentions(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None
    cross_attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class SequenceClassifierOutputWithPast(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class MaskedLMOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class Seq2SeqLMOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    decoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    decoder_attentions: Optional[Tuple[torch.FloatTensor]] = None
    cross_attentions: Optional[Tuple[torch.FloatTensor]] = None
    encoder_last_hidden_state: Optional[torch.FloatTensor] = None
    encoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    encoder_attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class Seq2SeqMoEOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    encoder_z_loss: torch.FloatTensor = None
    decoder_z_loss: torch.FloatTensor = None
    encoder_aux_loss: torch.FloatTensor = None
    decoder_aux_loss: torch.FloatTensor = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    decoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    decoder_attentions: Optional[Tuple[torch.FloatTensor]] = None
    decoder_router_logits: Optional[Tuple[torch.FloatTensor]] = None
    cross_attentions: Optional[Tuple[torch.FloatTensor]] = None
    encoder_last_hidden_state: Optional[torch.FloatTensor] = None
    encoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    encoder_attentions: Optional[Tuple[torch.FloatTensor]] = None
    encoder_router_logits: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class NextSentencePredictorOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class SequenceClassifierOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class Seq2SeqSequenceClassifierOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    decoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    decoder_attentions: Optional[Tuple[torch.FloatTensor]] = None
    cross_attentions: Optional[Tuple[torch.FloatTensor]] = None
    encoder_last_hidden_state: Optional[torch.FloatTensor] = None
    encoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    encoder_attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class MultipleChoiceModelOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class TokenClassifierOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class QuestionAnsweringModelOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    start_logits: torch.FloatTensor = None
    end_logits: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class Seq2SeqQuestionAnsweringModelOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    start_logits: torch.FloatTensor = None
    end_logits: torch.FloatTensor = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    decoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    decoder_attentions: Optional[Tuple[torch.FloatTensor]] = None
    cross_attentions: Optional[Tuple[torch.FloatTensor]] = None
    encoder_last_hidden_state: Optional[torch.FloatTensor] = None
    encoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    encoder_attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class SemanticSegmenterOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class ImageClassifierOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class ImageClassifierOutputWithNoAttention(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class DepthEstimatorOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    predicted_depth: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class ImageSuperResolutionOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    reconstruction: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class Wav2Vec2BaseModelOutput(ModelOutput):
    

    last_hidden_state: torch.FloatTensor = None
    extract_features: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class XVectorOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    logits: torch.FloatTensor = None
    embeddings: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class BackboneOutput(ModelOutput):
    

    feature_maps: Tuple[torch.FloatTensor] = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class BaseModelOutputWithPoolingAndProjection(ModelOutput):
    

    last_hidden_state: torch.FloatTensor = None
    pooler_output: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None
    projection_state: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class Seq2SeqSpectrogramOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    spectrogram: torch.FloatTensor = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    decoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    decoder_attentions: Optional[Tuple[torch.FloatTensor]] = None
    cross_attentions: Optional[Tuple[torch.FloatTensor]] = None
    encoder_last_hidden_state: Optional[torch.FloatTensor] = None
    encoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    encoder_attentions: Optional[Tuple[torch.FloatTensor]] = None


@dataclass
class Seq2SeqTSModelOutput(ModelOutput):
    

    last_hidden_state: torch.FloatTensor = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    decoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    decoder_attentions: Optional[Tuple[torch.FloatTensor]] = None
    cross_attentions: Optional[Tuple[torch.FloatTensor]] = None
    encoder_last_hidden_state: Optional[torch.FloatTensor] = None
    encoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    encoder_attentions: Optional[Tuple[torch.FloatTensor]] = None
    loc: Optional[torch.FloatTensor] = None
    scale: Optional[torch.FloatTensor] = None
    static_features: Optional[torch.FloatTensor] = None


@dataclass
class Seq2SeqTSPredictionOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    params: Optional[Tuple[torch.FloatTensor]] = None
    past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
    decoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    decoder_attentions: Optional[Tuple[torch.FloatTensor]] = None
    cross_attentions: Optional[Tuple[torch.FloatTensor]] = None
    encoder_last_hidden_state: Optional[torch.FloatTensor] = None
    encoder_hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    encoder_attentions: Optional[Tuple[torch.FloatTensor]] = None
    loc: Optional[torch.FloatTensor] = None
    scale: Optional[torch.FloatTensor] = None
    static_features: Optional[torch.FloatTensor] = None


@dataclass
class SampleTSPredictionOutput(ModelOutput):
    

    sequences: torch.FloatTensor = None


@dataclass
class MaskedImageModelingOutput(ModelOutput):
    

    loss: Optional[torch.FloatTensor] = None
    reconstruction: torch.FloatTensor = None
    hidden_states: Optional[Tuple[torch.FloatTensor]] = None
    attentions: Optional[Tuple[torch.FloatTensor]] = None

    @property
    def logits(self):
        warnings.warn(
            "logits attribute is deprecated and will be removed in version 5 of Transformers."
            " Please use the reconstruction attribute to retrieve the final output instead.",
            FutureWarning,
        )
        return self.reconstruction