





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 	UpperCamelCase_							(  UpperCamelCase__     ):
							lowerCamelCase_							     =       "tapas"


							def __init__(				self     :Tuple				,					__A     :List[Any]=3_0522				,					__A     :Dict=768				,					__A     :List[Any]=12				,					__A     :int=12				,					__A     :Any=3072				,					__A     :str="gelu"				,					__A     :Union[str, Any]=0.1				,					__A     :Optional[Any]=0.1				,					__A     :Tuple=1024				,					__A     :Any=[3, 256, 256, 2, 256, 256, 10]				,					__A     :Optional[Any]=0.0_2				,					__A     :Tuple=1E-12				,					__A     :Any=0				,					__A     :Union[str, Any]=1_0.0				,					__A     :Any=0				,					__A     :Tuple=1.0				,					__A     :Optional[int]=None				,					__A     :Dict=1.0				,					__A     :Optional[Any]=False				,					__A     :Union[str, Any]=None				,					__A     :List[Any]=1.0				,					__A     :int=1.0				,					__A     :Optional[int]=False				,					__A     :Optional[int]=False				,					__A     :Tuple="ratio"				,					__A     :List[Any]=None				,					__A     :Optional[int]=None				,					__A     :Any=64				,					__A     :Tuple=32				,					__A     :Any=False				,					__A     :List[str]=True				,					__A     :Optional[Any]=False				,					__A     :str=False				,					__A     :List[str]=True				,					__A     :Any=False				,					__A     :Optional[int]=None				,					__A     :Any=None				,					**__A     :Any				,					) -> List[Any]:



									"""simple docstring"""



									super().__init__(pad_token_id=__A				,					**__A		)

									# 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				,					__A		):
											SCREAMING_SNAKE_CASE__								=   {int(__A		): v for k, v in aggregation_labels.items()}






import unittest

from diffusers.pipelines.pipeline_utils import is_safetensors_compatible




