code: 
  
  
  
  from collections import OrderedDict
  from typing import Any, List, Mapping, Optional
  
  from ... import PretrainedConfig, PreTrainedTokenizer
  from ...onnx import OnnxConfig, PatchingSpec
  from ...utils import TensorType, is_torch_available, logging
  
  
  __A       					=		logging.get_logger(__name__)
  
  __A       					=		{
      'microsoft/layoutlm-base-uncased': (
          'https://huggingface.co/microsoft/layoutlm-base-uncased/resolve/main/config.json'
      ),
      'microsoft/layoutlm-large-uncased': (
          'https://huggingface.co/microsoft/layoutlm-large-uncased/resolve/main/config.json'
      ),
  }
  
  
  
  
  
  
  class 	lowercase		(				UpperCAmelCase_):
  
  
  
  
  
  
  	"""simple docstring"""
  
  
  	a__   :      Tuple	     =							"layoutlm"
  
  
  
  
  	def __init__(			self			:		int		,						__UpperCAmelCase			:		Optional[Any]=30_522		,						__UpperCAmelCase			:		List[str]=768		,						__UpperCAmelCase			:		Dict=12		,						__UpperCAmelCase			:		Tuple=12		,						__UpperCAmelCase			:		Optional[int]=3_072		,						__UpperCAmelCase			:		Dict="gelu"		,						__UpperCAmelCase			:		Tuple=0.1		,						__UpperCAmelCase			:		Optional[Any]=0.1		,						__UpperCAmelCase			:		Any=512		,						__UpperCAmelCase			:		Dict=2		,						__UpperCAmelCase			:		List[str]=0.02		,						__UpperCAmelCase			:		Dict=1E-12		,						__UpperCAmelCase			:		Union[str, Any]=0		,						__UpperCAmelCase			:		Optional[Any]="absolute"		,						__UpperCAmelCase			:		Union[str, Any]=True		,						__UpperCAmelCase			:		Optional[Any]=1_024		,						**__UpperCAmelCase			:		Dict		,						)    ->				Dict:
  							super().__init__(pad_token_id=__UpperCAmelCase		,						**__UpperCAmelCase  )
  							UpperCAmelCase_=     vocab_size
  							UpperCAmelCase_=     hidden_size
  							UpperCAmelCase_=     num_hidden_layers
  							UpperCAmelCase_=     num_attention_heads
  							UpperCAmelCase_=     hidden_act
  							UpperCAmelCase_=     intermediate_size
  							UpperCAmelCase_=     hidden_dropout_prob
  							UpperCAmelCase_=     attention_probs_dropout_prob
  							UpperCAmelCase_=     max_position_embeddings
  							UpperCAmelCase_=     type_vocab_size
  							UpperCAmelCase_=     initializer_range
  							UpperCAmelCase_=     layer_norm_eps
  							UpperCAmelCase_=     position_embedding_type
  							UpperCAmelCase_=     use_cache
  							UpperCAmelCase_=     max_ad_position_embeddings
  
  
  
  
  
  
  class 	lowercase		(				UpperCAmelCase_):
  
  
  
  
  
  
  	"""simple docstring"""
  
  
  	def __init__(			self			:		List[Any]		,						__UpperCAmelCase			:		int		,						__UpperCAmelCase			:		List[str] = "default"		,						__UpperCAmelCase			:		Dict = None		,						)    ->				Optional[Any]:
  							super().__init__(__UpperCAmelCase		,						task=__UpperCAmelCase		,						patching_specs=__UpperCAmelCase  )
  							UpperCAmelCase_=     config.max_ad_position_embeddings - 1
  
  
  
  
  	@property
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Any  )    ->				Mapping[str, Mapping[int, str]]:
  							return OrderedDict(
  							    [
  							        ("""input_ids""", {0: """batch""", 1: """sequence"""}),
  							        ("""bbox""", {0: """batch""", 1: """sequence"""}),
  							        ("""attention_mask""", {0: """batch""", 1: """sequence"""}),
  							        ("""token_type_ids""", {0: """batch""", 1: """sequence"""}),
  							    ]  )
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		int		,						__UpperCAmelCase			:		Optional[Any]		,						__UpperCAmelCase			:		Optional[Any] = -1		,						__UpperCAmelCase			:		Dict = -1		,						__UpperCAmelCase			:		Optional[int] = False		,						__UpperCAmelCase			:		List[Any] = None		,						)    ->				Mapping[str, Any]:
  							UpperCAmelCase_=     super().generate_dummy_inputs(
  							    __UpperCAmelCase		,						batch_size=__UpperCAmelCase		,						seq_length=__UpperCAmelCase		,						is_pair=__UpperCAmelCase		,						framework=__UpperCAmelCase  )
  
  							# Generate a dummy bbox
  							UpperCAmelCase_=     [48, 84, 73, 128]
  
  							if not framework == TensorType.PYTORCH:
  													raise NotImplementedError("""Exporting LayoutLM to ONNX is currently only supported for PyTorch."""  )
  
  							if not is_torch_available():
  													raise ValueError("""Cannot generate dummy inputs without PyTorch installed."""  )
  							import torch
  
  							UpperCAmelCase_,     UpperCAmelCase_=     input_dict["""input_ids"""].shape
  							UpperCAmelCase_=     torch.tensor([*[box] * seq_length]  ).tile(__UpperCAmelCase		,						1		,						1  )
  							return input_dict
  
  
  
  
  
