
'''simple docstring'''



from collections import OrderedDict
from typing import Mapping

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


_lowercase          =						logging.get_logger(__name__)

_lowercase          =						{
    """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_	(						_SCREAMING_SNAKE_CASE					):






						'''simple docstring'''






						_lowercase						: List[Any]										=  '''xmod'''




						def __init__(   self       ,  _lowercase=30_522       ,  _lowercase=768       ,  _lowercase=12       ,  _lowercase=12       ,  _lowercase=3_072       ,  _lowercase="gelu"       ,  _lowercase=0.1       ,  _lowercase=0.1       ,  _lowercase=512       ,  _lowercase=2       ,  _lowercase=0.02       ,  _lowercase=1e-12       ,  _lowercase=1       ,  _lowercase=0       ,  _lowercase=2       ,  _lowercase="absolute"       ,  _lowercase=True       ,  _lowercase=None       ,  _lowercase=False       ,  _lowercase=2       ,  _lowercase=False       ,  _lowercase=True       ,  _lowercase=True       ,  _lowercase=("en_XX",)       ,  _lowercase=None       ,  **_lowercase       ,  ):

												"""simple docstring"""



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

												_lowerCAmelCase    		=					vocab_size
												_lowerCAmelCase    		=					hidden_size
												_lowerCAmelCase    		=					num_hidden_layers
												_lowerCAmelCase    		=					num_attention_heads
												_lowerCAmelCase    		=					hidden_act
												_lowerCAmelCase    		=					intermediate_size
												_lowerCAmelCase    		=					hidden_dropout_prob
												_lowerCAmelCase    		=					attention_probs_dropout_prob
												_lowerCAmelCase    		=					max_position_embeddings
												_lowerCAmelCase    		=					type_vocab_size
												_lowerCAmelCase    		=					initializer_range
												_lowerCAmelCase    		=					layer_norm_eps
												_lowerCAmelCase    		=					position_embedding_type
												_lowerCAmelCase    		=					use_cache
												_lowerCAmelCase    		=					classifier_dropout
												_lowerCAmelCase    		=					pre_norm
												_lowerCAmelCase    		=					adapter_reduction_factor
												_lowerCAmelCase    		=					adapter_layer_norm
												_lowerCAmelCase    		=					adapter_reuse_layer_norm
												_lowerCAmelCase    		=					ln_before_adapter
												_lowerCAmelCase    		=					list(_lowercase )
												_lowerCAmelCase    		=					default_language






class     UpperCAmelCase_	(						_SCREAMING_SNAKE_CASE					):






						'''simple docstring'''






						@property
						def    _lowercase      (   self ):

												"""simple docstring"""



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


'''simple docstring'''



import builtins
import sys

from ...utils.imports import _is_package_available
from . import cursor, input
from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor
from .keymap import KEYMAP


_lowercase          =						False
try:
						_lowercase          =						_is_package_available("""google.colab""")
except ModuleNotFoundError:
						pass




@input.register
class     UpperCAmelCase_	:






						'''simple docstring'''






						def __init__(   self       ,  _lowercase = None       ,  _lowercase = [] ):

												"""simple docstring"""



												_lowerCAmelCase    		=					0
												_lowerCAmelCase    		=					choices
												_lowerCAmelCase    		=					prompt
												if sys.platform == "win32":
																		_lowerCAmelCase    		=					"""*"""
												else:
																		_lowerCAmelCase    		=					"""➔ """




						def    _lowercase      (   self       ,  _lowercase       ,  _lowercase = "" ):

												"""simple docstring"""



												if sys.platform != "win32":
																		writeColor(self.choices[index]       ,  32       ,  _lowercase )
												else:
																		forceWrite(self.choices[index]       ,  _lowercase )




						def    _lowercase      (   self       ,  _lowercase ):

												"""simple docstring"""



												if index == self.position:
																		forceWrite(F' {self.arrow_char} ' )
																		self.write_choice(_lowercase )
												else:
																		forceWrite(F'    {self.choices[index]}' )
												reset_cursor()




						def    _lowercase      (   self       ,  _lowercase       ,  _lowercase = 1 ):

												"""simple docstring"""



												_lowerCAmelCase    		=					self.position
												if direction == Direction.DOWN:
																		if self.position + 1 >= len(self.choices ):
																								return
																		self.position += num_spaces
												else:
																		if self.position - 1 < 0:
																								return
																		self.position -= num_spaces
												clear_line()
												self.print_choice(_lowercase )
												move_cursor(_lowercase       ,  direction.name )
												self.print_choice(self.position )




						@input.mark(KEYMAP["""up"""] )
						def    _lowercase      (   self ):

												"""simple docstring"""



												self.move_direction(Direction.UP )




						@input.mark(KEYMAP["""down"""] )
						def    _lowercase      (   self ):

												"""simple docstring"""



												self.move_direction(Direction.DOWN )




						@input.mark(KEYMAP["""newline"""] )
						def    _lowercase      (   self ):

												"""simple docstring"""



												move_cursor(len(self.choices ) - self.position       ,  """DOWN""" )
												return self.position




						@input.mark(KEYMAP["""interrupt"""] )
						def    _lowercase      (   self ):

												"""simple docstring"""



												move_cursor(len(self.choices ) - self.position       ,  """DOWN""" )
												raise KeyboardInterrupt




						@input.mark_multiple(*[KEYMAP[str(_lowercase )] for number in range(10 )] )
						def    _lowercase      (   self ):

												"""simple docstring"""



												_lowerCAmelCase    		=					int(chr(self.current_selection ) )
												_lowerCAmelCase    		=					index - self.position
												if index == self.position:
																		return
												if index < len(self.choices ):
																		if self.position > index:
																								self.move_direction(Direction.UP       ,  -movement )
																		elif self.position < index:
																								self.move_direction(Direction.DOWN       ,  _lowercase )
																		else:
																								return
												else:
																		return




						def    _lowercase      (   self       ,  _lowercase = 0 ):

												"""simple docstring"""



												if self.prompt:
																		linebreak()
																		forceWrite(self.prompt       ,  """\n""" )
																		if in_colab:
																								forceWrite("""Please input a choice index (starting from 0), and press enter"""       ,  """\n""" )
																		else:
																								forceWrite("""Please select a choice using the arrow or number keys, and selecting with enter"""       ,  """\n""" )
												_lowerCAmelCase    		=					default_choice
												for i in range(len(self.choices ) ):
																		self.print_choice(_lowercase )
																		forceWrite("""\n""" )
												move_cursor(len(self.choices ) - self.position       ,  """UP""" )
												with cursor.hide():
																		while True:
																								if in_colab:
																														try:
																																				_lowerCAmelCase    		=					int(builtins.input() )
																														except ValueError:
																																				_lowerCAmelCase    		=					default_choice
																								else:
																														_lowerCAmelCase    		=					self.handle_input()
																								if choice is not None:
																														reset_cursor()
																														for _ in range(len(self.choices ) + 1 ):
																																				move_cursor(1       ,  """UP""" )
																																				clear_line()
																														self.write_choice(_lowercase       ,  """\n""" )
																														return choice
