code: 
  
  from collections import OrderedDict
  from typing import Mapping
  
  from ...configuration_utils import PretrainedConfig
  from ...onnx import OnnxConfig
  from ...utils import logging
  
  
  UpperCAmelCase_       :				Tuple		   =      logging.get_logger(__name__)
  
  UpperCAmelCase_       :				List[Any]		   =      {
      '''mnaylor/mega-base-wikitext''': '''https://huggingface.co/mnaylor/mega-base-wikitext/resolve/main/config.json''',
  }
  
  
  
  
  
  
  class     lowerCamelCase_			(  __UpperCAmelCase  ):
  	_lowercase		:      List[str]    				=							"""mega"""
  
  
  
  
  	def __init__(    self	:    List[str]				,			__A	:    Any=3_0522				,			__A	:    Union[str, Any]=128				,			__A	:    int=4				,			__A	:    Dict=256				,			__A	:    List[str]=16				,			__A	:    str=True				,			__A	:    Any=64				,			__A	:    Dict=False				,			__A	:    Optional[int]=-1				,			__A	:    Optional[Any]=None				,			__A	:    int=True				,			__A	:    List[str]="scalenorm"				,			__A	:    str=True				,			__A	:    str="silu"				,			__A	:    Tuple="softmax"				,			__A	:    str=0.1				,			__A	:    List[str]=0.1				,			__A	:    List[str]=0.1				,			__A	:    str=False				,			__A	:    int=True				,			__A	:    List[str]=256				,			__A	:    int=True				,			__A	:    Optional[int]=0.1				,			__A	:    Dict=2048				,			__A	:    Union[str, Any]=False				,			__A	:    int=2				,			__A	:    int=0.0_2				,			__A	:    str=0.2				,			__A	:    Any=0.0_2				,			__A	:    Optional[int]=1.0				,			__A	:    Dict=1				,			__A	:    Tuple=0				,			__A	:    int=2				,			__A	:    List[str]="rotary"				,			__A	:    Union[str, Any]=None				,			__A	:    int=True				,			__A	:    Optional[Any]=True				,			**__A	:    Optional[int]				,			):
  		super().__init__(pad_token_id=lowerCamelCase__				,			bos_token_id=lowerCamelCase__				,			eos_token_id=lowerCamelCase__				,			**lowerCamelCase__       )
  
  		__A   : Union[str, Any]								= vocab_size
  		__A   : List[Any]								= hidden_size
  		__A   : Tuple								= num_hidden_layers
  		__A   : Union[str, Any]								= activation
  		__A   : List[Any]								= attention_activation
  		__A   : Tuple								= intermediate_size
  		__A   : List[Any]								= ema_projection_size
  		__A   : List[Any]								= bidirectional
  		__A   : Optional[Any]								= shared_representation_size
  		__A   : Any								= use_chunking
  		__A   : List[str]								= chunk_size
  		__A   : Any								= truncation
  		__A   : Optional[Any]								= normalize_before_mega
  		__A   : Optional[int]								= normalization_type
  		__A   : Optional[Any]								= norm_affine
  		__A   : List[str]								= dropout_prob
  		__A   : Optional[Any]								= hidden_dropout_prob
  		__A   : List[str]								= attention_probs_dropout_prob
  		__A   : List[str]								= use_feature_dropout
  		__A   : Any								= use_normalized_ffn
  		__A   : Any								= nffn_hidden_size
  		__A   : Union[str, Any]								= normalize_before_ffn
  		__A   : Dict								= nffn_activation_dropout_prob
  		__A   : str								= max_positions
  		__A   : str								= add_token_type_embeddings
  		__A   : str								= type_vocab_size
  		__A   : List[str]								= initializer_range
  		__A   : Any								= ema_delta_alpha_range
  		__A   : Union[str, Any]								= ema_beta_range
  		__A   : Optional[int]								= ema_gamma_omega_range
  		__A   : str								= relative_positional_bias
  		__A   : str								= use_cache
  		__A   : Dict								= classifier_dropout
  		__A   : Optional[int]								= add_lm_hidden_dense_layer
  		__A   : Dict								= 1  # not used but required by Hugging Face
  
  
  
  
  
  
  class     lowerCamelCase_			(  __UpperCAmelCase  ):
  
  
  
  
  	@property
  	def 					lowerCAmelCase_					(    self	:    int       ):
  
  
  
  		if self.task == "multiple-choice":
  			__A   : str								= {0: """batch""", 1: """choice""", 2: """sequence"""}
  		else:
  			__A   : List[str]								= {0: """batch""", 1: """sequence"""}
  		return OrderedDict(
  		    [
  		        ("""input_ids""", dynamic_axis),
  		        ("""attention_mask""", dynamic_axis),
  		    ]       )
  
  
  
  
  
  
style_context: 
  
  import unittest
  from pathlib import Path
  
  from transformers import is_vision_available, load_tool
  from transformers.testing_utils import get_tests_dir
  
  from .test_tools_common import ToolTesterMixin
  
  
  if is_vision_available():
  			from PIL import Image
  
  
  
  
  
  
  class     lowerCamelCase_			(  unittest.TestCase	,			_lowercase  ):
  
  
  
  
  	def 					lowerCAmelCase_					(    self	:    Dict       ):
  		__A   : str								= load_tool("""image-captioning"""       )
  		self.tool.setup()
  		__A   : Dict								= load_tool("""image-captioning"""				,			remote=__A       )
  
  
  
  
  	def 					lowerCAmelCase_					(    self	:    Optional[int]       ):
  		__A   : List[Any]								= Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""       )       ) / """000000039769.png"""       )
  		__A   : Optional[Any]								= self.tool(__A       )
  		self.assertEqual(__A				,			"""two cats sleeping on a couch"""       )
  
  
  
  
  	def 					lowerCAmelCase_					(    self	:    Dict       ):
  		__A   : Any								= Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""       )       ) / """000000039769.png"""       )
  		__A   : List[str]								= self.remote_tool(__A       )
  		self.assertEqual(__A				,			"""two cats sleeping on a couch"""       )
  
  
  
  
  	def 					lowerCAmelCase_					(    self	:    Union[str, Any]       ):
  		__A   : Optional[Any]								= Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""       )       ) / """000000039769.png"""       )
  		__A   : str								= self.tool(image=__A       )
  		self.assertEqual(__A				,			"""two cats sleeping on a couch"""       )
  
  
  
  
  	def 					lowerCAmelCase_					(    self	:    str       ):
  		__A   : Dict								= Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""       )       ) / """000000039769.png"""       )
  		__A   : List[Any]								= self.remote_tool(image=__A       )
  		self.assertEqual(__A				,			"""two cats sleeping on a couch"""       )
  
  
  
  
  
  