




import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin
class 			_UpperCamelCase      (				lowercase__		):
      UpperCAmelCase_        =		"""Speech2TextFeatureExtractor"""
      UpperCAmelCase_        =		"""Speech2TextTokenizer"""
      def __init__(			self   :Optional[int] ,      lowerCamelCase   :Tuple ,      lowerCamelCase   :Optional[int]      )     ->			Optional[int]:
       super().__init__(__lowerCamelCase ,      __lowerCamelCase      )
       UpperCAmelCase__							 =						self.feature_extractor
       UpperCAmelCase__							 =						False
      def __call__(			self   :Optional[int] ,      *lowerCamelCase   :List[Any] ,      **lowerCamelCase   :str      )     ->			Optional[Any]:



       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 	UpperCAmelCase_						(			self   :Optional[int] ,      *lowerCamelCase   :str ,      **lowerCamelCase   :Optional[Any]      )     ->			Tuple:
       return self.tokenizer.batch_decode(*__lowerCamelCase ,      **__lowerCamelCase      )
      def 	UpperCAmelCase_						(			self   :Union[str, Any] ,      *lowerCamelCase   :int ,      **lowerCamelCase   :List[Any]      )     ->			List[str]:
       return self.tokenizer.decode(*__lowerCamelCase ,      **__lowerCamelCase      )







      @contextmanager
      def 	UpperCAmelCase_						(			self   :List[Any]      )     ->			Optional[Any]:
       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











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


_lowerCAmelCase						:   Union[str, Any]		=   logging.get_logger(__name__)

_lowerCAmelCase						:   Tuple		=   {
    "CarlCochet/trajectory-transformer-halfcheetah-medium-v2": (
        "https://huggingface.co/CarlCochet/trajectory-transformer-halfcheetah-medium-v2/resolve/main/config.json"
    ),
    # See all TrajectoryTransformer models at https://huggingface.co/models?filter=trajectory_transformer
}
class 			_UpperCamelCase      (				lowerCAmelCase		):
      UpperCAmelCase_        =		"""trajectory_transformer"""
      UpperCAmelCase_        =		["""past_key_values"""]
      UpperCAmelCase_        =		{
          """hidden_size""": """n_embd""",
          """num_attention_heads""": """n_head""",
          """num_hidden_layers""": """n_layer""",
      }
      def __init__(			self   :Union[str, Any] ,      lowerCamelCase   :Optional[int]=100 ,      lowerCamelCase   :Optional[int]=5 ,      lowerCamelCase   :Optional[Any]=1 ,      lowerCamelCase   :Any=1 ,      lowerCamelCase   :int=249 ,      lowerCamelCase   :Optional[Any]=6 ,      lowerCamelCase   :Optional[Any]=17 ,      lowerCamelCase   :Optional[int]=25 ,      lowerCamelCase   :Union[str, Any]=4 ,      lowerCamelCase   :Union[str, Any]=4 ,      lowerCamelCase   :Optional[int]=128 ,      lowerCamelCase   :List[Any]=0.1 ,      lowerCamelCase   :List[str]=0.1 ,      lowerCamelCase   :Tuple=0.1 ,      lowerCamelCase   :Dict=0.00_06 ,      lowerCamelCase   :Dict=512 ,      lowerCamelCase   :Optional[Any]=0.02 ,      lowerCamelCase   :Any=1e-12 ,      lowerCamelCase   :Optional[Any]=1 ,      lowerCamelCase   :List[Any]=True ,      lowerCamelCase   :int=1 ,      lowerCamelCase   :Dict=5_0256 ,      lowerCamelCase   :Union[str, Any]=5_0256 ,      **lowerCamelCase   :int ,      )     ->			Optional[Any]:
       UpperCAmelCase__							 =						vocab_size
       UpperCAmelCase__							 =						action_weight
       UpperCAmelCase__							 =						reward_weight
       UpperCAmelCase__							 =						value_weight
       UpperCAmelCase__							 =						max_position_embeddings
       UpperCAmelCase__							 =						block_size
       UpperCAmelCase__							 =						action_dim
       UpperCAmelCase__							 =						observation_dim
       UpperCAmelCase__							 =						transition_dim
       UpperCAmelCase__							 =						learning_rate
       UpperCAmelCase__							 =						n_layer
       UpperCAmelCase__							 =						n_head
       UpperCAmelCase__							 =						n_embd
       UpperCAmelCase__							 =						embd_pdrop
       UpperCAmelCase__							 =						attn_pdrop
       UpperCAmelCase__							 =						resid_pdrop
       UpperCAmelCase__							 =						initializer_range
       UpperCAmelCase__							 =						layer_norm_eps
       UpperCAmelCase__							 =						kaiming_initializer_range
       UpperCAmelCase__							 =						use_cache
       super().__init__(pad_token_id=lowerCamelCase ,      bos_token_id=lowerCamelCase ,      eos_token_id=lowerCamelCase ,      **lowerCamelCase      )





