from ...configuration_utils import PretrainedConfig
from ...utils import logging


__SCREAMING_SNAKE_CASE						:    List[Any]     = logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE						:    Dict     = {
    'google/reformer-crime-and-punishment': (
        'https://huggingface.co/google/reformer-crime-and-punishment/resolve/main/config.json'
    ),
    'google/reformer-enwik8': 'https://huggingface.co/google/reformer-enwik8/resolve/main/config.json',
}



class    lowercase_    (     __snake_case		):
							_lowerCamelCase						=		'reformer'
							_lowerCamelCase						=		['past_buckets_states']
							_lowerCamelCase						=		{}



							def __init__(						self      ,				lowercase_=64      ,				lowercase_=["local", "lsh", "local", "lsh", "local", "lsh"]      ,				lowercase_=1.0      ,				lowercase_=True      ,				lowercase_=[64, 64]      ,				lowercase_=[64, 192]      ,				lowercase_=0      ,				lowercase_=2      ,				lowercase_=512      ,				lowercase_=None      ,				lowercase_="relu"      ,				lowercase_=0.05      ,				lowercase_=256      ,				lowercase_=0.02      ,				lowercase_=False      ,				lowercase_=1e-12      ,				lowercase_=1      ,				lowercase_=0      ,				lowercase_=0.05      ,				lowercase_=64      ,				lowercase_=64      ,				lowercase_=0.0      ,				lowercase_=1      ,				lowercase_=0      ,				lowercase_=4_096      ,				lowercase_=12      ,				lowercase_=None      ,				lowercase_=1      ,				lowercase_=0      ,				lowercase_=320      ,				lowercase_=False      ,				lowercase_=True      ,				lowercase_=None      ,				**lowercase_      ,				):
													_snake_case						:     Optional[int]				=    hash_seed
													_snake_case						:     Tuple				=    vocab_size
													_snake_case						:     List[str]				=    attention_head_size
													_snake_case						:     int				=    hidden_size
													_snake_case						:     Optional[int]				=    num_attention_heads
													_snake_case						:     Dict				=    num_hashes
													_snake_case						:     Optional[int]				=    len(lowercase_				)
													_snake_case						:     int				=    tuple(lowercase_				) if isinstance(lowercase_      ,				lowercase_				) else num_buckets
													_snake_case						:     List[Any]				=    lsh_attn_chunk_length
													_snake_case						:     str				=    local_attn_chunk_length
													_snake_case						:     Union[str, Any]				=    lsh_num_chunks_after
													_snake_case						:     List[Any]				=    lsh_num_chunks_before
													_snake_case						:     Union[str, Any]				=    local_num_chunks_after
													_snake_case						:     Dict				=    local_num_chunks_before
													_snake_case						:     Optional[int]				=    hidden_act
													_snake_case						:     Union[str, Any]				=    feed_forward_size
													_snake_case						:     Optional[Any]				=    hidden_dropout_prob
													_snake_case						:     Dict				=    lsh_attention_probs_dropout_prob
													_snake_case						:     str				=    local_attention_probs_dropout_prob
													_snake_case						:     str				=    max_position_embeddings
													_snake_case						:     Optional[Any]				=    initializer_range
													_snake_case						:     Dict				=    layer_norm_eps
													_snake_case						:     int				=    axial_pos_embds
													_snake_case						:     Dict				=    tuple(lowercase_				)
													_snake_case						:     Union[str, Any]				=    tuple(lowercase_				)
													_snake_case						:     Optional[Any]				=    axial_norm_std
													_snake_case						:     Optional[Any]				=    chunk_size_lm_head
													_snake_case						:     Any				=    attn_layers
													_snake_case						:     Optional[int]				=    use_cache
													_snake_case						:     str				=    classifier_dropout
													super().__init__(
													    pad_token_id=lowercase_      ,				eos_token_id=lowercase_      ,				is_decoder=lowercase_      ,				tie_word_embeddings=lowercase_      ,				**lowercase_      ,				)






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

from ...processing_utils import ProcessorMixin







class 	a				(					a__   ):
 snake_case__    	=    '''AutoFeatureExtractor'''
 snake_case__    	=    '''Speech2Text2Tokenizer'''



 def __init__(			self							,    _snake_case							,    _snake_case			):







  """simple docstring"""






  super().__init__(_snake_case							,    _snake_case			)
  lowerCAmelCase  							=      self.feature_extractor
  lowerCAmelCase  							=      False



 def __call__(			self							,    *_snake_case							,    **_snake_case			):







  """simple docstring"""






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

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

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



 def 					UpperCamelCase__   (			self							,    *_snake_case							,    **_snake_case			):







  """simple docstring"""






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



 def 					UpperCamelCase__   (			self							,    *_snake_case							,    **_snake_case			):







  """simple docstring"""






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



 @contextmanager
 def 					UpperCamelCase__   (			self			):







  """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.'			)
  lowerCAmelCase  							=      True
  lowerCAmelCase  							=      self.tokenizer
  yield
  lowerCAmelCase  							=      self.feature_extractor
  lowerCAmelCase  							=      False





