





import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin
from .feature_extraction_wavaveca import WavaVecaFeatureExtractor
from .tokenization_wavaveca import WavaVecaCTCTokenizer

class   A							(						__lowercase    ):
      _snake_case				  ='''Wav2Vec2FeatureExtractor'''
      _snake_case				  ='''AutoTokenizer'''



      def __init__(						self:    Optional[Any]		,	_lowerCAmelCase:    Optional[Any]		,	_lowerCAmelCase:    Any							)    ->     List[str]:
         '''simple docstring'''

         super().__init__(_lowerCAmelCase		,	_lowerCAmelCase							)
         UpperCAmelCase_           =self.feature_extractor
         UpperCAmelCase_           =False



      @classmethod
      def 						lowerCAmelCase__     (						cls:    List[Any]		,	_lowerCAmelCase:    int		,	**_lowerCAmelCase:    int							)    ->     int:
         '''simple docstring'''

         try:
            return super().from_pretrained(_lowerCAmelCase		,	**_lowerCAmelCase							)
         except OSError:
            warnings.warn(
                F'Loading a tokenizer inside {cls.__name__} from a config that does not'
                " include a `tokenizer_class` attribute is deprecated and will be "
                "removed in v5. Please add `'tokenizer_class': 'Wav2Vec2CTCTokenizer'`"
                " attribute to either your `config.json` or `tokenizer_config.json` "
                "file to suppress this warning: "		,	_lowerCAmelCase		,	)

            UpperCAmelCase_           =WavaVecaFeatureExtractor.from_pretrained(_lowerCAmelCase		,	**_lowerCAmelCase							)
            UpperCAmelCase_           =WavaVecaCTCTokenizer.from_pretrained(_lowerCAmelCase		,	**_lowerCAmelCase							)

            return cls(feature_extractor=_lowerCAmelCase		,	tokenizer=_lowerCAmelCase							)



      def __call__(						self:    Dict		,	*_lowerCAmelCase:    List[str]		,	**_lowerCAmelCase:    Union[str, Any]							)    ->     List[Any]:
         '''simple docstring'''

         if self._in_target_context_manager:
            return self.current_processor(*_lowerCAmelCase		,	**_lowerCAmelCase							)

         if "raw_speech" in kwargs:
            warnings.warn("Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead."							)
            UpperCAmelCase_           =kwargs.pop("raw_speech"							)
         else:
            UpperCAmelCase_           =kwargs.pop("audio"		,	_lowerCAmelCase							)
         UpperCAmelCase_           =kwargs.pop("sampling_rate"		,	_lowerCAmelCase							)
         UpperCAmelCase_           =kwargs.pop("text"		,	_lowerCAmelCase							)
         if len(_lowerCAmelCase							) > 0:
            UpperCAmelCase_           =args[0]
            UpperCAmelCase_           =args[1:]

         if audio is None and text is None:
            raise ValueError("You need to specify either an `audio` or `text` input to process."							)

         if audio is not None:
            UpperCAmelCase_           =self.feature_extractor(_lowerCAmelCase		,	*_lowerCAmelCase		,	sampling_rate=_lowerCAmelCase		,	**_lowerCAmelCase							)
         if text is not None:
            UpperCAmelCase_           =self.tokenizer(_lowerCAmelCase		,	**_lowerCAmelCase							)

         if text is None:
            return inputs
         elif audio is None:
            return encodings
         else:
            UpperCAmelCase_           =encodings["input_ids"]
            return inputs



      def 						lowerCAmelCase__     (						self:    str		,	*_lowerCAmelCase:    str		,	**_lowerCAmelCase:    Optional[int]							)    ->     Union[str, Any]:
         '''simple docstring'''

         if self._in_target_context_manager:
            return self.current_processor.pad(*_lowerCAmelCase		,	**_lowerCAmelCase							)

         UpperCAmelCase_           =kwargs.pop("input_features"		,	_lowerCAmelCase							)
         UpperCAmelCase_           =kwargs.pop("labels"		,	_lowerCAmelCase							)
         if len(_lowerCAmelCase							) > 0:
            UpperCAmelCase_           =args[0]
            UpperCAmelCase_           =args[1:]

         if input_features is not None:
            UpperCAmelCase_           =self.feature_extractor.pad(_lowerCAmelCase		,	*_lowerCAmelCase		,	**_lowerCAmelCase							)
         if labels is not None:
            UpperCAmelCase_           =self.tokenizer.pad(_lowerCAmelCase		,	**_lowerCAmelCase							)

         if labels is None:
            return input_features
         elif input_features is None:
            return labels
         else:
            UpperCAmelCase_           =labels["input_ids"]
            return input_features



      def 						lowerCAmelCase__     (						self:    List[Any]		,	*_lowerCAmelCase:    Optional[int]		,	**_lowerCAmelCase:    Tuple							)    ->     Optional[int]:
         '''simple docstring'''

         return self.tokenizer.batch_decode(*_lowerCAmelCase		,	**_lowerCAmelCase							)



      def 						lowerCAmelCase__     (						self:    Dict		,	*_lowerCAmelCase:    List[Any]		,	**_lowerCAmelCase:    str							)    ->     str:
         '''simple docstring'''

         return self.tokenizer.decode(*_lowerCAmelCase		,	**_lowerCAmelCase							)






      @contextmanager
      def 						lowerCAmelCase__     (						self:    Union[str, Any]							)    ->     int:
         '''simple docstring'''

         warnings.warn(
             "`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your "
             "labels by using the argument `text` of the regular `__call__` method (either in the same call as "
             "your audio inputs, or in a separate call."							)
         UpperCAmelCase_           =True
         UpperCAmelCase_           =self.tokenizer
         yield
         UpperCAmelCase_           =self.feature_extractor
         UpperCAmelCase_           =False