style_context: 
  
  
  
  from ...configuration_utils import PretrainedConfig
  from ...utils import logging
  
  
  __A       					=		logging.get_logger(__name__)
  
  __A       					=		{
      '''ZinengTang/tvlt-base''': '''https://huggingface.co/ZinengTang/tvlt-base/blob/main/config.json''',
  }
  
  
  
  
  
  
  class 	lowercase		(				snake_case__):
  
  
  
  
  
  
  	"""simple docstring"""
  
  
  	a__   :      Tuple	     =							"tvlt"
  
  
  
  
  	def __init__(			self			:		List[str]		,						__UpperCAmelCase			:		List[str]=224		,						__UpperCAmelCase			:		List[str]=2_048		,						__UpperCAmelCase			:		Tuple=128		,						__UpperCAmelCase			:		Union[str, Any]=[16, 16]		,						__UpperCAmelCase			:		str=[16, 16]		,						__UpperCAmelCase			:		str=3		,						__UpperCAmelCase			:		List[str]=1		,						__UpperCAmelCase			:		Tuple=8		,						__UpperCAmelCase			:		Optional[Any]=768		,						__UpperCAmelCase			:		List[Any]=12		,						__UpperCAmelCase			:		Tuple=12		,						__UpperCAmelCase			:		List[str]=3_072		,						__UpperCAmelCase			:		List[Any]="gelu"		,						__UpperCAmelCase			:		str=0.0		,						__UpperCAmelCase			:		str=0.0		,						__UpperCAmelCase			:		List[Any]=0.02		,						__UpperCAmelCase			:		Optional[int]=1E-6		,						__UpperCAmelCase			:		Tuple=True		,						__UpperCAmelCase			:		List[Any]=False		,						__UpperCAmelCase			:		Union[str, Any]=16		,						__UpperCAmelCase			:		Any=512		,						__UpperCAmelCase			:		Optional[Any]=8		,						__UpperCAmelCase			:		Dict=2_048		,						__UpperCAmelCase			:		Dict=0.75		,						__UpperCAmelCase			:		Union[str, Any]=0.15		,						__UpperCAmelCase			:		Any="frame-level"		,						__UpperCAmelCase			:		int=True		,						__UpperCAmelCase			:		List[Any]=True		,						__UpperCAmelCase			:		Union[str, Any]="classification"		,						**__UpperCAmelCase			:		Any		,						)    ->				Tuple:
  							super().__init__(**__UpperCAmelCase  )
  
  							if audio_mask_type not in ("frame-level", "patch_level"):
  													raise ValueError(
  													    """audio_mask_type must be one of two acceptable strategies - {'frame_level', 'patch-level') """
  													    F"""got {audio_mask_type}"""  )
  
  							UpperCAmelCase_=     image_size
  							UpperCAmelCase_=     spectrogram_length
  							UpperCAmelCase_=     frequency_length
  							UpperCAmelCase_=     image_patch_size
  							UpperCAmelCase_=     audio_patch_size
  							UpperCAmelCase_=     num_image_channels
  							UpperCAmelCase_=     num_audio_channels
  							UpperCAmelCase_=     num_frames
  
  							UpperCAmelCase_=     hidden_size
  							UpperCAmelCase_=     num_hidden_layers
  							UpperCAmelCase_=     num_attention_heads
  							UpperCAmelCase_=     intermediate_size
  							UpperCAmelCase_=     hidden_act
  							UpperCAmelCase_=     hidden_dropout_prob
  							UpperCAmelCase_=     attention_probs_dropout_prob
  							UpperCAmelCase_=     initializer_range
  							UpperCAmelCase_=     layer_norm_eps
  							UpperCAmelCase_=     qkv_bias
  							UpperCAmelCase_=     use_mean_pooling
  
  							UpperCAmelCase_=     decoder_num_attention_heads
  							UpperCAmelCase_=     decoder_hidden_size
  							UpperCAmelCase_=     decoder_num_hidden_layers
  							UpperCAmelCase_=     decoder_intermediate_size
  							UpperCAmelCase_=     pixel_mask_ratio
  							UpperCAmelCase_=     audio_mask_ratio
  							UpperCAmelCase_=     audio_mask_type
  
  							UpperCAmelCase_=     task_matching
  							UpperCAmelCase_=     task_mae
  							UpperCAmelCase_=     loss_type
  
  
  
  
  