'''simple docstring'''





import unicodedata
from dataclasses import dataclass
from typing import Optional, Union

import numpy as np

from transformers.data.data_collator import DataCollatorMixin
from transformers.file_utils import PaddingStrategy
from transformers.tokenization_utils_base import PreTrainedTokenizerBase
def 						__A							(     UpperCAmelCase     ,UpperCAmelCase     ,UpperCAmelCase     ,UpperCAmelCase					)     ->			int:




						'''simple docstring'''
						if isinstance(UpperCAmelCase     ,UpperCAmelCase					):
												_UpperCamelCase			:			List[Any]   			=						np.full((len(UpperCAmelCase					), sequence_length, 2)     ,UpperCAmelCase					)
						else:
												_UpperCamelCase			:			Tuple   			=						np.full((len(UpperCAmelCase					), sequence_length)     ,UpperCAmelCase					)

						for i, tensor in enumerate(UpperCAmelCase					):
												if padding_side == "right":
																		if isinstance(UpperCAmelCase     ,UpperCAmelCase					):
																								_UpperCamelCase			:			List[str]   			=						tensor[:sequence_length]
																		else:
																								_UpperCamelCase			:			Union[str, Any]   			=						tensor[:sequence_length]
												else:
																		if isinstance(UpperCAmelCase     ,UpperCAmelCase					):
																								_UpperCamelCase			:			Optional[Any]   			=						tensor[:sequence_length]
																		else:
																								_UpperCamelCase			:			Tuple   			=						tensor[:sequence_length]

						return out_tensor.tolist()
def 						__A							(     UpperCAmelCase					)     ->			List[str]:




						'''simple docstring'''
						_UpperCamelCase			:			List[str]   			=						ord(UpperCAmelCase					)
						if (cp >= 3_3 and cp <= 4_7) or (cp >= 5_8 and cp <= 6_4) or (cp >= 9_1 and cp <= 9_6) or (cp >= 1_2_3 and cp <= 1_2_6):
												return True
						_UpperCamelCase			:			List[str]   			=						unicodedata.category(UpperCAmelCase					)
						if cat.startswith("P"					):
												return True
						return False






@dataclass
class 		SCREAMING_SNAKE_CASE     (					SCREAMING_SNAKE_CASE	):







				'''simple docstring'''
				UpperCAmelCase__							=							42
				UpperCAmelCase__							=							True
				UpperCAmelCase__							=							None
				UpperCAmelCase__							=							None
				UpperCAmelCase__							=							-1_00
				UpperCAmelCase__							=							"pt"





				def  snake_case__				(						self					:						List[str]       ,		lowercase__					:						int					)							->Union[str, Any]:


										'''simple docstring'''




										import torch

										_UpperCamelCase			:			List[str]   			=						"label" if "label" in features[0].keys() else "labels"
										_UpperCamelCase			:			str   			=						[feature[label_name] for feature in features] if label_name in features[0].keys() else None
										_UpperCamelCase			:			List[str]   			=						self.tokenizer.pad(
										    lowercase__       ,		padding=self.padding       ,		max_length=self.max_length       ,		pad_to_multiple_of=self.pad_to_multiple_of       ,		return_tensors="pt" if labels is None else None       ,		)

										if labels is None:
																return batch

										_UpperCamelCase			:			Any   			=						torch.tensor(batch["entity_ids"]					).shape[1]
										_UpperCamelCase			:			int   			=						self.tokenizer.padding_side
										if padding_side == "right":
																_UpperCamelCase			:			str   			=						[
																    list(lowercase__					) + [self.label_pad_token_id] * (sequence_length - len(lowercase__					)) for label in labels
																]
										else:
																_UpperCamelCase			:			Union[str, Any]   			=						[
																    [self.label_pad_token_id] * (sequence_length - len(lowercase__					)) + list(lowercase__					) for label in labels
																]

										_UpperCamelCase			:			Union[str, Any]   			=						[feature["ner_tags"] for feature in features]
										_UpperCamelCase			:			Optional[int]   			=						padding_tensor(lowercase__       ,		-1       ,		lowercase__       ,		lowercase__					)
										_UpperCamelCase			:			int   			=						[feature["original_entity_spans"] for feature in features]
										_UpperCamelCase			:			Dict   			=						padding_tensor(lowercase__       ,		(-1, -1)       ,		lowercase__       ,		lowercase__					)
										_UpperCamelCase			:			List[Any]   			=						{k: torch.tensor(lowercase__       ,		dtype=torch.intaa					) for k, v in batch.items()}

										return batch



