





"""simple docstring"""




import os
import tempfile
import unittest

from transformers import NezhaConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device

from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
		import torch

		from transformers import (
		    MODEL_FOR_PRETRAINING_MAPPING,
		    NezhaForMaskedLM,
		    NezhaForMultipleChoice,
		    NezhaForNextSentencePrediction,
		    NezhaForPreTraining,
		    NezhaForQuestionAnswering,
		    NezhaForSequenceClassification,
		    NezhaForTokenClassification,
		    NezhaModel,
		)
		from transformers.models.nezha.modeling_nezha import NEZHA_PRETRAINED_MODEL_ARCHIVE_LIST


class        __UpperCamelCase				:






							def __init__(   self      ,					lowerCAmelCase__      ,					lowerCAmelCase__=13      ,					lowerCAmelCase__=7      ,					lowerCAmelCase__=True      ,					lowerCAmelCase__=True      ,					lowerCAmelCase__=True      ,					lowerCAmelCase__=True      ,					lowerCAmelCase__=99      ,					lowerCAmelCase__=32      ,					lowerCAmelCase__=5      ,					lowerCAmelCase__=4      ,					lowerCAmelCase__=37      ,					lowerCAmelCase__="gelu"      ,					lowerCAmelCase__=0.1      ,					lowerCAmelCase__=0.1      ,					lowerCAmelCase__=128      ,					lowerCAmelCase__=32      ,					lowerCAmelCase__=16      ,					lowerCAmelCase__=2      ,					lowerCAmelCase__=0.02      ,					lowerCAmelCase__=3      ,					lowerCAmelCase__=4      ,					lowerCAmelCase__=None      ,					)	-> List[Any]:
								a      :		List[str]	=				parent
								a      :		str	=				batch_size
								a      :		int	=				seq_length
								a      :		int	=				is_training
								a      :		str	=				use_input_mask
								a      :		Dict	=				use_token_type_ids
								a      :		List[str]	=				use_labels
								a      :		int	=				vocab_size
								a      :		Any	=				hidden_size
								a      :		List[Any]	=				num_hidden_layers
								a      :		Optional[int]	=				num_attention_heads
								a      :		Union[str, Any]	=				intermediate_size
								a      :		Optional[Any]	=				hidden_act
								a      :		Any	=				hidden_dropout_prob
								a      :		Any	=				attention_probs_dropout_prob
								a      :		Optional[int]	=				max_position_embeddings
								a      :		str	=				type_vocab_size
								a      :		int	=				type_sequence_label_size
								a      :		Any	=				initializer_range
								a      :		Optional[int]	=				num_labels
								a      :		Optional[int]	=				num_choices
								a      :		str	=				scope






							def     __a   (   self      )	-> Tuple:
								a      :		List[str]	=				ids_tensor([self.batch_size, self.seq_length]      ,					self.vocab_size      )

								a      :		Dict	=				None
								if self.use_input_mask:
									a      :		str	=				random_attention_mask([self.batch_size, self.seq_length]      )

								a      :		str	=				None
								if self.use_token_type_ids:
									a      :		Union[str, Any]	=				ids_tensor([self.batch_size, self.seq_length]      ,					self.type_vocab_size      )

								a      :		int	=				None
								a      :		Dict	=				None
								a      :		Tuple	=				None
								if self.use_labels:
									a      :		str	=				ids_tensor([self.batch_size]      ,					self.type_sequence_label_size      )
									a      :		Dict	=				ids_tensor([self.batch_size, self.seq_length]      ,					self.num_labels      )
									a      :		str	=				ids_tensor([self.batch_size]      ,					self.num_choices      )

								a      :		Union[str, Any]	=				self.get_config()

								return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels






							def     __a   (   self      )	-> List[Any]:
								return NezhaConfig(
								    vocab_size=self.vocab_size      ,					hidden_size=self.hidden_size      ,					num_hidden_layers=self.num_hidden_layers      ,					num_attention_heads=self.num_attention_heads      ,					intermediate_size=self.intermediate_size      ,					hidden_act=self.hidden_act      ,					hidden_dropout_prob=self.hidden_dropout_prob      ,					attention_probs_dropout_prob=self.attention_probs_dropout_prob      ,					max_position_embeddings=self.max_position_embeddings      ,					type_vocab_size=self.type_vocab_size      ,					is_decoder=lowerCAmelCase__      ,					initializer_range=self.initializer_range      ,					)






							def     __a   (   self      )	-> int:
								(
								    (
								    a
								),       (
								    a
								),       (
								    a
								),       (
								    a
								),       (
								    a
								),       (
								    a
								),       (
								    a
								),       
								)      :		Union[str, Any]	=				self.prepare_config_and_inputs()

								a      :		Optional[Any]	=				True
								a      :		List[Any]	=				floats_tensor([self.batch_size, self.seq_length, self.hidden_size]      )
								a      :		Optional[Any]	=				ids_tensor([self.batch_size, self.seq_length]      ,					vocab_size=2      )

								return (
								    config,
								    input_ids,
								    token_type_ids,
								    input_mask,
								    sequence_labels,
								    token_labels,
								    choice_labels,
								    encoder_hidden_states,
								    encoder_attention_mask,
								)






							def     __a   (   self      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      )	-> str:
								a      :		Tuple	=				NezhaModel(config=lowerCAmelCase__      )
								model.to(lowerCAmelCase__      )
								model.eval()
								a      :		int	=				model(lowerCAmelCase__      ,					attention_mask=lowerCAmelCase__      ,					token_type_ids=lowerCAmelCase__      )
								a      :		Union[str, Any]	=				model(lowerCAmelCase__      ,					token_type_ids=lowerCAmelCase__      )
								a      :		Optional[Any]	=				model(lowerCAmelCase__      )
								self.parent.assertEqual(result.last_hidden_state.shape      ,					(self.batch_size, self.seq_length, self.hidden_size)      )
								self.parent.assertEqual(result.pooler_output.shape      ,					(self.batch_size, self.hidden_size)      )






							def     __a   (   self      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					)	-> Any:
								a      :		Tuple	=				True
								a      :		int	=				NezhaModel(lowerCAmelCase__      )
								model.to(lowerCAmelCase__      )
								model.eval()
								a      :		Dict	=				model(
								    lowerCAmelCase__      ,					attention_mask=lowerCAmelCase__      ,					token_type_ids=lowerCAmelCase__      ,					encoder_hidden_states=lowerCAmelCase__      ,					encoder_attention_mask=lowerCAmelCase__      ,					)
								a      :		List[str]	=				model(
								    lowerCAmelCase__      ,					attention_mask=lowerCAmelCase__      ,					token_type_ids=lowerCAmelCase__      ,					encoder_hidden_states=lowerCAmelCase__      ,					)
								a      :		Any	=				model(lowerCAmelCase__      ,					attention_mask=lowerCAmelCase__      ,					token_type_ids=lowerCAmelCase__      )
								self.parent.assertEqual(result.last_hidden_state.shape      ,					(self.batch_size, self.seq_length, self.hidden_size)      )
								self.parent.assertEqual(result.pooler_output.shape      ,					(self.batch_size, self.hidden_size)      )






							def     __a   (   self      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      )	-> Tuple:
								a      :		Dict	=				NezhaForMaskedLM(config=lowerCAmelCase__      )
								model.to(lowerCAmelCase__      )
								model.eval()
								a      :		int	=				model(lowerCAmelCase__      ,					attention_mask=lowerCAmelCase__      ,					token_type_ids=lowerCAmelCase__      ,					labels=lowerCAmelCase__      )
								self.parent.assertEqual(result.logits.shape      ,					(self.batch_size, self.seq_length, self.vocab_size)      )






							def     __a   (   self      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      )	-> Optional[Any]:
								a      :		Union[str, Any]	=				NezhaForNextSentencePrediction(config=lowerCAmelCase__      )
								model.to(lowerCAmelCase__      )
								model.eval()
								a      :		Union[str, Any]	=				model(
								    lowerCAmelCase__      ,					attention_mask=lowerCAmelCase__      ,					token_type_ids=lowerCAmelCase__      ,					labels=lowerCAmelCase__      ,					)
								self.parent.assertEqual(result.logits.shape      ,					(self.batch_size, 2)      )






							def     __a   (   self      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      )	-> Tuple:
								a      :		int	=				NezhaForPreTraining(config=lowerCAmelCase__      )
								model.to(lowerCAmelCase__      )
								model.eval()
								a      :		Dict	=				model(
								    lowerCAmelCase__      ,					attention_mask=lowerCAmelCase__      ,					token_type_ids=lowerCAmelCase__      ,					labels=lowerCAmelCase__      ,					next_sentence_label=lowerCAmelCase__      ,					)
								self.parent.assertEqual(result.prediction_logits.shape      ,					(self.batch_size, self.seq_length, self.vocab_size)      )
								self.parent.assertEqual(result.seq_relationship_logits.shape      ,					(self.batch_size, 2)      )






							def     __a   (   self      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      )	-> Union[str, Any]:
								a      :		Optional[Any]	=				NezhaForQuestionAnswering(config=lowerCAmelCase__      )
								model.to(lowerCAmelCase__      )
								model.eval()
								a      :		Any	=				model(
								    lowerCAmelCase__      ,					attention_mask=lowerCAmelCase__      ,					token_type_ids=lowerCAmelCase__      ,					start_positions=lowerCAmelCase__      ,					end_positions=lowerCAmelCase__      ,					)
								self.parent.assertEqual(result.start_logits.shape      ,					(self.batch_size, self.seq_length)      )
								self.parent.assertEqual(result.end_logits.shape      ,					(self.batch_size, self.seq_length)      )






							def     __a   (   self      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      )	-> Optional[Any]:
								a      :		str	=				self.num_labels
								a      :		List[Any]	=				NezhaForSequenceClassification(lowerCAmelCase__      )
								model.to(lowerCAmelCase__      )
								model.eval()
								a      :		List[str]	=				model(lowerCAmelCase__      ,					attention_mask=lowerCAmelCase__      ,					token_type_ids=lowerCAmelCase__      ,					labels=lowerCAmelCase__      )
								self.parent.assertEqual(result.logits.shape      ,					(self.batch_size, self.num_labels)      )






							def     __a   (   self      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      )	-> str:
								a      :		int	=				self.num_labels
								a      :		Union[str, Any]	=				NezhaForTokenClassification(config=lowerCAmelCase__      )
								model.to(lowerCAmelCase__      )
								model.eval()
								a      :		Tuple	=				model(lowerCAmelCase__      ,					attention_mask=lowerCAmelCase__      ,					token_type_ids=lowerCAmelCase__      ,					labels=lowerCAmelCase__      )
								self.parent.assertEqual(result.logits.shape      ,					(self.batch_size, self.seq_length, self.num_labels)      )






							def     __a   (   self      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      )	-> Dict:
								a      :		Optional[int]	=				self.num_choices
								a      :		List[str]	=				NezhaForMultipleChoice(config=lowerCAmelCase__      )
								model.to(lowerCAmelCase__      )
								model.eval()
								a      :		Tuple	=				input_ids.unsqueeze(1      ).expand(-1      ,					self.num_choices      ,					-1      ).contiguous()
								a      :		Dict	=				token_type_ids.unsqueeze(1      ).expand(-1      ,					self.num_choices      ,					-1      ).contiguous()
								a      :		Dict	=				input_mask.unsqueeze(1      ).expand(-1      ,					self.num_choices      ,					-1      ).contiguous()
								a      :		Optional[int]	=				model(
								    lowerCAmelCase__      ,					attention_mask=lowerCAmelCase__      ,					token_type_ids=lowerCAmelCase__      ,					labels=lowerCAmelCase__      ,					)
								self.parent.assertEqual(result.logits.shape      ,					(self.batch_size, self.num_choices)      )






							def     __a   (   self      )	-> List[str]:
								a      :		str	=				self.prepare_config_and_inputs()
								(
								    (
								    a
								),       (
								    a
								),       (
								    a
								),       (
								    a
								),       (
								    a
								),       (
								    a
								),       (
								    a
								),       
								)      :		Optional[Any]	=				config_and_inputs
								a      :		Any	=				{"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
								return config, inputs_dict


@require_torch
class        __UpperCamelCase				(						a__		,       a__		,       a__		,       unittest.TestCase						):
							lowerCamelCase   :					str      					=(
							    (
							        NezhaModel,
							        NezhaForMaskedLM,
							        NezhaForMultipleChoice,
							        NezhaForNextSentencePrediction,
							        NezhaForPreTraining,
							        NezhaForQuestionAnswering,
							        NezhaForSequenceClassification,
							        NezhaForTokenClassification,
							    )
							    if is_torch_available()
							    else ()
							)
							lowerCamelCase   :					Union[str, Any]      					=(
							    {
							        """feature-extraction""": NezhaModel,
							        """fill-mask""": NezhaForMaskedLM,
							        """question-answering""": NezhaForQuestionAnswering,
							        """text-classification""": NezhaForSequenceClassification,
							        """token-classification""": NezhaForTokenClassification,
							        """zero-shot""": NezhaForSequenceClassification,
							    }
							    if is_torch_available()
							    else {}
							)
							lowerCamelCase   :					Optional[int]      					=True






							def     __a   (   self      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__=False      )	-> List[str]:
								a      :		str	=				super()._prepare_for_class(lowerCAmelCase__      ,					lowerCAmelCase__      ,					return_labels=lowerCAmelCase__      )

								if return_labels:
									if model_class in get_values(lowerCAmelCase__      ):
										a      :		Optional[int]	=				torch.zeros(
										    (self.model_tester.batch_size, self.model_tester.seq_length)      ,					dtype=torch.long      ,					device=lowerCAmelCase__      )
										a      :		Union[str, Any]	=				torch.zeros(
										    self.model_tester.batch_size      ,					dtype=torch.long      ,					device=lowerCAmelCase__      )
								return inputs_dict






							def     __a   (   self      )	-> Tuple:
								a      :		Tuple	=				NezhaModelTester(self      )
								a      :		Union[str, Any]	=				ConfigTester(self      ,					config_class=lowerCAmelCase__      ,					hidden_size=37      )






							def     __a   (   self      )	-> Optional[Any]:
								self.config_tester.run_common_tests()






							def     __a   (   self      )	-> List[str]:
								a      :		Any	=				self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_model(*lowerCAmelCase__      )






							def     __a   (   self      )	-> Optional[int]:
								a      :		str	=				self.model_tester.prepare_config_and_inputs_for_decoder()
								self.model_tester.create_and_check_model_as_decoder(*lowerCAmelCase__      )






							def     __a   (   self      )	-> str:
								# This regression test was failing with PyTorch < 1.3
								(
								    (
								    a
								),       (
								    a
								),       (
								    a
								),       (
								    a
								),       (
								    a
								),       (
								    a
								),       (
								    a
								),       (
								    a
								),       (
								    a
								),       
								)      :		Union[str, Any]	=				self.model_tester.prepare_config_and_inputs_for_decoder()

								a      :		Any	=				None

								self.model_tester.create_and_check_model_as_decoder(
								    lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					lowerCAmelCase__      ,					)






							def     __a   (   self      )	-> Dict:
								a      :		List[Any]	=				self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_masked_lm(*lowerCAmelCase__      )






							def     __a   (   self      )	-> Tuple:
								a      :		Tuple	=				self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_multiple_choice(*lowerCAmelCase__      )






							def     __a   (   self      )	-> Any:
								a      :		List[str]	=				self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_next_sequence_prediction(*lowerCAmelCase__      )






							def     __a   (   self      )	-> Union[str, Any]:
								a      :		Tuple	=				self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_pretraining(*lowerCAmelCase__      )






							def     __a   (   self      )	-> Optional[int]:
								a      :		Optional[Any]	=				self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_question_answering(*lowerCAmelCase__      )






							def     __a   (   self      )	-> Tuple:
								a      :		int	=				self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_sequence_classification(*lowerCAmelCase__      )






							def     __a   (   self      )	-> Union[str, Any]:
								a      :		Union[str, Any]	=				self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_token_classification(*lowerCAmelCase__      )






							@slow
							def     __a   (   self      )	-> List[str]:
								for model_name in NEZHA_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									a      :		Any	=				NezhaModel.from_pretrained(lowerCAmelCase__      )
									self.assertIsNotNone(lowerCAmelCase__      )






							@slow
							@require_torch_gpu
							def     __a   (   self      )	-> Optional[Any]:
								a,       a      :		str	=				self.model_tester.prepare_config_and_inputs_for_common()
								for model_class in self.all_model_classes:
									# NezhaForMultipleChoice behaves incorrectly in JIT environments.
									if model_class == NezhaForMultipleChoice:
										return

									a      :		List[Any]	=				True
									a      :		int	=				model_class(config=lowerCAmelCase__      )

									a      :		Dict	=				self._prepare_for_class(lowerCAmelCase__      ,					lowerCAmelCase__      )
									a      :		Tuple	=				torch.jit.trace(
									    lowerCAmelCase__      ,					(inputs_dict["input_ids"].to("cpu"      ), inputs_dict["attention_mask"].to("cpu"      ))      )

									with tempfile.TemporaryDirectory() as tmp:
										torch.jit.save(lowerCAmelCase__      ,					os.path.join(lowerCAmelCase__      ,					"bert.pt"      )      )
										a      :		Dict	=				torch.jit.load(os.path.join(lowerCAmelCase__      ,					"bert.pt"      )      ,					map_location=lowerCAmelCase__      )
										loaded(inputs_dict["input_ids"].to(lowerCAmelCase__      )      ,					inputs_dict["attention_mask"].to(lowerCAmelCase__      )      )


@require_torch
class        __UpperCamelCase				(						unittest.TestCase						):






							@slow
							def     __a   (   self      )	-> int:
								a      :		int	=				NezhaModel.from_pretrained("sijunhe/nezha-cn-base"      )
								a      :		str	=				torch.tensor([[0, 1, 2, 3, 4, 5]]      )
								a      :		Tuple	=				torch.tensor([[0, 1, 1, 1, 1, 1]]      )
								with torch.no_grad():
									a      :		Dict	=				model(lowerCAmelCase__      ,					attention_mask=lowerCAmelCase__      )[0]
								a      :		Optional[int]	=				torch.Size((1, 6, 768)      )
								self.assertEqual(output.shape      ,					lowerCAmelCase__      )
								a      :		str	=				torch.tensor([[[0.0_685, 0.2_441, 0.1_102], [0.0_600, 0.1_906, 0.1_349], [0.0_221, 0.0_819, 0.0_586]]]      )

								self.assertTrue(torch.allclose(output[:, 1:4, 1:4]      ,					lowerCAmelCase__      ,					atol=1E-4      )      )






							@slow
							def     __a   (   self      )	-> List[Any]:
								a      :		Optional[int]	=				NezhaForMaskedLM.from_pretrained("sijunhe/nezha-cn-base"      )
								a      :		Optional[int]	=				torch.tensor([[0, 1, 2, 3, 4, 5]]      )
								a      :		int	=				torch.tensor([[1, 1, 1, 1, 1, 1]]      )
								with torch.no_grad():
									a      :		Optional[Any]	=				model(lowerCAmelCase__      ,					attention_mask=lowerCAmelCase__      )[0]
								a      :		Union[str, Any]	=				torch.Size((1, 6, 2_1128)      )
								self.assertEqual(output.shape      ,					lowerCAmelCase__      )
								a      :		Tuple	=				torch.tensor(
								    [[-2.7_939, -1.7_902, -2.2_189], [-2.8_585, -1.8_908, -2.3_723], [-2.6_499, -1.7_750, -2.2_558]]      )

								self.assertTrue(torch.allclose(output[:, 1:4, 1:4]      ,					lowerCAmelCase__      ,					atol=1E-4      )      )









from typing import TYPE_CHECKING

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


UpperCAmelCase_     							= {
    'configuration_convbert': ['CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ConvBertConfig', 'ConvBertOnnxConfig'],
    'tokenization_convbert': ['ConvBertTokenizer'],
}

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

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase_     							= [
      'CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
      'ConvBertForMaskedLM',
      'ConvBertForMultipleChoice',
      'ConvBertForQuestionAnswering',
      'ConvBertForSequenceClassification',
      'ConvBertForTokenClassification',
      'ConvBertLayer',
      'ConvBertModel',
      'ConvBertPreTrainedModel',
      'load_tf_weights_in_convbert',
  ]


try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase_     							= [
      'TF_CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
      'TFConvBertForMaskedLM',
      'TFConvBertForMultipleChoice',
      'TFConvBertForQuestionAnswering',
      'TFConvBertForSequenceClassification',
      'TFConvBertForTokenClassification',
      'TFConvBertLayer',
      'TFConvBertModel',
      'TFConvBertPreTrainedModel',
  ]


if TYPE_CHECKING:
  from .configuration_convbert import CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, ConvBertConfig, ConvBertOnnxConfig
  from .tokenization_convbert import ConvBertTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_convbert_fast import ConvBertTokenizerFast

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_convbert import (
        CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
        ConvBertForMaskedLM,
        ConvBertForMultipleChoice,
        ConvBertForQuestionAnswering,
        ConvBertForSequenceClassification,
        ConvBertForTokenClassification,
        ConvBertLayer,
        ConvBertModel,
        ConvBertPreTrainedModel,
        load_tf_weights_in_convbert,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_convbert import (
        TF_CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFConvBertForMaskedLM,
        TFConvBertForMultipleChoice,
        TFConvBertForQuestionAnswering,
        TFConvBertForSequenceClassification,
        TFConvBertForTokenClassification,
        TFConvBertLayer,
        TFConvBertModel,
        TFConvBertPreTrainedModel,
    )


else:
  import sys

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

