

from ...configuration_utils import PretrainedConfig


_lowerCamelCase							       ={
    "google/tapas-base-finetuned-sqa": (
        "https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json"
    ),
    "google/tapas-base-finetuned-wtq": (
        "https://huggingface.co/google/tapas-base-finetuned-wtq/resolve/main/config.json"
    ),
    "google/tapas-base-finetuned-wikisql-supervised": (
        "https://huggingface.co/google/tapas-base-finetuned-wikisql-supervised/resolve/main/config.json"
    ),
    "google/tapas-base-finetuned-tabfact": (
        "https://huggingface.co/google/tapas-base-finetuned-tabfact/resolve/main/config.json"
    ),
}



class 		a_       (							A__     ):



      """simple docstring"""







      __UpperCAmelCase					=      'tapas'
      def __init__(      self     :							Dict			,snake_case     :							Tuple=30522			,snake_case     :							Dict=768			,snake_case     :							Any=12			,snake_case     :							List[str]=12			,snake_case     :							Optional[Any]=3072			,snake_case     :							Any="gelu"			,snake_case     :							List[Any]=0.1			,snake_case     :							Any=0.1			,snake_case     :							Union[str, Any]=1024			,snake_case     :							List[str]=[3, 256, 256, 2, 256, 256, 10]			,snake_case     :							Any=0.02			,snake_case     :							Optional[Any]=1e-12			,snake_case     :							Optional[int]=0			,snake_case     :							Tuple=10.0			,snake_case     :							Any=0			,snake_case     :							Optional[int]=1.0			,snake_case     :							Tuple=None			,snake_case     :							Optional[Any]=1.0			,snake_case     :							Any=False			,snake_case     :							Tuple=None			,snake_case     :							int=1.0			,snake_case     :							Union[str, Any]=1.0			,snake_case     :							Dict=False			,snake_case     :							List[Any]=False			,snake_case     :							Any="ratio"			,snake_case     :							Union[str, Any]=None			,snake_case     :							Union[str, Any]=None			,snake_case     :							int=64			,snake_case     :							List[str]=32			,snake_case     :							Optional[int]=False			,snake_case     :							Optional[int]=True			,snake_case     :							str=False			,snake_case     :							List[Any]=False			,snake_case     :							Any=True			,snake_case     :							int=False			,snake_case     :							Dict=None			,snake_case     :							Union[str, Any]=None			,**snake_case     :							Optional[int]			,):
           super().__init__(pad_token_id=__snake_case			,**__snake_case				)

           # BERT hyperparameters (with updated max_position_embeddings and type_vocab_sizes)
           SCREAMING_SNAKE_CASE      						=vocab_size
           SCREAMING_SNAKE_CASE      						=hidden_size
           SCREAMING_SNAKE_CASE      						=num_hidden_layers
           SCREAMING_SNAKE_CASE      						=num_attention_heads
           SCREAMING_SNAKE_CASE      						=hidden_act
           SCREAMING_SNAKE_CASE      						=intermediate_size
           SCREAMING_SNAKE_CASE      						=hidden_dropout_prob
           SCREAMING_SNAKE_CASE      						=attention_probs_dropout_prob
           SCREAMING_SNAKE_CASE      						=max_position_embeddings
           SCREAMING_SNAKE_CASE      						=type_vocab_sizes
           SCREAMING_SNAKE_CASE      						=initializer_range
           SCREAMING_SNAKE_CASE      						=layer_norm_eps

           # Fine-tuning task hyperparameters
           SCREAMING_SNAKE_CASE      						=positive_label_weight
           SCREAMING_SNAKE_CASE      						=num_aggregation_labels
           SCREAMING_SNAKE_CASE      						=aggregation_loss_weight
           SCREAMING_SNAKE_CASE      						=use_answer_as_supervision
           SCREAMING_SNAKE_CASE      						=answer_loss_importance
           SCREAMING_SNAKE_CASE      						=use_normalized_answer_loss
           SCREAMING_SNAKE_CASE      						=huber_loss_delta
           SCREAMING_SNAKE_CASE      						=temperature
           SCREAMING_SNAKE_CASE      						=aggregation_temperature
           SCREAMING_SNAKE_CASE      						=use_gumbel_for_cells
           SCREAMING_SNAKE_CASE      						=use_gumbel_for_aggregation
           SCREAMING_SNAKE_CASE      						=average_approximation_function
           SCREAMING_SNAKE_CASE      						=cell_selection_preference
           SCREAMING_SNAKE_CASE      						=answer_loss_cutoff
           SCREAMING_SNAKE_CASE      						=max_num_rows
           SCREAMING_SNAKE_CASE      						=max_num_columns
           SCREAMING_SNAKE_CASE      						=average_logits_per_cell
           SCREAMING_SNAKE_CASE      						=select_one_column
           SCREAMING_SNAKE_CASE      						=allow_empty_column_selection
           SCREAMING_SNAKE_CASE      						=init_cell_selection_weights_to_zero
           SCREAMING_SNAKE_CASE      						=reset_position_index_per_cell
           SCREAMING_SNAKE_CASE      						=disable_per_token_loss

           # Aggregation hyperparameters
           SCREAMING_SNAKE_CASE      						=aggregation_labels
           SCREAMING_SNAKE_CASE      						=no_aggregation_label_index

           if isinstance(self.aggregation_labels			,__snake_case				):
                SCREAMING_SNAKE_CASE      						={int(__snake_case				): v for k, v in aggregation_labels.items()}






