2021 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 jnp ndarray of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the model hiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 jnp ndarray of shape batchsize numchannels height width sequence of hiddenstates at the output of the last layer of the model hiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray 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 jnp ndarray of shape batchsize numchannels height width sequence of hiddenstates at the output of the last layer of the model pooleroutput jnp ndarray of shape batchsize hiddensize last layer hiddenstate after a pooling operation on the spatial dimensions hiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray 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 outputs of image classification models args logits jnp ndarray of shape batchsize config numlabels classification or regression if config numlabels1 scores before softmax hiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray 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 model s outputs with potential hidden states and attentions args lasthiddenstate jnp ndarray of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the model pastkeyvalues dictstr jnp ndarray dictionary of precomputed hiddenstates key and values in the attention blocks that can be used for fast autoregressive decoding precomputed key and value hiddenstates are of shape batchsize maxlength hiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 jnp ndarray of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the model pooleroutput jnp ndarray of shape batchsize hiddensize last layer hiddenstate of the first token of the sequence classification token further processed by a linear layer and a tanh activation function the linear layer weights are trained from the next sentence prediction classification objective during pretraining hiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 jnp ndarray of shape batchsize sequencelength hiddensize sequence of hiddenstates at the output of the last layer of the model pooleroutput jnp ndarray 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 tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue and config addcrossattentiontrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 tupletuplejnp ndarray optional returned when usecachetrue is passed or when config usecachetrue tuple of tuplejnp ndarray 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 jnp ndarray 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 tupletuplejnp ndarray optional returned when usecachetrue is passed or when config usecachetrue tuple of tuplejnp ndarray 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 tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue and config addcrossattentiontrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 encoder s outputs that also contains precomputed hidden states that can speed up sequential decoding args lasthiddenstate jnp ndarray 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 tupletuplejnp ndarray optional returned when usecachetrue is passed or when config usecachetrue tuple of tuplejnp ndarray 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 tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray one for the output of the embeddings 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 jnp ndarray of shape batchsize sequencelength hiddensize optional sequence of hiddenstates at the output of the last layer of the encoder of the model encoderhiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray one for the output of the embeddings 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 causal language model or autoregressive outputs args logits jnp ndarray of shape batchsize sequencelength config vocabsize prediction scores of the language modeling head scores for each vocabulary token before softmax hiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 tupletuplejnp ndarray optional returned when usecachetrue is passed or when config usecachetrue tuple of jnp ndarray 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 masked language models outputs args logits jnp ndarray of shape batchsize sequencelength config vocabsize prediction scores of the language modeling head scores for each vocabulary token before softmax hiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 logits jnp ndarray of shape batchsize sequencelength config vocabsize prediction scores of the language modeling head scores for each vocabulary token before softmax pastkeyvalues tupletuplejnp ndarray optional returned when usecachetrue is passed or when config usecachetrue tuple of tuplejnp ndarray 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 tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray one for the output of the embeddings 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 jnp ndarray of shape batchsize sequencelength hiddensize optional sequence of hiddenstates at the output of the last layer of the encoder of the model encoderhiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray one for the output of the embeddings 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 models predicting if two sentences are consecutive or not args logits jnp ndarray of shape batchsize 2 prediction scores of the next sequence prediction classification head scores of truefalse continuation before softmax hiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 logits jnp ndarray of shape batchsize config numlabels classification or regression if config numlabels1 scores before softmax hiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 logits jnp ndarray of shape batchsize config numlabels classification or regression if config numlabels1 scores before softmax pastkeyvalues tupletuplejnp ndarray optional returned when usecachetrue is passed or when config usecachetrue tuple of tuplejnp ndarray 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 tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray one for the output of the embeddings 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 jnp ndarray of shape batchsize sequencelength hiddensize optional sequence of hiddenstates at the output of the last layer of the encoder of the model encoderhiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray one for the output of the embeddings 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 logits jnp ndarray of shape batchsize numchoices numchoices is the second dimension of the input tensors see inputids above classification scores before softmax hiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 logits jnp ndarray of shape batchsize sequencelength config numlabels classification scores before softmax hiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 startlogits jnp ndarray of shape batchsize sequencelength spanstart scores before softmax endlogits jnp ndarray of shape batchsize sequencelength spanend scores before softmax hiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 startlogits jnp ndarray of shape batchsize sequencelength spanstart scores before softmax endlogits jnp ndarray of shape batchsize sequencelength spanend scores before softmax pastkeyvalues tupletuplejnp ndarray optional returned when usecachetrue is passed or when config usecachetrue tuple of tuplejnp ndarray 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 tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray one for the output of the embeddings 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 jnp ndarray of shape batchsize sequencelength hiddensize optional sequence of hiddenstates at the output of the last layer of the encoder of the model encoderhiddenstates tuplejnp ndarray optional returned when outputhiddenstatestrue is passed or when config outputhiddenstatestrue tuple of jnp ndarray one for the output of the embeddings 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 tuplejnp ndarray optional returned when outputattentionstrue is passed or when config outputattentionstrue tuple of jnp ndarray 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 2021 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 jnp ndarray 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray 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 jnp ndarray of shape batch_size num_channels height width sequence of hidden states at the output of the last layer of the model pooler_output jnp ndarray of shape batch_size hidden_size last layer hidden state after a pooling operation on the spatial dimensions hidden_states tuple jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray 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 outputs of image classification models args logits jnp ndarray of shape batch_size config num_labels classification or regression if config num_labels 1 scores before softmax hidden_states tuple jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray 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 model s outputs with potential hidden states and attentions args last_hidden_state jnp ndarray of shape batch_size sequence_length hidden_size sequence of hidden states at the output of the last layer of the model past_key_values dict str jnp ndarray dictionary of pre computed hidden states key and values in the attention blocks that can be used for fast auto regressive decoding pre computed key and value hidden states are of shape batch_size max_length hidden_states tuple jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray of shape batch_size sequence_length hidden_size sequence of hidden states at the output of the last layer of the model pooler_output jnp ndarray of shape batch_size hidden_size last layer hidden state of the first token of the sequence classification token further processed by 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray of shape batch_size sequence_length hidden_size sequence of hidden states at the output of the last layer of the model pooler_output jnp ndarray 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true and config add_cross_attention true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray optional returned when use_cache true is passed or when config use_cache true tuple of tuple jnp ndarray 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 jnp ndarray 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 jnp ndarray optional returned when use_cache true is passed or when config use_cache true tuple of tuple jnp ndarray 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true and config add_cross_attention true is passed or when config output_attentions true tuple of jnp ndarray 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 encoder s outputs that also contains pre computed hidden states that can speed up sequential decoding args last_hidden_state jnp ndarray 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 jnp ndarray optional returned when use_cache true is passed or when config use_cache true tuple of tuple jnp ndarray 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray one for the output of the embeddings one for the output of each layer of shape batch_size sequence_length hidden_size hidden states of the decoder at the output of each layer plus the initial embedding outputs decoder_attentions tuple jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray one for the output of the embeddings one for the output of each layer of shape batch_size sequence_length hidden_size hidden states of the encoder at the output of each layer plus the initial embedding outputs encoder_attentions tuple jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 causal language model or autoregressive outputs args logits jnp ndarray 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray optional returned when use_cache true is passed or when config use_cache true tuple of jnp ndarray 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 masked language models outputs args logits jnp ndarray 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 logits jnp ndarray 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 jnp ndarray optional returned when use_cache true is passed or when config use_cache true tuple of tuple jnp ndarray 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray one for the output of the embeddings one for the output of each layer of shape batch_size sequence_length hidden_size hidden states of the decoder at the output of each layer plus the initial embedding outputs decoder_attentions tuple jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray one for the output of the embeddings one for the output of each layer of shape batch_size sequence_length hidden_size hidden states of the encoder at the output of each layer plus the initial embedding outputs encoder_attentions tuple jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 models predicting if two sentences are consecutive or not args logits jnp ndarray of shape batch_size 2 prediction scores of the next sequence prediction classification head scores of true false continuation before softmax hidden_states tuple jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 logits jnp ndarray of shape batch_size config num_labels classification or regression if config num_labels 1 scores before softmax hidden_states tuple jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 logits jnp ndarray of shape batch_size config num_labels classification or regression if config num_labels 1 scores before softmax past_key_values tuple tuple jnp ndarray optional returned when use_cache true is passed or when config use_cache true tuple of tuple jnp ndarray 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray one for the output of the embeddings one for the output of each layer of shape batch_size sequence_length hidden_size hidden states of the decoder at the output of each layer plus the initial embedding outputs decoder_attentions tuple jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray one for the output of the embeddings one for the output of each layer of shape batch_size sequence_length hidden_size hidden states of the encoder at the output of each layer plus the initial embedding outputs encoder_attentions tuple jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 logits jnp ndarray 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 logits jnp ndarray of shape batch_size sequence_length config num_labels classification scores before softmax hidden_states tuple jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 start_logits jnp ndarray of shape batch_size sequence_length span start scores before softmax end_logits jnp ndarray of shape batch_size sequence_length span end scores before softmax hidden_states tuple jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 start_logits jnp ndarray of shape batch_size sequence_length span start scores before softmax end_logits jnp ndarray of shape batch_size sequence_length span end scores before softmax past_key_values tuple tuple jnp ndarray optional returned when use_cache true is passed or when config use_cache true tuple of tuple jnp ndarray 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray one for the output of the embeddings one for the output of each layer of shape batch_size sequence_length hidden_size hidden states of the decoder at the output of each layer plus the initial embedding outputs decoder_attentions tuple jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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 jnp ndarray 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 jnp ndarray optional returned when output_hidden_states true is passed or when config output_hidden_states true tuple of jnp ndarray one for the output of the embeddings one for the output of each layer of shape batch_size sequence_length hidden_size hidden states of the encoder at the output of each layer plus the initial embedding outputs encoder_attentions tuple jnp ndarray optional returned when output_attentions true is passed or when config output_attentions true tuple of jnp ndarray 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
from typing import Dict, Optional, Tuple

