'''simple docstring'''




from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding






class 		__A       (__magic_name__   ):
       snake_case       :Optional[int]				    =					["image_processor", "tokenizer"]
       snake_case       :str				    =					"AutoImageProcessor"
       snake_case       :Optional[Any]				    =					"AutoTokenizer"






       def __init__(      self				,     UpperCamelCase_				,     UpperCamelCase_      ):
              super().__init__(UpperCamelCase_				,     UpperCamelCase_      )
              __UpperCAmelCase  :				int       				=		self.image_processor






       def __call__(      self				,     UpperCamelCase_=None				,     UpperCamelCase_=None				,     UpperCamelCase_=None				,     **UpperCamelCase_      ):

              if text is None and images is None:
                     raise ValueError("You have to specify either text or images. Both cannot be none."      )

              if text is not None:
                     __UpperCAmelCase  :				str       				=		self.tokenizer(UpperCamelCase_				,     return_tensors=UpperCamelCase_				,     **UpperCamelCase_      )

              if images is not None:
                     __UpperCAmelCase  :				int       				=		self.image_processor(UpperCamelCase_				,     return_tensors=UpperCamelCase_				,     **UpperCamelCase_      )

              if text is not None and images is not None:
                     __UpperCAmelCase  :				Optional[int]       				=		image_features.pixel_values
                     return encoding
              elif text is not None:
                     return encoding
              else:
                     return BatchEncoding(data=dict(**UpperCamelCase_      )				,     tensor_type=UpperCamelCase_      )






       def 			_snake_case						(      self				,     *UpperCamelCase_				,     **UpperCamelCase_      ):
              return self.tokenizer.batch_decode(*UpperCamelCase_				,     **UpperCamelCase_      )






       def 			_snake_case						(      self				,     *UpperCamelCase_				,     **UpperCamelCase_      ):
              return self.tokenizer.decode(*UpperCamelCase_				,     **UpperCamelCase_      )







       @property
       def 			_snake_case						(      self      ):
              return ["input_ids", "attention_mask", "pixel_values"]



'''simple docstring'''




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


_a   :	Any 							=   logging.get_logger(__name__)

_a   :	int 							=   {
    "facebook/s2t-wav2vec2-large-en-de": (
        "https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/config.json"
    ),
    # See all Speech2Text models at https://huggingface.co/models?filter=speech2text2
}






class 		__A       (__magic_name__   ):
       snake_case       :Optional[int]				    =					"speech_to_text_2"
       snake_case       :List[Any]				    =					["past_key_values"]
       snake_case       :str				    =					{"num_attention_heads": "decoder_attention_heads", "hidden_size": "d_model"}






       def __init__(      self				,     UpperCamelCase_=1_00_00				,     UpperCamelCase_=6				,     UpperCamelCase_=20_48				,     UpperCamelCase_=4				,     UpperCamelCase_=0.0				,     UpperCamelCase_=True				,     UpperCamelCase_="relu"				,     UpperCamelCase_=2_56				,     UpperCamelCase_=0.1				,     UpperCamelCase_=0.0				,     UpperCamelCase_=0.0				,     UpperCamelCase_=0.0_2				,     UpperCamelCase_=2				,     UpperCamelCase_=True				,     UpperCamelCase_=1				,     UpperCamelCase_=0				,     UpperCamelCase_=2				,     UpperCamelCase_=10_24				,     **UpperCamelCase_				,     ):
              __UpperCAmelCase  :				Any       				=		vocab_size
              __UpperCAmelCase  :				Optional[int]       				=		d_model
              __UpperCAmelCase  :				Tuple       				=		decoder_ffn_dim
              __UpperCAmelCase  :				List[str]       				=		decoder_layers
              __UpperCAmelCase  :				str       				=		decoder_attention_heads
              __UpperCAmelCase  :				Dict       				=		dropout
              __UpperCAmelCase  :				Optional[Any]       				=		attention_dropout
              __UpperCAmelCase  :				int       				=		activation_dropout
              __UpperCAmelCase  :				Dict       				=		activation_function
              __UpperCAmelCase  :				Tuple       				=		init_std
              __UpperCAmelCase  :				Any       				=		decoder_layerdrop
              __UpperCAmelCase  :				str       				=		use_cache
              __UpperCAmelCase  :				int       				=		decoder_layers
              __UpperCAmelCase  :				Any       				=		scale_embedding  # scale factor will be sqrt(d_model) if True
              __UpperCAmelCase  :				Union[str, Any]       				=		max_target_positions

              super().__init__(
                  pad_token_id=UpperCamelCase_				,     bos_token_id=UpperCamelCase_				,     eos_token_id=UpperCamelCase_				,     decoder_start_token_id=UpperCamelCase_				,     **UpperCamelCase_				,     )






