code: 
  
  
  """simple docstring"""
  
  
  
  
  import json
  import os
  import tempfile
  
  import datasets
  from utils import generate_example_dataset, get_duration
  
  
  __SCREAMING_SNAKE_CASE					=						50_00_00
  
  __SCREAMING_SNAKE_CASE		,  __SCREAMING_SNAKE_CASE					=						os.path.split(__file__)
  __SCREAMING_SNAKE_CASE					=						os.path.join(RESULTS_BASEPATH, """results""", RESULTS_FILENAME.replace(""".py""", """.json"""))
  
  
  
  @get_duration
  def 						__a      (  a					):
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
  
         _a          =				dataset.select(range(0,		len(a					),		2					)					)
  
  
  
  @get_duration
  def 						__a      (  a					):
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
  
         _a          =				dataset.sort("numbers"					)
  
  
  
  @get_duration
  def 						__a      (  a					):
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
  
         _a          =				dataset.shuffle()
  
  
  
  @get_duration
  def 						__a      (  a					):
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
  
         _a          =				dataset.train_test_split(0.1					)
  
  
  
  @get_duration
  def 						__a      (  a,		a=1_0					):
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
  
         for shard_id in range(a					):
                _a          =				dataset.shard(a,		a					)
  
  
  
  def 						__a      (  ):
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
  
         _a          =				{"num examples": SPEED_TEST_N_EXAMPLES}
         _a          =				(select, sort, shuffle, train_test_split, shard)
         with tempfile.TemporaryDirectory() as tmp_dir:
                print("generating dataset"					)
                _a          =				datasets.Features({"text": datasets.Value("string"					), "numbers": datasets.Value("float32"					)}					)
                _a          =				generate_example_dataset(
                    os.path.join(a,		"dataset.arrow"					),		a,		num_examples=a					)
                print("Functions"					)
                for func in functions:
                       print(func.__name__					)
                       _a          =				func(a					)
  
         with open(a,		"wb"					) as f:
                f.write(json.dumps(a					).encode("utf-8"					)					)
  
  
  if __name__ == "__main__":  # useful to run the profiler
     benchmark_indices_mapping()
  
style_context: 
  
  
  """simple docstring"""
  
  
  
  
  import warnings
  from contextlib import contextmanager
  
  from ...processing_utils import ProcessorMixin
  
  
  
  
  
  class __snake_case		(					_SCREAMING_SNAKE_CASE      ):
  
  
  
  
  
  
  
     """simple docstring"""
  
  
  
  
     lowerCAmelCase_				:   str     	=			'AutoFeatureExtractor'
     lowerCAmelCase_				:   List[Any]     	=			'Speech2Text2Tokenizer'
  
  
  
  
     def __init__(		self							:int				,  UpperCamelCase__							:List[str]				,  UpperCamelCase__							:Union[str, Any]       ):
            super().__init__(UpperCamelCase__				,  UpperCamelCase__       )
            _a          =				self.feature_extractor
            _a          =				False
  
  
  
  
     def __call__(		self							:List[str]				,  *UpperCamelCase__							:List[str]				,  **UpperCamelCase__							:Dict       ):
            # For backward compatibility
            if self._in_target_context_manager:
                   return self.current_processor(*UpperCamelCase__				,  **UpperCamelCase__       )
  
            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"				,  UpperCamelCase__       )
            _a          =				kwargs.pop("sampling_rate"				,  UpperCamelCase__       )
            _a          =				kwargs.pop("text"				,  UpperCamelCase__       )
            if len(UpperCamelCase__       ) > 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(UpperCamelCase__				,  *UpperCamelCase__				,  sampling_rate=UpperCamelCase__				,  **UpperCamelCase__       )
            if text is not None:
                   _a          =				self.tokenizer(UpperCamelCase__				,  **UpperCamelCase__       )
  
            if text is None:
                   return inputs
            elif audio is None:
                   return encodings
            else:
                   _a          =				encodings["input_ids"]
                   return inputs
  
  
  
  
     def SCREAMING_SNAKE_CASE_      (		self							:Union[str, Any]				,  *UpperCamelCase__							:int				,  **UpperCamelCase__							:Optional[Any]       ):
            return self.tokenizer.batch_decode(*UpperCamelCase__				,  **UpperCamelCase__       )
  
  
  
  
     def SCREAMING_SNAKE_CASE_      (		self							:Optional[Any]				,  *UpperCamelCase__							:List[Any]				,  **UpperCamelCase__							:List[Any]       ):
            return self.tokenizer.decode(*UpperCamelCase__				,  **UpperCamelCase__       )
  
  
  
  
     @contextmanager
     def SCREAMING_SNAKE_CASE_      (		self							:Dict       ):
            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
  