import flax
import jax.numpy as jnp

from .utils import ModelOutput


@flax.struct.dataclass
class FlaxBaseModelOutput(ModelOutput):
    

    last_hidden_state: jnp.ndarray = None
    hidden_states: Optional[Tuple[jnp.ndarray]] = None
    attentions: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxBaseModelOutputWithNoAttention(ModelOutput):
    

    last_hidden_state: jnp.ndarray = None
    hidden_states: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxBaseModelOutputWithPoolingAndNoAttention(ModelOutput):
    

    last_hidden_state: jnp.ndarray = None
    pooler_output: jnp.ndarray = None
    hidden_states: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxImageClassifierOutputWithNoAttention(ModelOutput):
    

    logits: jnp.ndarray = None
    hidden_states: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxBaseModelOutputWithPast(ModelOutput):
    

    last_hidden_state: jnp.ndarray = None
    past_key_values: Optional[Dict[str, jnp.ndarray]] = None
    hidden_states: Optional[Tuple[jnp.ndarray]] = None
    attentions: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxBaseModelOutputWithPooling(ModelOutput):
    

    last_hidden_state: jnp.ndarray = None
    pooler_output: jnp.ndarray = None
    hidden_states: Optional[Tuple[jnp.ndarray]] = None
    attentions: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxBaseModelOutputWithPoolingAndCrossAttentions(ModelOutput):
    

    last_hidden_state: jnp.ndarray = None
    pooler_output: jnp.ndarray = None
    hidden_states: Optional[Tuple[jnp.ndarray]] = None
    past_key_values: Optional[Tuple[Tuple[jnp.ndarray]]] = None
    attentions: Optional[Tuple[jnp.ndarray]] = None
    cross_attentions: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxBaseModelOutputWithPastAndCrossAttentions(ModelOutput):
    

    last_hidden_state: jnp.ndarray = None
    past_key_values: Optional[Tuple[Tuple[jnp.ndarray]]] = None
    hidden_states: Optional[Tuple[jnp.ndarray]] = None
    attentions: Optional[Tuple[jnp.ndarray]] = None
    cross_attentions: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxSeq2SeqModelOutput(ModelOutput):
    

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


