'''simple docstring'''





import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin





class      lowerCAmelCase						(					_lowercase			):
     _SCREAMING_SNAKE_CASE     :     Dict		='''MCTCTFeatureExtractor'''
     _SCREAMING_SNAKE_CASE     :     Optional[int]		='''AutoTokenizer'''



     def __init__(					self				,      lowerCAmelCase__				,      lowerCAmelCase__       ):
            super().__init__(A_				,      A_       )
            _A=	self.feature_extractor
            _A=	False



     def __call__(					self				,      *lowerCAmelCase__				,      **lowerCAmelCase__       ):
            # For backward compatibility
            if self._in_target_context_manager:
                   return self.current_processor(*A_				,      **A_       )

            if "raw_speech" in kwargs:
                   warnings.warn('Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead.'       )
                   _A=	kwargs.pop('raw_speech'       )
            else:
                   _A=	kwargs.pop('audio'				,      A_       )
            _A=	kwargs.pop('sampling_rate'				,      A_       )
            _A=	kwargs.pop('text'				,      A_       )
            if len(A_       ) > 0:
                   _A=	args[0]
                   _A=	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:
                   _A=	self.feature_extractor(A_				,      *A_				,      sampling_rate=A_				,      **A_       )
            if text is not None:
                   _A=	self.tokenizer(A_				,      **A_       )

            if text is None:
                   return inputs
            elif audio is None:
                   return encodings
            else:
                   _A=	encodings['input_ids']
                   return inputs



     def 			a__  (					self				,      *lowerCAmelCase__				,      **lowerCAmelCase__       ):
            return self.tokenizer.batch_decode(*A_				,      **A_       )



     def 			a__  (					self				,      *lowerCAmelCase__				,      **lowerCAmelCase__       ):
            # For backward compatibility
            if self._in_target_context_manager:
                   return self.current_processor.pad(*A_				,      **A_       )

            _A=	kwargs.pop('input_features'				,      A_       )
            _A=	kwargs.pop('labels'				,      A_       )
            if len(A_       ) > 0:
                   _A=	args[0]
                   _A=	args[1:]

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

            if labels is None:
                   return input_features
            elif input_features is None:
                   return labels
            else:
                   _A=	labels['input_ids']
                   return input_features



     def 			a__  (					self				,      *lowerCAmelCase__				,      **lowerCAmelCase__       ):
            return self.tokenizer.decode(*A_				,      **A_       )





     @contextmanager
     def 			a__  (					self       ):
            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.'       )
            _A=	True
            _A=	self.tokenizer
            yield
            _A=	self.feature_extractor
            _A=	False
import warnings
from collections import OrderedDict
from typing import Mapping

from packaging import version

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


UpperCAmelCase_								=							logging.get_logger(__name__)

UpperCAmelCase_								=							{
    '''nvidia/segformer-b0-finetuned-ade-512-512''': (
        '''https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512/resolve/main/config.json'''
    ),
    # See all SegFormer models at https://huggingface.co/models?filter=segformer
}





class      lowerCAmelCase						(					_a			):
     _SCREAMING_SNAKE_CASE     :     Tuple		="""segformer"""



     def __init__(					self				,      lowerCAmelCase__=3				,      lowerCAmelCase__=4				,      lowerCAmelCase__=[2, 2, 2, 2]				,      lowerCAmelCase__=[8, 4, 2, 1]				,      lowerCAmelCase__=[32, 64, 160, 256]				,      lowerCAmelCase__=[7, 3, 3, 3]				,      lowerCAmelCase__=[4, 2, 2, 2]				,      lowerCAmelCase__=[1, 2, 5, 8]				,      lowerCAmelCase__=[4, 4, 4, 4]				,      lowerCAmelCase__="gelu"				,      lowerCAmelCase__=0.0				,      lowerCAmelCase__=0.0				,      lowerCAmelCase__=0.1				,      lowerCAmelCase__=0.02				,      lowerCAmelCase__=0.1				,      lowerCAmelCase__=1E-6				,      lowerCAmelCase__=256				,      lowerCAmelCase__=255				,      **lowerCAmelCase__				,      ):
            super().__init__(**lowerCAmelCase__       )

            if "reshape_last_stage" in kwargs and kwargs["reshape_last_stage"] is False:
                   warnings.warn(
                       'Reshape_last_stage is set to False in this config. This argument is deprecated and will soon be'
                       ' removed, as the behaviour will default to that of reshape_last_stage = True.'				,      lowerCAmelCase__				,      )

            _A=	num_channels
            _A=	num_encoder_blocks
            _A=	depths
            _A=	sr_ratios
            _A=	hidden_sizes
            _A=	patch_sizes
            _A=	strides
            _A=	mlp_ratios
            _A=	num_attention_heads
            _A=	hidden_act
            _A=	hidden_dropout_prob
            _A=	attention_probs_dropout_prob
            _A=	classifier_dropout_prob
            _A=	initializer_range
            _A=	drop_path_rate
            _A=	layer_norm_eps
            _A=	decoder_hidden_size
            _A=	kwargs.get('reshape_last_stage'				,      lowerCAmelCase__       )
            _A=	semantic_loss_ignore_index





class      lowerCAmelCase						(					_a			):
     _SCREAMING_SNAKE_CASE     :     List[str]		=version.parse("""1.11"""			)



     @property
     def 			a__  (					self       ):
            return OrderedDict(
                [
                    ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
                ]       )



     @property
     def 			a__  (					self       ):
            return 1E-4





     @property
     def 			a__  (					self       ):
            return 12