






'''simple docstring'''



from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


SCREAMING_SNAKE_CASE						=	logging.get_logger(__name__)

SCREAMING_SNAKE_CASE						=	{
    'facebook/xmod-base': 'https://huggingface.co/facebook/xmod-base/resolve/main/config.json',
    'facebook/xmod-large-prenorm': 'https://huggingface.co/facebook/xmod-large-prenorm/resolve/main/config.json',
    'facebook/xmod-base-13-125k': 'https://huggingface.co/facebook/xmod-base-13-125k/resolve/main/config.json',
    'facebook/xmod-base-30-125k': 'https://huggingface.co/facebook/xmod-base-30-125k/resolve/main/config.json',
    'facebook/xmod-base-30-195k': 'https://huggingface.co/facebook/xmod-base-30-195k/resolve/main/config.json',
    'facebook/xmod-base-60-125k': 'https://huggingface.co/facebook/xmod-base-60-125k/resolve/main/config.json',
    'facebook/xmod-base-60-265k': 'https://huggingface.co/facebook/xmod-base-60-265k/resolve/main/config.json',
    'facebook/xmod-base-75-125k': 'https://huggingface.co/facebook/xmod-base-75-125k/resolve/main/config.json',
    'facebook/xmod-base-75-269k': 'https://huggingface.co/facebook/xmod-base-75-269k/resolve/main/config.json',
}
class UpperCAmelCase_					(    __A				):




      """simple docstring"""




      UpperCamelCase_								=			'''xmod'''






      def __init__( self			:		int     ,      UpperCAmelCase			:		Tuple=3_0522     ,      UpperCAmelCase			:		Union[str, Any]=768     ,      UpperCAmelCase			:		Union[str, Any]=12     ,      UpperCAmelCase			:		Optional[Any]=12     ,      UpperCAmelCase			:		Union[str, Any]=3072     ,      UpperCAmelCase			:		str="gelu"     ,      UpperCAmelCase			:		Optional[int]=0.1     ,      UpperCAmelCase			:		List[str]=0.1     ,      UpperCAmelCase			:		Optional[int]=512     ,      UpperCAmelCase			:		int=2     ,      UpperCAmelCase			:		List[Any]=0.0_2     ,      UpperCAmelCase			:		List[Any]=1e-12     ,      UpperCAmelCase			:		Any=1     ,      UpperCAmelCase			:		List[str]=0     ,      UpperCAmelCase			:		List[str]=2     ,      UpperCAmelCase			:		int="absolute"     ,      UpperCAmelCase			:		int=True     ,      UpperCAmelCase			:		Optional[Any]=None     ,      UpperCAmelCase			:		str=False     ,      UpperCAmelCase			:		List[str]=2     ,      UpperCAmelCase			:		List[str]=False     ,      UpperCAmelCase			:		Any=True     ,      UpperCAmelCase			:		int=True     ,      UpperCAmelCase			:		Union[str, Any]=("en_XX",)     ,      UpperCAmelCase			:		int=None     ,      **UpperCAmelCase			:		int     ,      )  ->  List[Any]:


       '''simple docstring'''

       super().__init__(pad_token_id=UpperCAmelCase     ,      bos_token_id=UpperCAmelCase     ,      eos_token_id=UpperCAmelCase     ,      **UpperCAmelCase		)

       lowercase					:   Optional[int]				  =vocab_size
       lowercase					:   str				  =hidden_size
       lowercase					:   Optional[int]				  =num_hidden_layers
       lowercase					:   List[Any]				  =num_attention_heads
       lowercase					:   Optional[int]				  =hidden_act
       lowercase					:   Dict				  =intermediate_size
       lowercase					:   Dict				  =hidden_dropout_prob
       lowercase					:   Tuple				  =attention_probs_dropout_prob
       lowercase					:   str				  =max_position_embeddings
       lowercase					:   Union[str, Any]				  =type_vocab_size
       lowercase					:   List[Any]				  =initializer_range
       lowercase					:   Dict				  =layer_norm_eps
       lowercase					:   Any				  =position_embedding_type
       lowercase					:   List[Any]				  =use_cache
       lowercase					:   List[str]				  =classifier_dropout
       lowercase					:   Dict				  =pre_norm
       lowercase					:   List[Any]				  =adapter_reduction_factor
       lowercase					:   List[str]				  =adapter_layer_norm
       lowercase					:   Tuple				  =adapter_reuse_layer_norm
       lowercase					:   Dict				  =ln_before_adapter
       lowercase					:   Optional[Any]				  =list(UpperCAmelCase		)
       lowercase					:   Union[str, Any]				  =default_language





