code: 
  
  """simple docstring"""
  
  
  
  
  from collections import OrderedDict
  from typing import Any, Mapping, Optional
  
  from ... import PreTrainedTokenizer
  from ...configuration_utils import PretrainedConfig
  from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast
  from ...onnx.utils import compute_effective_axis_dimension
  from ...utils import TensorType, is_torch_available, logging
  
  
  __A  :					Optional[int]												=	logging.get_logger(__name__)
  
  __A  :					int												=	{
      'facebook/m2m100_418M': 'https://huggingface.co/facebook/m2m100_418M/resolve/main/config.json',
      # See all M2M100 models at https://huggingface.co/models?filter=m2m_100
  }
  
  
  
  
  
  class     __UpperCamelCase				(     _A		):
  		SCREAMING_SNAKE_CASE              =					"m2m_100"
  		SCREAMING_SNAKE_CASE              =					["past_key_values"]
  		SCREAMING_SNAKE_CASE              =					{"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}
  
  
  		def __init__(self				:	Union[str, Any]  ,  __SCREAMING_SNAKE_CASE				:	int=1_2_8_1_1_2  ,  __SCREAMING_SNAKE_CASE				:	Union[str, Any]=1_0_2_4  ,  __SCREAMING_SNAKE_CASE				:	int=1_2  ,  __SCREAMING_SNAKE_CASE				:	Dict=4_0_9_6  ,  __SCREAMING_SNAKE_CASE				:	int=1_6  ,  __SCREAMING_SNAKE_CASE				:	Optional[Any]=1_2  ,  __SCREAMING_SNAKE_CASE				:	Tuple=4_0_9_6  ,  __SCREAMING_SNAKE_CASE				:	List[str]=1_6  ,  __SCREAMING_SNAKE_CASE				:	Optional[Any]=0.0_5  ,  __SCREAMING_SNAKE_CASE				:	List[Any]=0.0_5  ,  __SCREAMING_SNAKE_CASE				:	Tuple=True  ,  __SCREAMING_SNAKE_CASE				:	int=True  ,  __SCREAMING_SNAKE_CASE				:	List[Any]="relu"  ,  __SCREAMING_SNAKE_CASE				:	Any=1_0_2_4  ,  __SCREAMING_SNAKE_CASE				:	List[Any]=0.1  ,  __SCREAMING_SNAKE_CASE				:	Optional[int]=0.1  ,  __SCREAMING_SNAKE_CASE				:	Optional[Any]=0.0  ,  __SCREAMING_SNAKE_CASE				:	int=0.0_2  ,  __SCREAMING_SNAKE_CASE				:	Union[str, Any]=2  ,  __SCREAMING_SNAKE_CASE				:	Optional[int]=True  ,  __SCREAMING_SNAKE_CASE				:	List[Any]=1  ,  __SCREAMING_SNAKE_CASE				:	Optional[Any]=0  ,  __SCREAMING_SNAKE_CASE				:	Tuple=2  ,  **__SCREAMING_SNAKE_CASE				:	Optional[int]  ,  ):
  							A    =      vocab_size
  							A    =      max_position_embeddings
  							A    =      d_model
  							A    =      encoder_ffn_dim
  							A    =      encoder_layers
  							A    =      encoder_attention_heads
  							A    =      decoder_ffn_dim
  							A    =      decoder_layers
  							A    =      decoder_attention_heads
  							A    =      dropout
  							A    =      attention_dropout
  							A    =      activation_dropout
  							A    =      activation_function
  							A    =      init_std
  							A    =      encoder_layerdrop
  							A    =      decoder_layerdrop
  							A    =      use_cache
  							A    =      encoder_layers
  							A    =      scale_embedding  # scale factor will be sqrt(d_model) if True
  
  							super().__init__(
  							    pad_token_id=__SCREAMING_SNAKE_CASE  ,  bos_token_id=__SCREAMING_SNAKE_CASE  ,  eos_token_id=__SCREAMING_SNAKE_CASE  ,  is_encoder_decoder=__SCREAMING_SNAKE_CASE  ,  decoder_start_token_id=__SCREAMING_SNAKE_CASE  ,  **__SCREAMING_SNAKE_CASE  ,  )
  
  
  
  
  
  class     __UpperCamelCase				(     _A		):
  
  
  		@property
  		def       SCREAMING_SNAKE_CASE__     (self				:	Tuple):
  							A    =      OrderedDict(
  							    [
  							        ("input_ids", {0: "batch", 1: "encoder_sequence"}),
  							        ("attention_mask", {0: "batch", 1: "encoder_sequence"}),
  							    ])
  
  							if self.use_past:
  												A    =      {0: "batch"}
  												A    =      {0: "batch", 1: "past_decoder_sequence + sequence"}
  							else:
  												A    =      {0: "batch", 1: "decoder_sequence"}
  												A    =      {0: "batch", 1: "decoder_sequence"}
  
  							if self.use_past:
  												self.fill_with_past_key_values_(__SCREAMING_SNAKE_CASE  ,  direction="inputs")
  							return common_inputs
  
  
  		def       SCREAMING_SNAKE_CASE__     (self				:	List[Any]  ,  __SCREAMING_SNAKE_CASE				:	PreTrainedTokenizer  ,  __SCREAMING_SNAKE_CASE				:	int = -1  ,  __SCREAMING_SNAKE_CASE				:	int = -1  ,  __SCREAMING_SNAKE_CASE				:	bool = False  ,  __SCREAMING_SNAKE_CASE				:	Optional[TensorType] = None  ,  ):
  							# Copied from OnnxConfig.generate_dummy_inputs
  							# Did not use super(OnnxConfigWithPast, self).generate_dummy_inputs for code clarity.
  							# If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
  							A    =      compute_effective_axis_dimension(
  							    __SCREAMING_SNAKE_CASE  ,  fixed_dimension=OnnxConfig.default_fixed_batch  ,  num_token_to_add=0)
  
  							# If dynamic axis (-1) we forward with a fixed dimension of 8 tokens to avoid optimizations made by ONNX
  							A    =      tokenizer.num_special_tokens_to_add(__SCREAMING_SNAKE_CASE)
  							A    =      compute_effective_axis_dimension(
  							    __SCREAMING_SNAKE_CASE  ,  fixed_dimension=OnnxConfig.default_fixed_sequence  ,  num_token_to_add=__SCREAMING_SNAKE_CASE)
  
  							# Generate dummy inputs according to compute batch and sequence
  							A    =      [" ".join([tokenizer.unk_token]) * seq_length] * batch_size
  							A    =      dict(tokenizer(__SCREAMING_SNAKE_CASE  ,  return_tensors=__SCREAMING_SNAKE_CASE))
  							return common_inputs
  
  
  		def       SCREAMING_SNAKE_CASE__     (self				:	str  ,  __SCREAMING_SNAKE_CASE				:	PreTrainedTokenizer  ,  __SCREAMING_SNAKE_CASE				:	int = -1  ,  __SCREAMING_SNAKE_CASE				:	int = -1  ,  __SCREAMING_SNAKE_CASE				:	bool = False  ,  __SCREAMING_SNAKE_CASE				:	Optional[TensorType] = None  ,  ):
  							A    =      self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
  							    __SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE)
  
  							# Generate decoder inputs
  							A    =      seq_length if not self.use_past else 1
  							A    =      self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
  							    __SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE)
  							A    =      {F"""decoder_{name}""": tensor for name, tensor in decoder_inputs.items()}
  							A    =      dict(**__SCREAMING_SNAKE_CASE  ,  **__SCREAMING_SNAKE_CASE)
  
  							if self.use_past:
  												if not is_torch_available():
  																	raise ValueError("Cannot generate dummy past_keys inputs without PyTorch installed.")
  												else:
  																	import torch
  												A    ,					A    =      common_inputs["input_ids"].shape
  												A    =      common_inputs["decoder_input_ids"].shape[1]
  												A    ,					A    =      self.num_attention_heads
  												A    =      (
  												    batch,
  												    num_encoder_attention_heads,
  												    encoder_seq_length,
  												    self._config.hidden_size // num_encoder_attention_heads,
  												)
  												A    =      decoder_seq_length + 3
  												A    =      (
  												    batch,
  												    num_decoder_attention_heads,
  												    decoder_past_length,
  												    self._config.hidden_size // num_decoder_attention_heads,
  												)
  
  												A    =      torch.cat(
  												    [common_inputs["decoder_attention_mask"], torch.ones(__SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE)]  ,  dim=1)
  
  												A    =      []
  												# If the number of encoder and decoder layers are present in the model configuration, both are considered
  												A    ,					A    =      self.num_layers
  												A    =      min(__SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE)
  												A    =      max(__SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE) - min_num_layers
  												A    =      "encoder" if num_encoder_layers > num_decoder_layers else "decoder"
  
  												for _ in range(__SCREAMING_SNAKE_CASE):
  																	common_inputs["past_key_values"].append(
  																	    (
  																	        torch.zeros(__SCREAMING_SNAKE_CASE),
  																	        torch.zeros(__SCREAMING_SNAKE_CASE),
  																	        torch.zeros(__SCREAMING_SNAKE_CASE),
  																	        torch.zeros(__SCREAMING_SNAKE_CASE),
  																	    ))
  												# TODO: test this.
  												A    =      encoder_shape if remaining_side_name == "encoder" else decoder_shape
  												for _ in range(__SCREAMING_SNAKE_CASE  ,  __SCREAMING_SNAKE_CASE):
  																	common_inputs["past_key_values"].append((torch.zeros(__SCREAMING_SNAKE_CASE), torch.zeros(__SCREAMING_SNAKE_CASE)))
  							return common_inputs
  		SCREAMING_SNAKE_CASE              =					_generate_dummy_inputs_for_default_and_seqaseq_lm
  
  
  
  
  
  
style_context: 
  
  """simple docstring"""
  
  
  
  
  def      __SCREAMING_SNAKE_CASE		(		lowercase__    ,							lowercase__   ):
  					"""simple docstring"""
  					A    =      1
  					while b > 0:
  										if b & 1:
  															res *= a
  
  										a *= a
  										b >>= 1
  
  					return res
  def      __SCREAMING_SNAKE_CASE		(		lowercase__    ,							lowercase__    ,							lowercase__   ):
  					"""simple docstring"""
  					A    =      1
  					while b > 0:
  										if b & 1:
  															A    =      ((res % c) * (a % c)) % c
  
  										a *= a
  										b >>= 1
  
  					return res
  
  
  
  
  
  