



from collections import OrderedDict
from dataclasses import fields
from typing import Any, Tuple

import numpy as np

from .import_utils import is_torch_available



def        __a     (    lowerCAmelCase_   :					Optional[int]				)      -> Any:






						'''simple docstring'''



						if is_torch_available():
												import torch

												if isinstance(lowerCAmelCase_			,torch.Tensor				):
																		return True

						return isinstance(lowerCAmelCase_			,np.ndarray				)






class 		lowercase						( snake_case__):






	"""simple docstring"""


	def   _SCREAMING_SNAKE_CASE		(	self	:						List[str]     )			-> str:
							UpperCAmelCase_=   fields(self     )

							# Safety and consistency checks
							if not len(__UpperCAmelCase     ):
													raise ValueError(F"""{self.__class__.__name__} has no fields."""     )

							UpperCAmelCase_=   getattr(self						,  class_fields[0].name     )
							UpperCAmelCase_=   all(getattr(self						,  field.name     ) is None for field in class_fields[1:]     )

							if other_fields_are_none and isinstance(__UpperCAmelCase						,  __UpperCAmelCase     ):
													for key, value in first_field.items():
																			UpperCAmelCase_=   value
							else:
													for field in class_fields:
																			UpperCAmelCase_=   getattr(self						,  field.name     )
																			if v is not None:
																									UpperCAmelCase_=   v




	def __delitem__(	self	:						List[str]						,  *__UpperCAmelCase	:						Any						,  **__UpperCAmelCase	:						Any     )			-> int:
							raise Exception(F"""You cannot use ``__delitem__`` on a {self.__class__.__name__} instance."""     )




	def   _SCREAMING_SNAKE_CASE		(	self	:						List[Any]						,  *__UpperCAmelCase	:						Dict						,  **__UpperCAmelCase	:						Optional[Any]     )			-> List[str]:
							raise Exception(F"""You cannot use ``setdefault`` on a {self.__class__.__name__} instance."""     )




	def   _SCREAMING_SNAKE_CASE		(	self	:						str						,  *__UpperCAmelCase	:						Tuple						,  **__UpperCAmelCase	:						Union[str, Any]     )			-> Any:
							raise Exception(F"""You cannot use ``pop`` on a {self.__class__.__name__} instance."""     )




	def   _SCREAMING_SNAKE_CASE		(	self	:						int						,  *__UpperCAmelCase	:						Optional[Any]						,  **__UpperCAmelCase	:						Optional[Any]     )			-> Tuple:
							raise Exception(F"""You cannot use ``update`` on a {self.__class__.__name__} instance."""     )




	def __getitem__(	self	:						int						,  __UpperCAmelCase	:						Any     )			-> Tuple:
							if isinstance(__UpperCAmelCase						,  __UpperCAmelCase     ):
													UpperCAmelCase_=   dict(self.items()     )
													return inner_dict[k]
							else:
													return self.to_tuple()[k]




	def __setattr__(	self	:						Tuple						,  __UpperCAmelCase	:						int						,  __UpperCAmelCase	:						List[Any]     )			-> List[str]:
							if name in self.keys() and value is not None:
													# Don't call self.__setitem__ to avoid recursion errors
													super().__setitem__(__UpperCAmelCase						,  __UpperCAmelCase     )
							super().__setattr__(__UpperCAmelCase						,  __UpperCAmelCase     )




	def __setitem__(	self	:						str						,  __UpperCAmelCase	:						Any						,  __UpperCAmelCase	:						Optional[Any]     )			-> List[str]:
							# Will raise a KeyException if needed
							super().__setitem__(__UpperCAmelCase						,  __UpperCAmelCase     )
							# Don't call self.__setattr__ to avoid recursion errors
							super().__setattr__(__UpperCAmelCase						,  __UpperCAmelCase     )




	def   _SCREAMING_SNAKE_CASE		(	self	:						Dict     )			-> Tuple[Any]:
							return tuple(self[k] for k in self.keys()     )









from typing import TYPE_CHECKING

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


__A				    =						{
    '''configuration_mpnet''': ['''MPNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MPNetConfig'''],
    '''tokenization_mpnet''': ['''MPNetTokenizer'''],
}

try:
	if not is_tokenizers_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__A				    =						['''MPNetTokenizerFast''']

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__A				    =						[
	    '''MPNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
	    '''MPNetForMaskedLM''',
	    '''MPNetForMultipleChoice''',
	    '''MPNetForQuestionAnswering''',
	    '''MPNetForSequenceClassification''',
	    '''MPNetForTokenClassification''',
	    '''MPNetLayer''',
	    '''MPNetModel''',
	    '''MPNetPreTrainedModel''',
	]

try:
	if not is_tf_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__A				    =						[
	    '''TF_MPNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
	    '''TFMPNetEmbeddings''',
	    '''TFMPNetForMaskedLM''',
	    '''TFMPNetForMultipleChoice''',
	    '''TFMPNetForQuestionAnswering''',
	    '''TFMPNetForSequenceClassification''',
	    '''TFMPNetForTokenClassification''',
	    '''TFMPNetMainLayer''',
	    '''TFMPNetModel''',
	    '''TFMPNetPreTrainedModel''',
	]


if TYPE_CHECKING:
	from .configuration_mpnet import MPNET_PRETRAINED_CONFIG_ARCHIVE_MAP, MPNetConfig
	from .tokenization_mpnet import MPNetTokenizer

	try:
		if not is_tokenizers_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .tokenization_mpnet_fast import MPNetTokenizerFast

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_mpnet import (
		    MPNET_PRETRAINED_MODEL_ARCHIVE_LIST,
		    MPNetForMaskedLM,
		    MPNetForMultipleChoice,
		    MPNetForQuestionAnswering,
		    MPNetForSequenceClassification,
		    MPNetForTokenClassification,
		    MPNetLayer,
		    MPNetModel,
		    MPNetPreTrainedModel,
		)

	try:
		if not is_tf_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_tf_mpnet import (
		    TF_MPNET_PRETRAINED_MODEL_ARCHIVE_LIST,
		    TFMPNetEmbeddings,
		    TFMPNetForMaskedLM,
		    TFMPNetForMultipleChoice,
		    TFMPNetForQuestionAnswering,
		    TFMPNetForSequenceClassification,
		    TFMPNetForTokenClassification,
		    TFMPNetMainLayer,
		    TFMPNetModel,
		    TFMPNetPreTrainedModel,
		)

else:
	import sys

	__A				    =						_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)