'''simple docstring'''





from collections import OrderedDict
from typing import List, Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowerCAmelCase_	:		Optional[Any]			=     logging.get_logger(__name__)

lowerCAmelCase_	:		List[Any]			=     {
    """google/efficientnet-b7""": """https://huggingface.co/google/efficientnet-b7/resolve/main/config.json""",
}




class 		SCREAMING_SNAKE_CASE     (					SCREAMING_SNAKE_CASE	):







				'''simple docstring'''
				UpperCAmelCase__							=							'''efficientnet'''





				def __init__(						self					:						Optional[int]       ,		lowercase__					:						int = 3       ,		lowercase__					:						int = 600       ,		lowercase__					:						float = 2.0       ,		lowercase__					:						float = 3.1       ,		lowercase__					:						int = 8       ,		lowercase__					:						List[int] = [3, 3, 5, 3, 5, 5, 3]       ,		lowercase__					:						List[int] = [32, 16, 24, 40, 80, 112, 192]       ,		lowercase__					:						List[int] = [16, 24, 40, 80, 112, 192, 320]       ,		lowercase__					:						List[int] = []       ,		lowercase__					:						List[int] = [1, 2, 2, 2, 1, 2, 1]       ,		lowercase__					:						List[int] = [1, 2, 2, 3, 3, 4, 1]       ,		lowercase__					:						List[int] = [1, 6, 6, 6, 6, 6, 6]       ,		lowercase__					:						float = 0.2_5       ,		lowercase__					:						str = "swish"       ,		lowercase__					:						int = 2_560       ,		lowercase__					:						str = "mean"       ,		lowercase__					:						float = 0.0_2       ,		lowercase__					:						float = 0.0_0_1       ,		lowercase__					:						float = 0.9_9       ,		lowercase__					:						float = 0.5       ,		lowercase__					:						float = 0.2       ,		**lowercase__					:						int       ,		)							->Optional[int]:


										'''simple docstring'''




										super().__init__(**lowercase__					)

										_UpperCamelCase			:			int   			=						num_channels
										_UpperCamelCase			:			Any   			=						image_size
										_UpperCamelCase			:			Union[str, Any]   			=						width_coefficient
										_UpperCamelCase			:			List[str]   			=						depth_coefficient
										_UpperCamelCase			:			List[Any]   			=						depth_divisor
										_UpperCamelCase			:			Optional[Any]   			=						kernel_sizes
										_UpperCamelCase			:			int   			=						in_channels
										_UpperCamelCase			:			Any   			=						out_channels
										_UpperCamelCase			:			Union[str, Any]   			=						depthwise_padding
										_UpperCamelCase			:			Optional[Any]   			=						strides
										_UpperCamelCase			:			Union[str, Any]   			=						num_block_repeats
										_UpperCamelCase			:			List[str]   			=						expand_ratios
										_UpperCamelCase			:			Dict   			=						squeeze_expansion_ratio
										_UpperCamelCase			:			Union[str, Any]   			=						hidden_act
										_UpperCamelCase			:			List[str]   			=						hidden_dim
										_UpperCamelCase			:			Dict   			=						pooling_type
										_UpperCamelCase			:			List[str]   			=						initializer_range
										_UpperCamelCase			:			Any   			=						batch_norm_eps
										_UpperCamelCase			:			List[str]   			=						batch_norm_momentum
										_UpperCamelCase			:			Optional[Any]   			=						dropout_rate
										_UpperCamelCase			:			Dict   			=						drop_connect_rate
										_UpperCamelCase			:			Dict   			=						sum(lowercase__					) * 4





class 		SCREAMING_SNAKE_CASE     (					SCREAMING_SNAKE_CASE	):







				'''simple docstring'''
				UpperCAmelCase__							=							version.parse('''1.11'''	)





				@property
				def  snake_case__				(						self					:						Union[str, Any]					)							->Mapping[str, Mapping[int, str]]:


										'''simple docstring'''




										return OrderedDict(
										    [
										        ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
										    ]					)







				@property
				def  snake_case__				(						self					:						Any					)							->float:


										'''simple docstring'''




										return 1e-5


