





'''simple docstring'''

from typing import Optional

import torch
import torch.utils.checkpoint
from torch import Tensor, nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss

from ...activations import ACTaFN
from ...modeling_outputs import (
    BackboneOutput,
    BaseModelOutputWithNoAttention,
    BaseModelOutputWithPoolingAndNoAttention,
    ImageClassifierOutputWithNoAttention,
)
from ...modeling_utils import PreTrainedModel
from ...utils import (
    add_code_sample_docstrings,
    add_start_docstrings,
    add_start_docstrings_to_model_forward,
    logging,
    replace_return_docstrings,
)
from ...utils.backbone_utils import BackboneMixin
from .configuration_resnet import ResNetConfig


a   	=    logging.get_logger(__name__)

# General docstring
a   	=    "ResNetConfig"

# Base docstring
a   	=    "microsoft/resnet-50"
a   	=    [1, 2048, 7, 7]

# Image classification docstring
a   	=    "microsoft/resnet-50"
a   	=    "tiger cat"

a   	=    [
    "microsoft/resnet-50",
    # See all resnet models at https://huggingface.co/models?filter=resnet
]







class __a			( nn.Module      ):





   def __init__(       self					:      Any					,lowerCamelCase					:      Dict					,lowerCamelCase					:      Tuple					,lowerCamelCase					:      Any = 3					,lowerCamelCase					:      int = 1					,lowerCamelCase					:      str = "relu"     ):

      '''simple docstring'''

      super().__init__()
      __SCREAMING_SNAKE_CASE   				=							nn.Convad(
          lowerCamelCase					,lowerCamelCase					,kernel_size=lowerCamelCase					,stride=lowerCamelCase					,padding=kernel_size // 2					,bias=lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							nn.BatchNormad(lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							ACTaFN[activation] if activation is not None else nn.Identity()





   def   UpperCAmelCase__  (       self					:      Union[str, Any]					,lowerCamelCase					:      Union[str, Any]     ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE   				=							self.convolution(lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							self.normalization(lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							self.activation(lowerCamelCase     )
      return hidden_state







class __a			( nn.Module      ):





   def __init__(       self					:      Union[str, Any]					,lowerCamelCase					:      str     ):

      '''simple docstring'''

      super().__init__()
      __SCREAMING_SNAKE_CASE   				=							ResNetConvLayer(
          config.num_channels					,config.embedding_size					,kernel_size=7					,stride=2					,activation=config.hidden_act     )
      __SCREAMING_SNAKE_CASE   				=							nn.MaxPoolad(kernel_size=3					,stride=2					,padding=1     )
      __SCREAMING_SNAKE_CASE   				=							config.num_channels





   def   UpperCAmelCase__  (       self					:      Union[str, Any]					,lowerCamelCase					:      str     ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE   				=							pixel_values.shape[1]
      if num_channels != self.num_channels:
         raise ValueError(
             """Make sure that the channel dimension of the pixel values match with the one set in the configuration."""     )
      __SCREAMING_SNAKE_CASE   				=							self.embedder(lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							self.pooler(lowerCamelCase     )
      return embedding







class __a			( nn.Module      ):





   def __init__(       self					:      int					,lowerCamelCase					:      Optional[Any]					,lowerCamelCase					:      Dict					,lowerCamelCase					:      Union[str, Any] = 2     ):

      '''simple docstring'''

      super().__init__()
      __SCREAMING_SNAKE_CASE   				=							nn.Convad(lowerCamelCase					,lowerCamelCase					,kernel_size=1					,stride=lowerCamelCase					,bias=lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							nn.BatchNormad(lowerCamelCase     )





   def   UpperCAmelCase__  (       self					:      Dict					,lowerCamelCase					:      Any     ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE   				=							self.convolution(lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							self.normalization(lowerCamelCase     )
      return hidden_state







class __a			( nn.Module      ):





   def __init__(       self					:      Tuple					,lowerCamelCase					:      str					,lowerCamelCase					:      int					,lowerCamelCase					:      Optional[Any] = 1					,lowerCamelCase					:      Union[str, Any] = "relu"     ):

      '''simple docstring'''

      super().__init__()
      __SCREAMING_SNAKE_CASE   				=							in_channels != out_channels or stride != 1
      __SCREAMING_SNAKE_CASE   				=							(
          ResNetShortCut(lowerCamelCase					,lowerCamelCase					,stride=lowerCamelCase     ) if should_apply_shortcut else nn.Identity()
      )
      __SCREAMING_SNAKE_CASE   				=							nn.Sequential(
          ResNetConvLayer(lowerCamelCase					,lowerCamelCase					,stride=lowerCamelCase     )					,ResNetConvLayer(lowerCamelCase					,lowerCamelCase					,activation=lowerCamelCase     )					,)
      __SCREAMING_SNAKE_CASE   				=							ACTaFN[activation]





   def   UpperCAmelCase__  (       self					:      Tuple					,lowerCamelCase					:      Any     ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE   				=							hidden_state
      __SCREAMING_SNAKE_CASE   				=							self.layer(lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							self.shortcut(lowerCamelCase     )
      hidden_state += residual
      __SCREAMING_SNAKE_CASE   				=							self.activation(lowerCamelCase     )
      return hidden_state







class __a			( nn.Module      ):





   def __init__(       self					:      List[Any]					,lowerCamelCase					:      Tuple					,lowerCamelCase					:      Any					,lowerCamelCase					:      List[Any] = 1					,lowerCamelCase					:      Optional[int] = "relu"					,lowerCamelCase					:      Dict = 4     ):

      '''simple docstring'''

      super().__init__()
      __SCREAMING_SNAKE_CASE   				=							in_channels != out_channels or stride != 1
      __SCREAMING_SNAKE_CASE   				=							out_channels // reduction
      __SCREAMING_SNAKE_CASE   				=							(
          ResNetShortCut(lowerCamelCase					,lowerCamelCase					,stride=lowerCamelCase     ) if should_apply_shortcut else nn.Identity()
      )
      __SCREAMING_SNAKE_CASE   				=							nn.Sequential(
          ResNetConvLayer(lowerCamelCase					,lowerCamelCase					,kernel_size=1     )					,ResNetConvLayer(lowerCamelCase					,lowerCamelCase					,stride=lowerCamelCase     )					,ResNetConvLayer(lowerCamelCase					,lowerCamelCase					,kernel_size=1					,activation=lowerCamelCase     )					,)
      __SCREAMING_SNAKE_CASE   				=							ACTaFN[activation]





   def   UpperCAmelCase__  (       self					:      Union[str, Any]					,lowerCamelCase					:      Dict     ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE   				=							hidden_state
      __SCREAMING_SNAKE_CASE   				=							self.layer(lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							self.shortcut(lowerCamelCase     )
      hidden_state += residual
      __SCREAMING_SNAKE_CASE   				=							self.activation(lowerCamelCase     )
      return hidden_state







class __a			( nn.Module      ):





   def __init__(       self					:      int					,lowerCamelCase					:      Union[str, Any]					,lowerCamelCase					:      Tuple					,lowerCamelCase					:      Union[str, Any]					,lowerCamelCase					:      Dict = 2					,lowerCamelCase					:      Tuple = 2					,):

      '''simple docstring'''

      super().__init__()

      __SCREAMING_SNAKE_CASE   				=							ResNetBottleNeckLayer if config.layer_type == """bottleneck""" else ResNetBasicLayer

      __SCREAMING_SNAKE_CASE   				=							nn.Sequential(
          # downsampling is done in the first layer with stride of 2
          layer(lowerCamelCase					,lowerCamelCase					,stride=lowerCamelCase					,activation=config.hidden_act     )					,*[layer(lowerCamelCase					,lowerCamelCase					,activation=config.hidden_act     ) for _ in range(depth - 1     )]					,)





   def   UpperCAmelCase__  (       self					:      str					,lowerCamelCase					:      Optional[int]     ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE   				=							input
      for layer in self.layers:
         __SCREAMING_SNAKE_CASE   				=							layer(lowerCamelCase     )
      return hidden_state







class __a			( nn.Module      ):





   def __init__(       self					:      List[str]					,lowerCamelCase					:      Dict     ):

      '''simple docstring'''

      super().__init__()
      __SCREAMING_SNAKE_CASE   				=							nn.ModuleList([]     )
      # based on `downsample_in_first_stage` the first layer of the first stage may or may not downsample the input
      self.stages.append(
          ResNetStage(
              lowerCamelCase					,config.embedding_size					,config.hidden_sizes[0]					,stride=2 if config.downsample_in_first_stage else 1					,depth=config.depths[0]					,)     )
      __SCREAMING_SNAKE_CASE   				=							zip(config.hidden_sizes					,config.hidden_sizes[1:]     )
      for (in_channels, out_channels), depth in zip(lowerCamelCase					,config.depths[1:]     ):
         self.stages.append(ResNetStage(lowerCamelCase					,lowerCamelCase					,lowerCamelCase					,depth=lowerCamelCase     )     )





   def   UpperCAmelCase__  (       self					:      Any					,lowerCamelCase					:      int					,lowerCamelCase					:      int = False					,lowerCamelCase					:      Tuple = True     ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE   				=							() if output_hidden_states else None

      for stage_module in self.stages:
         if output_hidden_states:
            __SCREAMING_SNAKE_CASE   				=							hidden_states + (hidden_state,)

         __SCREAMING_SNAKE_CASE   				=							stage_module(lowerCamelCase     )

      if output_hidden_states:
         __SCREAMING_SNAKE_CASE   				=							hidden_states + (hidden_state,)

      if not return_dict:
         return tuple(v for v in [hidden_state, hidden_states] if v is not None     )

      return BaseModelOutputWithNoAttention(
          last_hidden_state=lowerCamelCase					,hidden_states=lowerCamelCase					,)







class __a			( _snake_case      ):
   __UpperCamelCase :			Tuple						   =						ResNetConfig
   __UpperCamelCase :			Dict						   =						'resnet'
   __UpperCamelCase :			Dict						   =						'pixel_values'
   __UpperCamelCase :			int						   =						True





   def   UpperCAmelCase__  (       self					:      List[str]					,lowerCamelCase					:      Dict     ):

      '''simple docstring'''

      if isinstance(lowerCamelCase					,nn.Convad     ):
         nn.init.kaiming_normal_(module.weight					,mode="""fan_out"""					,nonlinearity="""relu"""     )
      elif isinstance(lowerCamelCase					,(nn.BatchNormad, nn.GroupNorm)     ):
         nn.init.constant_(module.weight					,1     )
         nn.init.constant_(module.bias					,0     )





   def   UpperCAmelCase__  (       self					:      List[Any]					,lowerCamelCase					:      Optional[Any]					,lowerCamelCase					:      Union[str, Any]=False     ):

      '''simple docstring'''

      if isinstance(lowerCamelCase					,lowerCamelCase     ):
         __SCREAMING_SNAKE_CASE   				=							value





a   	=    r"\n    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass. Use it\n    as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and\n    behavior.\n\n    Parameters:\n        config ([`ResNetConfig`]): Model configuration class with all the parameters of the model.\n            Initializing with a config file does not load the weights associated with the model, only the\n            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.\n"

a   	=    r"\n    Args:\n        pixel_values (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`):\n            Pixel values. Pixel values can be obtained using [`AutoImageProcessor`]. See\n            [`ConvNextImageProcessor.__call__`] for details.\n\n        output_hidden_states (`bool`, *optional*):\n            Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for\n            more detail.\n        return_dict (`bool`, *optional*):\n            Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.\n"







@add_start_docstrings(
    'The bare ResNet model outputting raw features without any specific head on top.', _snake_case, )
class __a			( _snake_case      ):





   def __init__(       self					:      Tuple					,lowerCamelCase					:      Tuple     ):

      '''simple docstring'''

      super().__init__(lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							config
      __SCREAMING_SNAKE_CASE   				=							ResNetEmbeddings(lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							ResNetEncoder(lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							nn.AdaptiveAvgPoolad((1, 1)     )
      # Initialize weights and apply final processing
      self.post_init()





   @add_start_docstrings_to_model_forward(lowerCamelCase     )
   @add_code_sample_docstrings(
       checkpoint=_CHECKPOINT_FOR_DOC					,output_type=lowerCamelCase					,config_class=_CONFIG_FOR_DOC					,modality="""vision"""					,expected_output=_EXPECTED_OUTPUT_SHAPE					,)
   def   UpperCAmelCase__  (       self					:      str					,lowerCamelCase					:      List[Any]					,lowerCamelCase					:      List[str] = None					,lowerCamelCase					:      Dict = None     ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE   				=							(
          output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
      )
      __SCREAMING_SNAKE_CASE   				=							return_dict if return_dict is not None else self.config.use_return_dict

      __SCREAMING_SNAKE_CASE   				=							self.embedder(lowerCamelCase     )

      __SCREAMING_SNAKE_CASE   				=							self.encoder(
          lowerCamelCase					,output_hidden_states=lowerCamelCase					,return_dict=lowerCamelCase     )

      __SCREAMING_SNAKE_CASE   				=							encoder_outputs[0]

      __SCREAMING_SNAKE_CASE   				=							self.pooler(lowerCamelCase     )

      if not return_dict:
         return (last_hidden_state, pooled_output) + encoder_outputs[1:]

      return BaseModelOutputWithPoolingAndNoAttention(
          last_hidden_state=lowerCamelCase					,pooler_output=lowerCamelCase					,hidden_states=encoder_outputs.hidden_states					,)







@add_start_docstrings(
    '\n    ResNet Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for\n    ImageNet.\n    ', _snake_case, )
class __a			( _snake_case      ):





   def __init__(       self					:      int					,lowerCamelCase					:      Dict     ):

      '''simple docstring'''

      super().__init__(lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							config.num_labels
      __SCREAMING_SNAKE_CASE   				=							ResNetModel(lowerCamelCase     )
      # classification head
      __SCREAMING_SNAKE_CASE   				=							nn.Sequential(
          nn.Flatten()					,nn.Linear(config.hidden_sizes[-1]					,config.num_labels     ) if config.num_labels > 0 else nn.Identity()					,)
      # initialize weights and apply final processing
      self.post_init()





   @add_start_docstrings_to_model_forward(lowerCamelCase     )
   @add_code_sample_docstrings(
       checkpoint=_IMAGE_CLASS_CHECKPOINT					,output_type=lowerCamelCase					,config_class=_CONFIG_FOR_DOC					,expected_output=_IMAGE_CLASS_EXPECTED_OUTPUT					,)
   def   UpperCAmelCase__  (       self					:      Union[str, Any]					,lowerCamelCase					:      Dict = None					,lowerCamelCase					:      Dict = None					,lowerCamelCase					:      str = None					,lowerCamelCase					:      List[str] = None					,):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE   				=							return_dict if return_dict is not None else self.config.use_return_dict

      __SCREAMING_SNAKE_CASE   				=							self.resnet(lowerCamelCase					,output_hidden_states=lowerCamelCase					,return_dict=lowerCamelCase     )

      __SCREAMING_SNAKE_CASE   				=							outputs.pooler_output if return_dict else outputs[1]

      __SCREAMING_SNAKE_CASE   				=							self.classifier(lowerCamelCase     )

      __SCREAMING_SNAKE_CASE   				=							None

      if labels is not None:
         if self.config.problem_type is None:
            if self.num_labels == 1:
               __SCREAMING_SNAKE_CASE   				=							"""regression"""
            elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
               __SCREAMING_SNAKE_CASE   				=							"""single_label_classification"""
            else:
               __SCREAMING_SNAKE_CASE   				=							"""multi_label_classification"""
         if self.config.problem_type == "regression":
            __SCREAMING_SNAKE_CASE   				=							MSELoss()
            if self.num_labels == 1:
               __SCREAMING_SNAKE_CASE   				=							loss_fct(logits.squeeze()					,labels.squeeze()     )
            else:
               __SCREAMING_SNAKE_CASE   				=							loss_fct(lowerCamelCase					,lowerCamelCase     )
         elif self.config.problem_type == "single_label_classification":
            __SCREAMING_SNAKE_CASE   				=							CrossEntropyLoss()
            __SCREAMING_SNAKE_CASE   				=							loss_fct(logits.view(-1					,self.num_labels     )					,labels.view(-1     )     )
         elif self.config.problem_type == "multi_label_classification":
            __SCREAMING_SNAKE_CASE   				=							BCEWithLogitsLoss()
            __SCREAMING_SNAKE_CASE   				=							loss_fct(lowerCamelCase					,lowerCamelCase     )

      if not return_dict:
         __SCREAMING_SNAKE_CASE   				=							(logits,) + outputs[2:]
         return (loss,) + output if loss is not None else output

      return ImageClassifierOutputWithNoAttention(loss=lowerCamelCase					,logits=lowerCamelCase					,hidden_states=outputs.hidden_states     )







@add_start_docstrings(
    '\n    ResNet backbone, to be used with frameworks like DETR and MaskFormer.\n    ', _snake_case, )
class __a			( _snake_case, _snake_case      ):





   def __init__(       self					:      Any					,lowerCamelCase					:      str     ):

      '''simple docstring'''

      super().__init__(lowerCamelCase     )
      super()._init_backbone(lowerCamelCase     )

      __SCREAMING_SNAKE_CASE   				=							[config.embedding_size] + config.hidden_sizes
      __SCREAMING_SNAKE_CASE   				=							ResNetEmbeddings(lowerCamelCase     )
      __SCREAMING_SNAKE_CASE   				=							ResNetEncoder(lowerCamelCase     )

      # initialize weights and apply final processing
      self.post_init()





   @add_start_docstrings_to_model_forward(lowerCamelCase     )
   @replace_return_docstrings(output_type=lowerCamelCase					,config_class=_CONFIG_FOR_DOC     )
   def   UpperCAmelCase__  (       self					:      int					,lowerCamelCase					:      List[Any]					,lowerCamelCase					:      List[str] = None					,lowerCamelCase					:      Dict = None     ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE   				=							return_dict if return_dict is not None else self.config.use_return_dict
      __SCREAMING_SNAKE_CASE   				=							(
          output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
      )

      __SCREAMING_SNAKE_CASE   				=							self.embedder(lowerCamelCase     )

      __SCREAMING_SNAKE_CASE   				=							self.encoder(lowerCamelCase					,output_hidden_states=lowerCamelCase					,return_dict=lowerCamelCase     )

      __SCREAMING_SNAKE_CASE   				=							outputs.hidden_states

      __SCREAMING_SNAKE_CASE   				=							()
      for idx, stage in enumerate(self.stage_names     ):
         if stage in self.out_features:
            feature_maps += (hidden_states[idx],)

      if not return_dict:
         __SCREAMING_SNAKE_CASE   				=							(feature_maps,)
         if output_hidden_states:
            output += (outputs.hidden_states,)
         return output

      return BackboneOutput(
          feature_maps=lowerCamelCase					,hidden_states=outputs.hidden_states if output_hidden_states else None					,attentions=lowerCamelCase					,)








from collections import UserDict
from typing import Union

import numpy as np
import requests

from ..utils import (
    add_end_docstrings,
    logging,
)
from .audio_classification import ffmpeg_read
from .base import PIPELINE_INIT_ARGS, Pipeline


lowercase_   							=  logging.get_logger(__name__)





@add_end_docstrings(SCREAMING_SNAKE_CASE				)
class 					__lowerCAmelCase	(   SCREAMING_SNAKE_CASE				):




  def __init__(							self				,  **lowerCAmelCase   )    ->					Tuple:
        '''simple docstring'''






        super().__init__(**lowerCAmelCase   )

        if self.framework != "pt":
              raise ValueError(F'''The {self.__class__} is only available in PyTorch.'''   )
        # No specific FOR_XXX available yet




  def __call__(							self				,  lowerCAmelCase				,  **lowerCAmelCase   )    ->					int:
        '''simple docstring'''






        return super().__call__(lowerCAmelCase				,  **lowerCAmelCase   )




  def     A__	(							self				,  **lowerCAmelCase   )    ->					Optional[Any]:
        '''simple docstring'''






        _lowercase      			={}
        if "candidate_labels" in kwargs:
              _lowercase      			=kwargs['candidate_labels']
        if "hypothesis_template" in kwargs:
              _lowercase      			=kwargs['hypothesis_template']

        return preprocess_params, {}, {}




  def     A__	(							self				,  lowerCAmelCase				,  lowerCAmelCase=None				,  lowerCAmelCase="This is a sound of {}."   )    ->					Tuple:
        '''simple docstring'''






        if isinstance(lowerCAmelCase				,  lowerCAmelCase   ):
              if audio.startswith('http://'   ) or audio.startswith('https://'   ):
                    # We need to actually check for a real protocol, otherwise it's impossible to use a local file
                    # like http_huggingface_co.png
                    _lowercase      			=requests.get(lowerCAmelCase   ).content
              else:
                    with open(lowerCAmelCase				,  'rb'   ) as f:
                          _lowercase      			=f.read()

        if isinstance(lowerCAmelCase				,  lowerCAmelCase   ):
              _lowercase      			=ffmpeg_read(lowerCAmelCase				,  self.feature_extractor.sampling_rate   )

        if not isinstance(lowerCAmelCase				,  np.ndarray   ):
              raise ValueError('We expect a numpy ndarray as input'   )
        if len(audio.shape   ) != 1:
              raise ValueError('We expect a single channel audio input for ZeroShotAudioClassificationPipeline'   )

        _lowercase      			=self.feature_extractor(
            [audio]				,  sampling_rate=self.feature_extractor.sampling_rate				,  return_tensors='pt'   )
        _lowercase      			=candidate_labels
        _lowercase      			=[hypothesis_template.format(lowerCAmelCase   ) for x in candidate_labels]
        _lowercase      			=self.tokenizer(lowerCAmelCase				,  return_tensors=self.framework				,  padding=lowerCAmelCase   )
        _lowercase      			=[text_inputs]
        return inputs




  def     A__	(							self				,  lowerCAmelCase   )    ->					Dict:
        '''simple docstring'''






        _lowercase      			=model_inputs.pop('candidate_labels'   )
        _lowercase      			=model_inputs.pop('text_inputs'   )
        if isinstance(text_inputs[0]				,  lowerCAmelCase   ):
              _lowercase      			=text_inputs[0]
        else:
              # Batching case.
              _lowercase      			=text_inputs[0][0]

        _lowercase      			=self.model(**lowerCAmelCase				,  **lowerCAmelCase   )

        _lowercase      			={
            'candidate_labels': candidate_labels,
            'logits': outputs.logits_per_audio,
        }
        return model_outputs




  def     A__	(							self				,  lowerCAmelCase   )    ->					Tuple:
        '''simple docstring'''






        _lowercase      			=model_outputs.pop('candidate_labels'   )
        _lowercase      			=model_outputs['logits'][0]

        if self.framework == "pt":
              _lowercase      			=logits.softmax(dim=0   )
              _lowercase      			=probs.tolist()
        else:
              raise ValueError('`tf` framework not supported.'   )

        _lowercase      			=[
            {'score': score, 'label': candidate_label}
            for score, candidate_label in sorted(zip(lowerCAmelCase				,  lowerCAmelCase   )				,  key=lambda lowerCAmelCase   : -x[0]   )
        ]
        return result