'''simple docstring'''






from manim import *

class 				SCREAMING_SNAKE_CASE(							A__			):







	"""simple docstring"""






	def      A	(						self			:     Union[str, Any]		)			->		List[str]:
								UpperCAmelCase :       Optional[Any] 							=		Rectangle(height=0.5		,			width=0.5		)
								UpperCAmelCase :       str 							=		Rectangle(height=0.46		,			width=0.46		).set_stroke(width=0		)

								UpperCAmelCase :       Tuple 							=		[mem.copy() for i in range(6		)]
								UpperCAmelCase :       Optional[int] 							=		[mem.copy() for i in range(6		)]
								UpperCAmelCase :       Dict 							=		VGroup(*__snake_case		).arrange(__snake_case		,			buff=0		)
								UpperCAmelCase :       Any 							=		VGroup(*__snake_case		).arrange(__snake_case		,			buff=0		)
								UpperCAmelCase :       Union[str, Any] 							=		VGroup(__snake_case		,			__snake_case		).arrange(__snake_case		,			buff=0		)
								UpperCAmelCase :       Optional[Any] 							=		Text('''CPU'''		,			font_size=24		)
								UpperCAmelCase :       Union[str, Any] 							=		Group(__snake_case		,			__snake_case		).arrange(__snake_case		,			buff=0.5		,			aligned_edge=__snake_case		)
								cpu.move_to([-2.5, -0.5, 0]		)
								self.add(__snake_case		)

								UpperCAmelCase :       Optional[Any] 							=		[mem.copy() for i in range(4		)]
								UpperCAmelCase :       Union[str, Any] 							=		VGroup(*__snake_case		).arrange(__snake_case		,			buff=0		)
								UpperCAmelCase :       List[str] 							=		Text('''GPU'''		,			font_size=24		)
								UpperCAmelCase :       Dict 							=		Group(__snake_case		,			__snake_case		).arrange(__snake_case		,			buff=0.5		,			aligned_edge=__snake_case		)
								gpu.move_to([-1, -1, 0]		)
								self.add(__snake_case		)

								UpperCAmelCase :       int 							=		[mem.copy() for i in range(6		)]
								UpperCAmelCase :       Union[str, Any] 							=		VGroup(*__snake_case		).arrange(__snake_case		,			buff=0		)

								UpperCAmelCase :       List[str] 							=		Text('''Model'''		,			font_size=24		)
								UpperCAmelCase :       Tuple 							=		Group(__snake_case		,			__snake_case		).arrange(__snake_case		,			buff=0.5		,			aligned_edge=__snake_case		)
								model.move_to([3, -1.0, 0]		)
								self.add(__snake_case		)

								UpperCAmelCase :       Any 							=		[]
								for i, rect in enumerate(__snake_case		):
															rect.set_stroke(__snake_case		)
															# target = fill.copy().set_fill(YELLOW, opacity=0.7)
															# target.move_to(rect)
															# self.add(target)

															UpperCAmelCase :       Dict 							=		Rectangle(height=0.46 / 4		,			width=0.46 / 3		).set_stroke(width=0.0		).set_fill(__snake_case		,			opacity=0.7		)

															if i == 0:
																						cpu_target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT		)		,			buff=0.02		,			direction=__snake_case		)
																						cpu_target.set_x(cpu_target.get_x() + 0.1		)
															elif i == 3:
																						cpu_target.next_to(cpu_targs[0]		,			direction=__snake_case		,			buff=0.0		)
															else:
																						cpu_target.next_to(cpu_targs[i - 1]		,			direction=__snake_case		,			buff=0.0		)
															self.add(__snake_case		)
															cpu_targs.append(__snake_case		)

								UpperCAmelCase :       int 							=		[mem.copy() for i in range(6		)]
								UpperCAmelCase :       int 							=		VGroup(*__snake_case		).arrange(__snake_case		,			buff=0		)

								UpperCAmelCase :       Any 							=		Text('''Loaded Checkpoint'''		,			font_size=24		)
								UpperCAmelCase :       Union[str, Any] 							=		Group(__snake_case		,			__snake_case		).arrange(__snake_case		,			aligned_edge=__snake_case		,			buff=0.4		)
								checkpoint.move_to([3, 0.5, 0]		)

								UpperCAmelCase :       Optional[int] 							=		Square(side_length=2.2		)
								key.move_to([-5, 2, 0]		)

								UpperCAmelCase :       str 							=		MarkupText(
								    F"""<b>Key:</b>\n\n<span fgcolor='{YELLOW}'>●</span> Empty Model"""		,			font_size=18		,			)

								key_text.move_to([-5, 2.4, 0]		)

								self.add(__snake_case		,			__snake_case		)

								UpperCAmelCase :       Tuple 							=		MarkupText(
								    F"""<span fgcolor='{BLUE}'>●</span> Checkpoint"""		,			font_size=18		,			)

								blue_text.next_to(__snake_case		,			DOWN * 2.4		,			aligned_edge=key_text.get_left()		)

								UpperCAmelCase :       List[Any] 							=		MarkupText(
								    F"""Next, a <i><span fgcolor=\"{BLUE}\">second</span></i> model is loaded into memory,\nwith the weights of a <span fgcolor=\"{BLUE}\">single shard</span>."""		,			font_size=24		,			)
								step_a.move_to([2, 2, 0]		)
								self.play(Write(__snake_case		)		,			Write(__snake_case		)		)

								self.play(Write(__snake_case		,			run_time=1		)		,			Create(__snake_case		,			run_time=1		)		)

								UpperCAmelCase :       Tuple 							=		[]
								UpperCAmelCase :       int 							=		[]
								for i, rect in enumerate(__snake_case		):
															UpperCAmelCase :       Any 							=		fill.copy().set_fill(__snake_case		,			opacity=0.7		)
															target.move_to(__snake_case		)
															first_animations.append(GrowFromCenter(__snake_case		,			run_time=1		)		)

															UpperCAmelCase :       List[str] 							=		target.copy()
															cpu_target.generate_target()
															if i < 5:
																						cpu_target.target.move_to(cpu_left_col_base[i + 1]		)
															else:
																						cpu_target.target.move_to(cpu_right_col_base[i - 5]		)
															second_animations.append(MoveToTarget(__snake_case		,			run_time=1.5		)		)

								self.play(*__snake_case		)
								self.play(*__snake_case		)
								self.wait()