@flax.struct.dataclass
class FlaxCausalLMOutputWithCrossAttentions(ModelOutput):
    

    logits: jnp.ndarray = None
    past_key_values: Optional[Tuple[Tuple[jnp.ndarray]]] = None
    hidden_states: Optional[Tuple[jnp.ndarray]] = None
    attentions: Optional[Tuple[jnp.ndarray]] = None
    cross_attentions: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxMaskedLMOutput(ModelOutput):
    

    logits: jnp.ndarray = None
    hidden_states: Optional[Tuple[jnp.ndarray]] = None
    attentions: Optional[Tuple[jnp.ndarray]] = None


FlaxCausalLMOutput = FlaxMaskedLMOutput


@flax.struct.dataclass
class FlaxSeq2SeqLMOutput(ModelOutput):
    

    logits: jnp.ndarray = None
    past_key_values: Optional[Tuple[Tuple[jnp.ndarray]]] = None
    decoder_hidden_states: Optional[Tuple[jnp.ndarray]] = None
    decoder_attentions: Optional[Tuple[jnp.ndarray]] = None
    cross_attentions: Optional[Tuple[jnp.ndarray]] = None
    encoder_last_hidden_state: Optional[jnp.ndarray] = None
    encoder_hidden_states: Optional[Tuple[jnp.ndarray]] = None
    encoder_attentions: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxNextSentencePredictorOutput(ModelOutput):
    

    logits: jnp.ndarray = None
    hidden_states: Optional[Tuple[jnp.ndarray]] = None
    attentions: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxSequenceClassifierOutput(ModelOutput):
    

    logits: jnp.ndarray = None
    hidden_states: Optional[Tuple[jnp.ndarray]] = None
    attentions: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxSeq2SeqSequenceClassifierOutput(ModelOutput):
    

    logits: jnp.ndarray = None
    past_key_values: Optional[Tuple[Tuple[jnp.ndarray]]] = None
    decoder_hidden_states: Optional[Tuple[jnp.ndarray]] = None
    decoder_attentions: Optional[Tuple[jnp.ndarray]] = None
    cross_attentions: Optional[Tuple[jnp.ndarray]] = None
    encoder_last_hidden_state: Optional[jnp.ndarray] = None
    encoder_hidden_states: Optional[Tuple[jnp.ndarray]] = None
    encoder_attentions: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxMultipleChoiceModelOutput(ModelOutput):
    

    logits: jnp.ndarray = None
    hidden_states: Optional[Tuple[jnp.ndarray]] = None
    attentions: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxTokenClassifierOutput(ModelOutput):
    

    logits: jnp.ndarray = None
    hidden_states: Optional[Tuple[jnp.ndarray]] = None
    attentions: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxQuestionAnsweringModelOutput(ModelOutput):
    

    start_logits: jnp.ndarray = None
    end_logits: jnp.ndarray = None
    hidden_states: Optional[Tuple[jnp.ndarray]] = None
    attentions: Optional[Tuple[jnp.ndarray]] = None


@flax.struct.dataclass
class FlaxSeq2SeqQuestionAnsweringModelOutput(ModelOutput):
    

    start_logits: jnp.ndarray = None
    end_logits: jnp.ndarray = None
    past_key_values: Optional[Tuple[Tuple[jnp.ndarray]]] = None
    decoder_hidden_states: Optional[Tuple[jnp.ndarray]] = None
    decoder_attentions: Optional[Tuple[jnp.ndarray]] = None
    cross_attentions: Optional[Tuple[jnp.ndarray]] = None
    encoder_last_hidden_state: Optional[jnp.ndarray] = None
    encoder_hidden_states: Optional[Tuple[jnp.ndarray]] = None
    encoder_attentions: Optional[Tuple[jnp.ndarray]] = None