class UpperCAmelCase_					(    __A				):




      """simple docstring"""




      @property
      def 				A__      ( self			:		Tuple		)  ->  Mapping[str, Mapping[int, str]]:


       '''simple docstring'''

       if self.task == "multiple-choice":
        lowercase					:   Any				  ={0: '''batch''', 1: '''choice''', 2: '''sequence'''}
       else:
        lowercase					:   Optional[Any]				  ={0: '''batch''', 1: '''sequence'''}
       return OrderedDict(
           [
               ('''input_ids''', dynamic_axis),
               ('''attention_mask''', dynamic_axis),
           ]		)











'''simple docstring'''



from typing import List, Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_herbert import HerbertTokenizer


SCREAMING_SNAKE_CASE						=	logging.get_logger(__name__)

SCREAMING_SNAKE_CASE						=	{'vocab_file': 'vocab.json', 'merges_file': 'merges.txt', 'tokenizer_file': 'tokenizer.json'}

SCREAMING_SNAKE_CASE						=	{
    'vocab_file': {
        'allegro/herbert-base-cased': 'https://huggingface.co/allegro/herbert-base-cased/resolve/main/vocab.json'
    },
    'merges_file': {
        'allegro/herbert-base-cased': 'https://huggingface.co/allegro/herbert-base-cased/resolve/main/merges.txt'
    },
}

SCREAMING_SNAKE_CASE						=	{'allegro/herbert-base-cased': 514}
SCREAMING_SNAKE_CASE						=	{}
class UpperCAmelCase_					(    __A				):




      """simple docstring"""




      UpperCamelCase_								=			VOCAB_FILES_NAMES
      UpperCamelCase_								=			PRETRAINED_VOCAB_FILES_MAP
      UpperCamelCase_								=			PRETRAINED_INIT_CONFIGURATION
      UpperCamelCase_								=			PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
      UpperCamelCase_								=			HerbertTokenizer






      def __init__( self			:		Dict     ,      UpperCAmelCase			:		Optional[Any]=None     ,      UpperCAmelCase			:		Optional[int]=None     ,      UpperCAmelCase			:		Any=None     ,      UpperCAmelCase			:		Tuple="<s>"     ,      UpperCAmelCase			:		List[Any]="<unk>"     ,      UpperCAmelCase			:		str="<pad>"     ,      UpperCAmelCase			:		Optional[Any]="<mask>"     ,      UpperCAmelCase			:		List[str]="</s>"     ,      **UpperCAmelCase			:		List[str]     ,      )  ->  Dict:


       '''simple docstring'''

       super().__init__(
           UpperCAmelCase     ,      UpperCAmelCase     ,      tokenizer_file=UpperCAmelCase     ,      cls_token=UpperCAmelCase     ,      unk_token=UpperCAmelCase     ,      pad_token=UpperCAmelCase     ,      mask_token=UpperCAmelCase     ,      sep_token=UpperCAmelCase     ,      **UpperCAmelCase     ,      )






      def 				A__      ( self			:		int     ,      UpperCAmelCase			:		List[int]     ,      UpperCAmelCase			:		Optional[List[int]] = None		)  ->  List[int]:


       '''simple docstring'''

       lowercase					:   List[Any]				  =[self.cls_token_id]
       lowercase					:   Any				  =[self.sep_token_id]
       if token_ids_a is None:
        return cls + token_ids_a + sep

       return cls + token_ids_a + sep + token_ids_a + sep






      def 				A__      ( self			:		Any     ,      UpperCAmelCase			:		List[int]     ,      UpperCAmelCase			:		Optional[List[int]] = None     ,      UpperCAmelCase			:		bool = False		)  ->  List[int]:


       '''simple docstring'''

       if already_has_special_tokens:
        return super().get_special_tokens_mask(
            token_ids_a=UpperCAmelCase     ,      token_ids_a=UpperCAmelCase     ,      already_has_special_tokens=UpperCAmelCase		)

       if token_ids_a is None:
        return [1] + ([0] * len(UpperCAmelCase		)) + [1]
       return [1] + ([0] * len(UpperCAmelCase		)) + [1] + ([0] * len(UpperCAmelCase		)) + [1]






      def 				A__      ( self			:		Optional[int]     ,      UpperCAmelCase			:		List[int]     ,      UpperCAmelCase			:		Optional[List[int]] = None		)  ->  List[int]:


       '''simple docstring'''

       lowercase					:   Optional[Any]				  =[self.sep_token_id]
       lowercase					:   Dict				  =[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 				A__      ( self			:		Union[str, Any]     ,      UpperCAmelCase			:		str     ,      UpperCAmelCase			:		Optional[str] = None		)  ->  Tuple[str]:


       '''simple docstring'''

       lowercase					:   List[Any]				  =self._tokenizer.model.save(UpperCAmelCase     ,      name=UpperCAmelCase		)
       return tuple(UpperCAmelCase		)



