


'''simple docstring'''




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


UpperCAmelCase_      :		Any          =		logging.get_logger(__name__)

UpperCAmelCase_      :		str          =		{
    "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 					a			(				snake_case__  ):
 '''simple docstring'''




 __lowerCAmelCase						: Any							  =		"""mctct"""




 def __init__(    self		,      lowerCamelCase_=8_0_6_5		,      lowerCamelCase_=1_5_3_6		,      lowerCamelCase_=3_6		,      lowerCamelCase_=6_1_4_4		,      lowerCamelCase_=4		,      lowerCamelCase_=3_8_4		,      lowerCamelCase_=9_2_0		,      lowerCamelCase_=1e-5		,      lowerCamelCase_=0.3		,      lowerCamelCase_="relu"		,      lowerCamelCase_=0.02		,      lowerCamelCase_=0.3		,      lowerCamelCase_=0.3		,      lowerCamelCase_=1		,      lowerCamelCase_=0		,      lowerCamelCase_=2		,      lowerCamelCase_=1		,      lowerCamelCase_=0.3		,      lowerCamelCase_=1		,      lowerCamelCase_=(7,)		,      lowerCamelCase_=(3,)		,      lowerCamelCase_=8_0		,      lowerCamelCase_=1		,      lowerCamelCase_=None		,      lowerCamelCase_="sum"		,      lowerCamelCase_=False		,      **lowerCamelCase_		,      )      ->    Any:
    super().__init__(**lowerCamelCase_		,      pad_token_id=lowerCamelCase_		,      bos_token_id=lowerCamelCase_		,      eos_token_id=lowerCamelCase_      )
    _a					:  Optional[Any]						=  vocab_size
    _a					:  Any						=  hidden_size
    _a					:  Dict						=  num_hidden_layers
    _a					:  List[str]						=  intermediate_size
    _a					:  str						=  num_attention_heads
    _a					:  List[Any]						=  attention_head_dim
    _a					:  int						=  max_position_embeddings
    _a					:  List[str]						=  layer_norm_eps
    _a					:  Optional[Any]						=  layerdrop
    _a					:  List[str]						=  hidden_act
    _a					:  Any						=  initializer_range
    _a					:  Optional[int]						=  hidden_dropout_prob
    _a					:  Optional[Any]						=  attention_probs_dropout_prob
    _a					:  Any						=  pad_token_id
    _a					:  Dict						=  bos_token_id
    _a					:  List[str]						=  eos_token_id
    _a					:  Dict						=  conv_glu_dim
    _a					:  List[Any]						=  conv_dropout
    _a					:  Optional[int]						=  num_conv_layers
    _a					:  List[Any]						=  input_feat_per_channel
    _a					:  Any						=  input_channels
    _a					:  Optional[int]						=  conv_channels
    _a					:  Union[str, Any]						=  ctc_loss_reduction
    _a					:  List[Any]						=  ctc_zero_infinity

    # prevents config testing fail with exporting to json
    _a					:  int						=  list(lowerCamelCase_      )
    _a					:  Tuple						=  list(lowerCamelCase_      )

    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 json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer


UpperCAmelCase_      :		Optional[Any]          =		{"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}

UpperCAmelCase_      :		Union[str, Any]          =		{
    "vocab_file": {
        "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/vocab.txt",
    },
    "tokenizer_file": {
        "unc-nlp/lxmert-base-uncased": (
            "https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/tokenizer.json"
        ),
    },
}

UpperCAmelCase_      :		str          =		{
    "unc-nlp/lxmert-base-uncased": 512,
}

UpperCAmelCase_      :		Optional[int]          =		{
    "unc-nlp/lxmert-base-uncased": {"do_lower_case": True},
}







class 					a			(				snake_case__  ):
 '''simple docstring'''




 __lowerCAmelCase						: Tuple							  =		VOCAB_FILES_NAMES
 __lowerCAmelCase						: Dict							  =		PRETRAINED_VOCAB_FILES_MAP
 __lowerCAmelCase						: Optional[Any]							  =		PRETRAINED_INIT_CONFIGURATION
 __lowerCAmelCase						: str							  =		PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
 __lowerCAmelCase						: List[Any]							  =		LxmertTokenizer




 def __init__(    self		,      lowerCamelCase_=None		,      lowerCamelCase_=None		,      lowerCamelCase_=True		,      lowerCamelCase_="[UNK]"		,      lowerCamelCase_="[SEP]"		,      lowerCamelCase_="[PAD]"		,      lowerCamelCase_="[CLS]"		,      lowerCamelCase_="[MASK]"		,      lowerCamelCase_=True		,      lowerCamelCase_=None		,      **lowerCamelCase_		,      )      ->    Optional[int]:
    super().__init__(
        lowerCamelCase_		,      tokenizer_file=lowerCamelCase_		,      do_lower_case=lowerCamelCase_		,      unk_token=lowerCamelCase_		,      sep_token=lowerCamelCase_		,      pad_token=lowerCamelCase_		,      cls_token=lowerCamelCase_		,      mask_token=lowerCamelCase_		,      tokenize_chinese_chars=lowerCamelCase_		,      strip_accents=lowerCamelCase_		,      **lowerCamelCase_		,      )

    _a					:  str						=  json.loads(self.backend_tokenizer.normalizer.__getstate__()      )
    if (
        normalizer_state.get('lowercase'		,      lowerCamelCase_      ) != do_lower_case
        or normalizer_state.get('strip_accents'		,      lowerCamelCase_      ) != strip_accents
        or normalizer_state.get('handle_chinese_chars'		,      lowerCamelCase_      ) != tokenize_chinese_chars
    ):
       _a					:  str						=  getattr(lowerCamelCase_		,      normalizer_state.pop('type'      )      )
       _a					:  Tuple						=  do_lower_case
       _a					:  str						=  strip_accents
       _a					:  Optional[Any]						=  tokenize_chinese_chars
       _a					:  Dict						=  normalizer_class(**lowerCamelCase_      )

    _a					:  Optional[int]						=  do_lower_case




 def   __UpperCamelCase   (    self		,      lowerCamelCase_		,      lowerCamelCase_=None      )      ->    Optional[Any]:
    _a					:  List[str]						=  [self.cls_token_id] + token_ids_a + [self.sep_token_id]

    if token_ids_a:
       output += token_ids_a + [self.sep_token_id]

    return output




 def   __UpperCamelCase   (    self		,      lowerCamelCase_		,      lowerCamelCase_ = None      )      ->    List[int]:
    _a					:  Union[str, Any]						=  [self.sep_token_id]
    _a					:  Optional[int]						=  [self.cls_token_id]
    if token_ids_a is None:
       return len(cls + token_ids_a + sep      ) * [0]
    return len(cls + token_ids_a + sep      ) * [0] + len(token_ids_a + sep      ) * [1]




 def   __UpperCamelCase   (    self		,      lowerCamelCase_		,      lowerCamelCase_ = None      )      ->    Tuple[str]:
    _a					:  Optional[Any]						=  self._tokenizer.model.save(lowerCamelCase_		,      name=lowerCamelCase_      )
    return tuple(lowerCamelCase_      )


