

from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


A__							=				{"configuration_pegasus": ["PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP", "PegasusConfig"]}

try:
						if not is_sentencepiece_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A__							=				["PegasusTokenizer"]

try:
						if not is_tokenizers_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A__							=				["PegasusTokenizerFast"]

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A__							=				[
						    "PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST",
						    "PegasusForCausalLM",
						    "PegasusForConditionalGeneration",
						    "PegasusModel",
						    "PegasusPreTrainedModel",
						]

try:
						if not is_tf_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A__							=				[
						    "TFPegasusForConditionalGeneration",
						    "TFPegasusModel",
						    "TFPegasusPreTrainedModel",
						]

try:
						if not is_flax_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A__							=				[
						    "FlaxPegasusForConditionalGeneration",
						    "FlaxPegasusModel",
						    "FlaxPegasusPreTrainedModel",
						]


if TYPE_CHECKING:
						from .configuration_pegasus import PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP, PegasusConfig

						try:
												if not is_sentencepiece_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .tokenization_pegasus import PegasusTokenizer

						try:
												if not is_tokenizers_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .tokenization_pegasus_fast import PegasusTokenizerFast

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_pegasus import (
												    PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST,
												    PegasusForCausalLM,
												    PegasusForConditionalGeneration,
												    PegasusModel,
												    PegasusPreTrainedModel,
												)

						try:
												if not is_tf_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_tf_pegasus import TFPegasusForConditionalGeneration, TFPegasusModel, TFPegasusPreTrainedModel

						try:
												if not is_flax_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_flax_pegasus import (
												    FlaxPegasusForConditionalGeneration,
												    FlaxPegasusModel,
												    FlaxPegasusPreTrainedModel,
												)

else:
						import sys

						A__							=				_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)







from collections import OrderedDict
from typing import Mapping

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


A__							=				logging.get_logger(__name__)

A__							=				{
    "nghuyong/ernie-1.0-base-zh": "https://huggingface.co/nghuyong/ernie-1.0-base-zh/resolve/main/config.json",
    "nghuyong/ernie-2.0-base-en": "https://huggingface.co/nghuyong/ernie-2.0-base-en/resolve/main/config.json",
    "nghuyong/ernie-2.0-large-en": "https://huggingface.co/nghuyong/ernie-2.0-large-en/resolve/main/config.json",
    "nghuyong/ernie-3.0-base-zh": "https://huggingface.co/nghuyong/ernie-3.0-base-zh/resolve/main/config.json",
    "nghuyong/ernie-3.0-medium-zh": "https://huggingface.co/nghuyong/ernie-3.0-medium-zh/resolve/main/config.json",
    "nghuyong/ernie-3.0-mini-zh": "https://huggingface.co/nghuyong/ernie-3.0-mini-zh/resolve/main/config.json",
    "nghuyong/ernie-3.0-micro-zh": "https://huggingface.co/nghuyong/ernie-3.0-micro-zh/resolve/main/config.json",
    "nghuyong/ernie-3.0-nano-zh": "https://huggingface.co/nghuyong/ernie-3.0-nano-zh/resolve/main/config.json",
    "nghuyong/ernie-gram-zh": "https://huggingface.co/nghuyong/ernie-gram-zh/resolve/main/config.json",
    "nghuyong/ernie-health-zh": "https://huggingface.co/nghuyong/ernie-health-zh/resolve/main/config.json",
}

class 					__UpperCamelCase					(       SCREAMING_SNAKE_CASE      ):
	_lowercase	: Dict												=	"ernie"







	def __init__( self:			List[Any]	,			__UpperCamelCase:			Dict=3_05_22	,			__UpperCamelCase:			str=7_68	,			__UpperCamelCase:			Tuple=12	,			__UpperCamelCase:			int=12	,			__UpperCamelCase:			Optional[Any]=30_72	,			__UpperCamelCase:			str="gelu"	,			__UpperCamelCase:			Any=0.1	,			__UpperCamelCase:			int=0.1	,			__UpperCamelCase:			int=5_12	,			__UpperCamelCase:			Any=2	,			__UpperCamelCase:			Tuple=3	,			__UpperCamelCase:			Any=False	,			__UpperCamelCase:			Optional[int]=0.02	,			__UpperCamelCase:			List[Any]=1E-12	,			__UpperCamelCase:			Union[str, Any]=0	,			__UpperCamelCase:			Tuple="absolute"	,			__UpperCamelCase:			Union[str, Any]=True	,			__UpperCamelCase:			Optional[Any]=None	,			**__UpperCamelCase:			List[Any]	,			):

						'''simple docstring'''





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

						__magic_name__				=     vocab_size
						__magic_name__				=     hidden_size
						__magic_name__				=     num_hidden_layers
						__magic_name__				=     num_attention_heads
						__magic_name__				=     hidden_act
						__magic_name__				=     intermediate_size
						__magic_name__				=     hidden_dropout_prob
						__magic_name__				=     attention_probs_dropout_prob
						__magic_name__				=     max_position_embeddings
						__magic_name__				=     type_vocab_size
						__magic_name__				=     task_type_vocab_size
						__magic_name__				=     use_task_id
						__magic_name__				=     initializer_range
						__magic_name__				=     layer_norm_eps
						__magic_name__				=     position_embedding_type
						__magic_name__				=     use_cache
						__magic_name__				=     classifier_dropout




class 					__UpperCamelCase					(       SCREAMING_SNAKE_CASE      ):







	@property
	def 						_SCREAMING_SNAKE_CASE				( self:			Tuple   ):

						'''simple docstring'''





						if self.task == "multiple-choice":
											__magic_name__				=     {0: 'batch', 1: 'choice', 2: 'sequence'}
						else:
											__magic_name__				=     {0: 'batch', 1: 'sequence'}
						return OrderedDict(
						    [
						        ('input_ids', dynamic_axis),
						        ('attention_mask', dynamic_axis),
						        ('token_type_ids', dynamic_axis),
						        ('task_type_ids', dynamic_axis),
						    ]   )