"""simple docstring"""





from collections import OrderedDict
from typing import List, Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


__lowerCamelCase							=  logging.get_logger(__name__)

__lowerCamelCase							=  {
    'google/efficientnet-b7': 'https://huggingface.co/google/efficientnet-b7/resolve/main/config.json',
}



class       __A		(   SCREAMING_SNAKE_CASE_			):
					UpperCAmelCase__								=				"efficientnet"

					def __init__(			self  :      Optional[Any]     ,		__snake_case  :      int = 3     ,		__snake_case  :      int = 6_0_0     ,		__snake_case  :      float = 2.0     ,		__snake_case  :      float = 3.1     ,		__snake_case  :      int = 8     ,		__snake_case  :      List[int] = [3, 3, 5, 3, 5, 5, 3]     ,		__snake_case  :      List[int] = [3_2, 1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2]     ,		__snake_case  :      List[int] = [1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2, 3_2_0]     ,		__snake_case  :      List[int] = []     ,		__snake_case  :      List[int] = [1, 2, 2, 2, 1, 2, 1]     ,		__snake_case  :      List[int] = [1, 2, 2, 3, 3, 4, 1]     ,		__snake_case  :      List[int] = [1, 6, 6, 6, 6, 6, 6]     ,		__snake_case  :      float = 0.25     ,		__snake_case  :      str = "swish"     ,		__snake_case  :      int = 2_5_6_0     ,		__snake_case  :      str = "mean"     ,		__snake_case  :      float = 0.02     ,		__snake_case  :      float = 0.001     ,		__snake_case  :      float = 0.99     ,		__snake_case  :      float = 0.5     ,		__snake_case  :      float = 0.2     ,		**__snake_case  :      List[Any]     ,		)			->							List[Any]:
											super().__init__(**__snake_case					)

											__magic_name__:	str							=       num_channels
											__magic_name__:	List[str]							=       image_size
											__magic_name__:	List[str]							=       width_coefficient
											__magic_name__:	Optional[Any]							=       depth_coefficient
											__magic_name__:	Tuple							=       depth_divisor
											__magic_name__:	Dict							=       kernel_sizes
											__magic_name__:	int							=       in_channels
											__magic_name__:	str							=       out_channels
											__magic_name__:	Dict							=       depthwise_padding
											__magic_name__:	Union[str, Any]							=       strides
											__magic_name__:	Dict							=       num_block_repeats
											__magic_name__:	Tuple							=       expand_ratios
											__magic_name__:	List[str]							=       squeeze_expansion_ratio
											__magic_name__:	Any							=       hidden_act
											__magic_name__:	Tuple							=       hidden_dim
											__magic_name__:	int							=       pooling_type
											__magic_name__:	int							=       initializer_range
											__magic_name__:	List[str]							=       batch_norm_eps
											__magic_name__:	str							=       batch_norm_momentum
											__magic_name__:	List[str]							=       dropout_rate
											__magic_name__:	Dict							=       drop_connect_rate
											__magic_name__:	Optional[Any]							=       sum(__snake_case					) * 4



class       __A		(   SCREAMING_SNAKE_CASE_			):
					UpperCAmelCase__								=				version.parse("1.11"			)

					@property
					def   lowerCamelCase__   (			self  :      List[str]					)			->							Mapping[str, Mapping[int, str]]:
											return OrderedDict(
											    [
											        ("""pixel_values""", {0: """batch""", 1: """num_channels""", 2: """height""", 3: """width"""}),
											    ]					)






					@property
					def   lowerCamelCase__   (			self  :      List[Any]					)			->							float:
											return 1E-5



