



"""simple docstring"""
import warnings
from contextlib import contextmanager

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




class 			snake_case_						(						a_				):
							__lowerCAmelCase    					=					"Wav2Vec2FeatureExtractor"
							__lowerCAmelCase    					=					"AutoTokenizer"






							def __init__(   self			,     a_			,     a_      ):
									super().__init__(a_			,     a_      )
									a_     :      str 						=     self.feature_extractor
									a_     :      Optional[Any] 						=     False






							@classmethod
							def snake_case_  (   cls			,     a_			,     **a_      ):
									try:
											return super().from_pretrained(a_			,     **a_      )
									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: "			,     a_			,     )

											a_     :      Union[str, Any] 						=     WavaVecaFeatureExtractor.from_pretrained(a_			,     **a_      )
											a_     :      List[Any] 						=     WavaVecaCTCTokenizer.from_pretrained(a_			,     **a_      )

											return cls(feature_extractor=a_			,     tokenizer=a_      )






							def __call__(   self			,     *a_			,     **a_      ):
									# 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_     :      Optional[Any] 						=     kwargs.pop("raw_speech"      )
									else:
											a_     :      List[str] 						=     kwargs.pop("audio"			,     a_      )
									a_     :      Optional[Any] 						=     kwargs.pop("sampling_rate"			,     a_      )
									a_     :      str 						=     kwargs.pop("text"			,     a_      )
									if len(a_      ) > 0:
											a_     :      str 						=     args[0]
											a_     :      Any 						=     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_     :      Any 						=     self.feature_extractor(a_			,     *a_			,     sampling_rate=a_			,     **a_      )
									if text is not None:
											a_     :      Optional[int] 						=     self.tokenizer(a_			,     **a_      )

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






							def snake_case_  (   self			,     *a_			,     **a_      ):
									# For backward compatibility
									if self._in_target_context_manager:
											return self.current_processor.pad(*a_			,     **a_      )

									a_     :      Dict 						=     kwargs.pop("input_features"			,     a_      )
									a_     :      List[Any] 						=     kwargs.pop("labels"			,     a_      )
									if len(a_      ) > 0:
											a_     :      Tuple 						=     args[0]
											a_     :      str 						=     args[1:]

									if input_features is not None:
											a_     :      Any 						=     self.feature_extractor.pad(a_			,     *a_			,     **a_      )
									if labels is not None:
											a_     :      List[str] 						=     self.tokenizer.pad(a_			,     **a_      )

									if labels is None:
											return input_features
									elif input_features is None:
											return labels
									else:
											a_     :      List[Any] 						=     labels["input_ids"]
											return input_features






							def snake_case_  (   self			,     *a_			,     **a_      ):
									return self.tokenizer.batch_decode(*a_			,     **a_      )






							def snake_case_  (   self			,     *a_			,     **a_      ):
									return self.tokenizer.decode(*a_			,     **a_      )






							@contextmanager
							def snake_case_  (   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_     :      List[Any] 						=     True
									a_     :      List[Any] 						=     self.tokenizer
									yield
									a_     :      Union[str, Any] 						=     self.feature_extractor
									a_     :      List[Any] 						=     False




"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging


SCREAMING_SNAKE_CASE_				= logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_				= {
    """uw-madison/mra-base-512-4""": """https://huggingface.co/uw-madison/mra-base-512-4/resolve/main/config.json""",
}




class 			snake_case_						(						a_				):
							__lowerCAmelCase    					=					"mra"






							def __init__(   self			,     a_=5_0_2_6_5			,     a_=7_6_8			,     a_=1_2			,     a_=1_2			,     a_=3_0_7_2			,     a_="gelu"			,     a_=0.1			,     a_=0.1			,     a_=5_1_2			,     a_=1			,     a_=0.02			,     a_=1e-5			,     a_="absolute"			,     a_=4			,     a_="full"			,     a_=0			,     a_=0			,     a_=1			,     a_=0			,     a_=2			,     **a_			,     ):
									super().__init__(pad_token_id=a_			,     bos_token_id=a_			,     eos_token_id=a_			,     **a_      )

									a_     :      Optional[int] 						=     vocab_size
									a_     :      Dict 						=     max_position_embeddings
									a_     :      str 						=     hidden_size
									a_     :      Optional[int] 						=     num_hidden_layers
									a_     :      List[Any] 						=     num_attention_heads
									a_     :      List[str] 						=     intermediate_size
									a_     :      Tuple 						=     hidden_act
									a_     :      List[Any] 						=     hidden_dropout_prob
									a_     :      List[str] 						=     attention_probs_dropout_prob
									a_     :      List[Any] 						=     initializer_range
									a_     :      Dict 						=     type_vocab_size
									a_     :      Union[str, Any] 						=     layer_norm_eps
									a_     :      List[str] 						=     position_embedding_type
									a_     :      Union[str, Any] 						=     block_per_row
									a_     :      Tuple 						=     approx_mode
									a_     :      Optional[Any] 						=     initial_prior_first_n_blocks
									a_     :      List[str] 						=     initial_prior_diagonal_n_blocks