


"""simple docstring"""






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


__snake_case		=       logging.get_logger(__name__)

__snake_case		=       {
    '''speechbrain/m-ctc-t-large''': '''https://huggingface.co/speechbrain/m-ctc-t-large/resolve/main/config.json''',
    # See all M-CTC-T models at https://huggingface.co/models?filter=mctct
}


class     __lowerCamelCase  (					a__				):

     '''simple docstring'''
     A_       :	Any    =		'mctct'


     def __init__(      self    ,				__UpperCAmelCase=8065    ,				__UpperCAmelCase=1536    ,				__UpperCAmelCase=36    ,				__UpperCAmelCase=6144    ,				__UpperCAmelCase=4    ,				__UpperCAmelCase=384    ,				__UpperCAmelCase=920    ,				__UpperCAmelCase=1e-5    ,				__UpperCAmelCase=0.3    ,				__UpperCAmelCase="relu"    ,				__UpperCAmelCase=0.02    ,				__UpperCAmelCase=0.3    ,				__UpperCAmelCase=0.3    ,				__UpperCAmelCase=1    ,				__UpperCAmelCase=0    ,				__UpperCAmelCase=2    ,				__UpperCAmelCase=1    ,				__UpperCAmelCase=0.3    ,				__UpperCAmelCase=1    ,				__UpperCAmelCase=(7,)    ,				__UpperCAmelCase=(3,)    ,				__UpperCAmelCase=80    ,				__UpperCAmelCase=1    ,				__UpperCAmelCase=None    ,				__UpperCAmelCase="sum"    ,				__UpperCAmelCase=False    ,				**__UpperCAmelCase    ,				)       ->							List[Any]:
          super().__init__(**__UpperCAmelCase    ,				pad_token_id=__UpperCAmelCase    ,				bos_token_id=__UpperCAmelCase    ,				eos_token_id=__UpperCAmelCase							)
          _a    	=				vocab_size
          _a    	=				hidden_size
          _a    	=				num_hidden_layers
          _a    	=				intermediate_size
          _a    	=				num_attention_heads
          _a    	=				attention_head_dim
          _a    	=				max_position_embeddings
          _a    	=				layer_norm_eps
          _a    	=				layerdrop
          _a    	=				hidden_act
          _a    	=				initializer_range
          _a    	=				hidden_dropout_prob
          _a    	=				attention_probs_dropout_prob
          _a    	=				pad_token_id
          _a    	=				bos_token_id
          _a    	=				eos_token_id
          _a    	=				conv_glu_dim
          _a    	=				conv_dropout
          _a    	=				num_conv_layers
          _a    	=				input_feat_per_channel
          _a    	=				input_channels
          _a    	=				conv_channels
          _a    	=				ctc_loss_reduction
          _a    	=				ctc_zero_infinity

          # prevents config testing fail with exporting to json
          _a    	=				list(__UpperCAmelCase							)
          _a    	=				list(__UpperCAmelCase							)

          if len(self.conv_kernel							) != self.num_conv_layers:
               raise ValueError(
                   '''Configuration for convolutional module is incorrect. '''
                   '''It is required that `len(config.conv_kernel)` == `config.num_conv_layers` '''
                   F'but is `len(config.conv_kernel) = {len(self.conv_kernel							)}`, '
                   F'`config.num_conv_layers = {self.num_conv_layers}`.'							)



"""simple docstring"""






import warnings

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


class     __lowerCamelCase  (					a__				):

     '''simple docstring'''
     A_       :	Optional[int]    =		['image_processor', 'tokenizer']
     A_       :	Union[str, Any]    =		'ChineseCLIPImageProcessor'
     A_       :	Union[str, Any]    =		('BertTokenizer', 'BertTokenizerFast')


     def __init__(      self    ,				__UpperCAmelCase=None    ,				__UpperCAmelCase=None    ,				**__UpperCAmelCase							)       ->							List[str]:
          _a    	=				None
          if "feature_extractor" in kwargs:
               warnings.warn(
                   '''The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`'''
                   ''' instead.'''    ,				__UpperCAmelCase    ,				)
               _a    	=				kwargs.pop('''feature_extractor'''							)

          _a    	=				image_processor if image_processor is not None else feature_extractor
          if image_processor is None:
               raise ValueError('''You need to specify an `image_processor`.'''							)
          if tokenizer is None:
               raise ValueError('''You need to specify a `tokenizer`.'''							)

          super().__init__(__UpperCAmelCase    ,				__UpperCAmelCase							)
          _a    	=				self.image_processor


     def __call__(      self    ,				__UpperCAmelCase=None    ,				__UpperCAmelCase=None    ,				__UpperCAmelCase=None    ,				**__UpperCAmelCase							)       ->							List[str]:

          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:
               _a    	=				self.tokenizer(__UpperCAmelCase    ,				return_tensors=__UpperCAmelCase    ,				**__UpperCAmelCase							)

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

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


     def 							_UpperCAmelCase      (      self    ,				*__UpperCAmelCase    ,				**__UpperCAmelCase							)       ->							List[str]:
          return self.tokenizer.batch_decode(*__UpperCAmelCase    ,				**__UpperCAmelCase							)


     def 							_UpperCAmelCase      (      self    ,				*__UpperCAmelCase    ,				**__UpperCAmelCase							)       ->							Optional[int]:
          return self.tokenizer.decode(*__UpperCAmelCase    ,				**__UpperCAmelCase							)


     @property
     def 							_UpperCAmelCase      (      self							)       ->							List[str]:
          _a    	=				self.tokenizer.model_input_names
          _a    	=				self.image_processor.model_input_names
          return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names							)							)





     @property
     def 							_UpperCAmelCase      (      self							)       ->							Tuple:
          warnings.warn(
              '''`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.'''    ,				__UpperCAmelCase    ,				)
          return self.image_processor_class