class 	UpperCamelCase_							(  unittest.TestCase     ):


							def   _snake_case	(				self     :Tuple		) -> Any:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								=   [
									    """safety_checker/pytorch_model.bin""",
									    """safety_checker/model.safetensors""",
									    """vae/diffusion_pytorch_model.bin""",
									    """vae/diffusion_pytorch_model.safetensors""",
									    """text_encoder/pytorch_model.bin""",
									    """text_encoder/model.safetensors""",
									    """unet/diffusion_pytorch_model.bin""",
									    """unet/diffusion_pytorch_model.safetensors""",
									]
									self.assertTrue(is_safetensors_compatible(__A		)		)


							def   _snake_case	(				self     :List[str]		) -> int:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								=   [
									    """unet/diffusion_pytorch_model.bin""",
									    """unet/diffusion_pytorch_model.safetensors""",
									]
									self.assertTrue(is_safetensors_compatible(__A		)		)


							def   _snake_case	(				self     :Tuple		) -> Optional[Any]:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								=   [
									    """safety_checker/pytorch_model.bin""",
									    """safety_checker/model.safetensors""",
									    """vae/diffusion_pytorch_model.bin""",
									    """vae/diffusion_pytorch_model.safetensors""",
									    """text_encoder/pytorch_model.bin""",
									    """text_encoder/model.safetensors""",
									    """unet/diffusion_pytorch_model.bin""",
									    # Removed: 'unet/diffusion_pytorch_model.safetensors',
									]
									self.assertFalse(is_safetensors_compatible(__A		)		)


							def   _snake_case	(				self     :Union[str, Any]		) -> Union[str, Any]:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								=   [
									    """text_encoder/pytorch_model.bin""",
									    """text_encoder/model.safetensors""",
									]
									self.assertTrue(is_safetensors_compatible(__A		)		)


							def   _snake_case	(				self     :Optional[Any]		) -> Any:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								=   [
									    """safety_checker/pytorch_model.bin""",
									    """safety_checker/model.safetensors""",
									    """vae/diffusion_pytorch_model.bin""",
									    """vae/diffusion_pytorch_model.safetensors""",
									    """text_encoder/pytorch_model.bin""",
									    # Removed: 'text_encoder/model.safetensors',
									    """unet/diffusion_pytorch_model.bin""",
									    """unet/diffusion_pytorch_model.safetensors""",
									]
									self.assertFalse(is_safetensors_compatible(__A		)		)


							def   _snake_case	(				self     :Tuple		) -> List[Any]:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								=   [
									    """safety_checker/pytorch_model.fp16.bin""",
									    """safety_checker/model.fp16.safetensors""",
									    """vae/diffusion_pytorch_model.fp16.bin""",
									    """vae/diffusion_pytorch_model.fp16.safetensors""",
									    """text_encoder/pytorch_model.fp16.bin""",
									    """text_encoder/model.fp16.safetensors""",
									    """unet/diffusion_pytorch_model.fp16.bin""",
									    """unet/diffusion_pytorch_model.fp16.safetensors""",
									]
									SCREAMING_SNAKE_CASE__								=   """fp16"""
									self.assertTrue(is_safetensors_compatible(__A				,					variant=__A		)		)


							def   _snake_case	(				self     :Any		) -> Tuple:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								=   [
									    """unet/diffusion_pytorch_model.fp16.bin""",
									    """unet/diffusion_pytorch_model.fp16.safetensors""",
									]
									SCREAMING_SNAKE_CASE__								=   """fp16"""
									self.assertTrue(is_safetensors_compatible(__A				,					variant=__A		)		)


							def   _snake_case	(				self     :str		) -> Tuple:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								=   [
									    """unet/diffusion_pytorch_model.bin""",
									    """unet/diffusion_pytorch_model.safetensors""",
									]
									SCREAMING_SNAKE_CASE__								=   """fp16"""
									self.assertTrue(is_safetensors_compatible(__A				,					variant=__A		)		)


							def   _snake_case	(				self     :List[Any]		) -> List[Any]:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								=   [
									    """safety_checker/pytorch_model.fp16.bin""",
									    """safety_checker/model.fp16.safetensors""",
									    """vae/diffusion_pytorch_model.fp16.bin""",
									    """vae/diffusion_pytorch_model.fp16.safetensors""",
									    """text_encoder/pytorch_model.fp16.bin""",
									    """text_encoder/model.fp16.safetensors""",
									    """unet/diffusion_pytorch_model.fp16.bin""",
									    # Removed: 'unet/diffusion_pytorch_model.fp16.safetensors',
									]
									SCREAMING_SNAKE_CASE__								=   """fp16"""
									self.assertFalse(is_safetensors_compatible(__A				,					variant=__A		)		)


							def   _snake_case	(				self     :str		) -> List[str]:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								=   [
									    """text_encoder/pytorch_model.fp16.bin""",
									    """text_encoder/model.fp16.safetensors""",
									]
									SCREAMING_SNAKE_CASE__								=   """fp16"""
									self.assertTrue(is_safetensors_compatible(__A				,					variant=__A		)		)


							def   _snake_case	(				self     :Optional[int]		) -> Optional[Any]:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								=   [
									    """text_encoder/pytorch_model.bin""",
									    """text_encoder/model.safetensors""",
									]
									SCREAMING_SNAKE_CASE__								=   """fp16"""
									self.assertTrue(is_safetensors_compatible(__A				,					variant=__A		)		)


							def   _snake_case	(				self     :Union[str, Any]		) -> Optional[Any]:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								=   [
									    """safety_checker/pytorch_model.fp16.bin""",
									    """safety_checker/model.fp16.safetensors""",
									    """vae/diffusion_pytorch_model.fp16.bin""",
									    """vae/diffusion_pytorch_model.fp16.safetensors""",
									    """text_encoder/pytorch_model.fp16.bin""",
									    # 'text_encoder/model.fp16.safetensors',
									    """unet/diffusion_pytorch_model.fp16.bin""",
									    """unet/diffusion_pytorch_model.fp16.safetensors""",
									]
									SCREAMING_SNAKE_CASE__								=   """fp16"""
									self.assertFalse(is_safetensors_compatible(__A				,					variant=__A		)		)