





from collections import OrderedDict
from typing import Mapping

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


__A     =    logging.get_logger(__name__)

__A     =    {
    "facebook/xlm-roberta-xl": "https://huggingface.co/facebook/xlm-roberta-xl/resolve/main/config.json",
    "facebook/xlm-roberta-xxl": "https://huggingface.co/facebook/xlm-roberta-xxl/resolve/main/config.json",
    # See all XLM-RoBERTa-XL models at https://huggingface.co/models?filter=xlm-roberta-xl
}



class        _SCREAMING_SNAKE_CASE						(     __SCREAMING_SNAKE_CASE   ):







 '''simple docstring'''
 lowercase_		=      'xlm-roberta-xl'

 def __init__(self    :       List[str]	,			UpperCAmelCase_    :       Optional[Any]=250_880	,			UpperCAmelCase_    :       List[str]=2_560	,			UpperCAmelCase_    :       List[Any]=36	,			UpperCAmelCase_    :       Tuple=32	,			UpperCAmelCase_    :       Dict=10_240	,			UpperCAmelCase_    :       Any="gelu"	,			UpperCAmelCase_    :       Optional[Any]=0.1	,			UpperCAmelCase_    :       Optional[int]=0.1	,			UpperCAmelCase_    :       List[str]=514	,			UpperCAmelCase_    :       str=1	,			UpperCAmelCase_    :       int=0.02	,			UpperCAmelCase_    :       str=1E-0_5	,			UpperCAmelCase_    :       Optional[int]=1	,			UpperCAmelCase_    :       Tuple=0	,			UpperCAmelCase_    :       Tuple=2	,			UpperCAmelCase_    :       Tuple="absolute"	,			UpperCAmelCase_    :       str=True	,			UpperCAmelCase_    :       Union[str, Any]=None	,			**UpperCAmelCase_    :       List[Any]	,			)	->Optional[Any]:



   '''simple docstring'''



   super().__init__(pad_token_id=_a	,			bos_token_id=_a	,			eos_token_id=_a	,			**_a)
   lowerCamelCase__:				Optional[int]        =vocab_size
   lowerCamelCase__:				List[str]        =hidden_size
   lowerCamelCase__:				Optional[int]        =num_hidden_layers
   lowerCamelCase__:				List[str]        =num_attention_heads
   lowerCamelCase__:				Any        =hidden_act
   lowerCamelCase__:				Dict        =intermediate_size
   lowerCamelCase__:				List[str]        =hidden_dropout_prob
   lowerCamelCase__:				Union[str, Any]        =attention_probs_dropout_prob
   lowerCamelCase__:				Tuple        =max_position_embeddings
   lowerCamelCase__:				List[str]        =type_vocab_size
   lowerCamelCase__:				List[Any]        =initializer_range
   lowerCamelCase__:				Optional[Any]        =layer_norm_eps
   lowerCamelCase__:				Optional[Any]        =position_embedding_type
   lowerCamelCase__:				Union[str, Any]        =use_cache
   lowerCamelCase__:				str        =classifier_dropout



class        _SCREAMING_SNAKE_CASE						(     __SCREAMING_SNAKE_CASE   ):







 '''simple docstring'''

 @property
 def 							SCREAMING_SNAKE_CASE_ (self    :       str)	->str:



   '''simple docstring'''



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








import json
import os
import unittest

from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer

from ...test_tokenization_common import TokenizerTesterMixin



class        _SCREAMING_SNAKE_CASE						(     __SCREAMING_SNAKE_CASE   ,							unittest.TestCase   ):







 '''simple docstring'''
 lowercase_		=      CTRLTokenizer
 lowercase_		=      False
 lowercase_		=      False

 def 							SCREAMING_SNAKE_CASE_ (self    :       str)	->Union[str, Any]:



   '''simple docstring'''



   super().setUp()

   # Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
   lowerCamelCase__:				Optional[Any]        =["adapt", "re@@", "a@@", "apt", "c@@", "t", "<unk>"]
   lowerCamelCase__:				Optional[Any]        =dict(zip(UpperCAmelCase_	,			range(len(UpperCAmelCase_))))
   lowerCamelCase__:				Union[str, Any]        =["#version: 0.2", "a p", "ap t</w>", "r e", "a d", "ad apt</w>", ""]
   lowerCamelCase__:				Union[str, Any]        ={"unk_token": "<unk>"}

   lowerCamelCase__:				Union[str, Any]        =os.path.join(self.tmpdirname	,			VOCAB_FILES_NAMES["vocab_file"])
   lowerCamelCase__:				Optional[Any]        =os.path.join(self.tmpdirname	,			VOCAB_FILES_NAMES["merges_file"])
   with open(self.vocab_file	,			"w"	,			encoding="utf-8") as fp:
     fp.write(json.dumps(UpperCAmelCase_) + "\n")
   with open(self.merges_file	,			"w"	,			encoding="utf-8") as fp:
     fp.write("\n".join(UpperCAmelCase_))

 def 							SCREAMING_SNAKE_CASE_ (self    :       List[str]	,			**UpperCAmelCase_    :       str)	->List[Any]:



   '''simple docstring'''



   kwargs.update(self.special_tokens_map)
   return CTRLTokenizer.from_pretrained(self.tmpdirname	,			**UpperCAmelCase_)

 def 							SCREAMING_SNAKE_CASE_ (self    :       List[Any]	,			UpperCAmelCase_    :       Optional[int])	->Optional[int]:



   '''simple docstring'''



   lowerCamelCase__:				int        ="adapt react readapt apt"
   lowerCamelCase__:				int        ="adapt react readapt apt"
   return input_text, output_text







 def 							SCREAMING_SNAKE_CASE_ (self    :       str)	->Union[str, Any]:



   '''simple docstring'''



   lowerCamelCase__:				List[str]        =CTRLTokenizer(self.vocab_file	,			self.merges_file	,			**self.special_tokens_map)
   lowerCamelCase__:				Union[str, Any]        ="adapt react readapt apt"
   lowerCamelCase__:				Tuple        ="adapt re@@ a@@ c@@ t re@@ adapt apt".split()
   lowerCamelCase__:				Dict        =tokenizer.tokenize(UpperCAmelCase_)
   self.assertListEqual(UpperCAmelCase_	,			UpperCAmelCase_)

   lowerCamelCase__:				Optional[int]        =tokens + [tokenizer.unk_token]

   lowerCamelCase__:				List[str]        =[0, 1, 2, 4, 5, 1, 0, 3, 6]
   self.assertListEqual(tokenizer.convert_tokens_to_ids(UpperCAmelCase_)	,			UpperCAmelCase_)

