code: 
  
  import unittest
  
  import numpy as np
  from datasets import load_dataset
  
  from transformers.testing_utils import require_torch, require_vision
  from transformers.utils import is_torch_available, is_vision_available
  
  from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs
  
  
  if is_torch_available():
         import torch
  
  if is_vision_available():
         from PIL import Image
  
         from transformers import SegformerImageProcessor
  class 					A_   (      unittest.TestCase						):
  
  
      '''simple docstring'''
  
  
  
  
  
  
      def __init__(self     ,      lowercase__     ,      lowercase__=7     ,      lowercase__=3     ,      lowercase__=30     ,      lowercase__=400     ,      lowercase__=True     ,      lowercase__=None     ,      lowercase__=True     ,      lowercase__=[0.5, 0.5, 0.5]     ,      lowercase__=[0.5, 0.5, 0.5]     ,      lowercase__=False     ,      )     ->      Optional[int]:
          __UpperCAmelCase									=			size if size is not None else {"height": 30, "width": 30}
          __UpperCAmelCase									=			parent
          __UpperCAmelCase									=			batch_size
          __UpperCAmelCase									=			num_channels
          __UpperCAmelCase									=			min_resolution
          __UpperCAmelCase									=			max_resolution
          __UpperCAmelCase									=			do_resize
          __UpperCAmelCase									=			size
          __UpperCAmelCase									=			do_normalize
          __UpperCAmelCase									=			image_mean
          __UpperCAmelCase									=			image_std
          __UpperCAmelCase									=			do_reduce_labels
  
  
  
  
  
  
      def      lowerCAmelCase_						(self  )     ->      int:
          return {
              "do_resize": self.do_resize,
              "size": self.size,
              "do_normalize": self.do_normalize,
              "image_mean": self.image_mean,
              "image_std": self.image_std,
              "do_reduce_labels": self.do_reduce_labels,
          }
  
  
  
  
  
  
  def       __a       (   )      ->     Optional[int]:
  
  
  
  
  
  
      '''simple docstring'''
      __UpperCAmelCase									=			load_dataset('''hf-internal-testing/fixtures_ade20k'''       ,   split='''test'''      )
  
      __UpperCAmelCase									=			Image.open(dataset[0]['''file''']      )
      __UpperCAmelCase									=			Image.open(dataset[1]['''file''']      )
  
      return image, map
  
  
  def       __a       (   )      ->     Optional[Any]:
  
  
  
  
  
  
      '''simple docstring'''
      __UpperCAmelCase									=			load_dataset('''hf-internal-testing/fixtures_ade20k'''       ,   split='''test'''      )
  
      __UpperCAmelCase									=			Image.open(dataset[0]['''file''']      )
      __UpperCAmelCase									=			Image.open(dataset[1]['''file''']      )
      __UpperCAmelCase									=			Image.open(dataset[2]['''file''']      )
      __UpperCAmelCase									=			Image.open(dataset[3]['''file''']      )
  
      return [imagea, imagea], [mapa, mapa]
  @require_torch
  @require_vision
  class 					A_   (      _a ,     unittest.TestCase						):
  
  
      '''simple docstring'''
  
  
  
  
  
  
      a__     							=       SegformerImageProcessor if is_vision_available() else None
  
  
      def      lowerCAmelCase_						(self  )     ->      Optional[int]:
          __UpperCAmelCase									=			SegformerImageProcessingTester(self  )
  
  
      @property
      def      lowerCAmelCase_						(self  )     ->      Union[str, Any]:
          return self.image_processor_tester.prepare_image_processor_dict()
  
  
      def      lowerCAmelCase_						(self  )     ->      Tuple:
          __UpperCAmelCase									=			self.image_processing_class(**self.image_processor_dict  )
          self.assertTrue(hasattr(lowerCamelCase__     ,      '''do_resize'''  )  )
          self.assertTrue(hasattr(lowerCamelCase__     ,      '''size'''  )  )
          self.assertTrue(hasattr(lowerCamelCase__     ,      '''do_normalize'''  )  )
          self.assertTrue(hasattr(lowerCamelCase__     ,      '''image_mean'''  )  )
          self.assertTrue(hasattr(lowerCamelCase__     ,      '''image_std'''  )  )
          self.assertTrue(hasattr(lowerCamelCase__     ,      '''do_reduce_labels'''  )  )
  
  
      def      lowerCAmelCase_						(self  )     ->      List[Any]:
          __UpperCAmelCase									=			self.image_processing_class.from_dict(self.image_processor_dict  )
          self.assertEqual(image_processor.size     ,      {'''height''': 30, '''width''': 30}  )
          self.assertEqual(image_processor.do_reduce_labels     ,      lowerCamelCase__  )
  
          __UpperCAmelCase									=			self.image_processing_class.from_dict(self.image_processor_dict     ,      size=42     ,      reduce_labels=lowerCamelCase__  )
          self.assertEqual(image_processor.size     ,      {'''height''': 42, '''width''': 42}  )
          self.assertEqual(image_processor.do_reduce_labels     ,      lowerCamelCase__  )
  
  
      def      lowerCAmelCase_						(self  )     ->      Tuple:
          pass
  
  
      def      lowerCAmelCase_						(self  )     ->      Any:
          # Initialize image_processing
          __UpperCAmelCase									=			self.image_processing_class(**self.image_processor_dict  )
          # create random PIL images
          __UpperCAmelCase									=			prepare_image_inputs(self.image_processor_tester     ,      equal_resolution=lowerCamelCase__  )
          for image in image_inputs:
              self.assertIsInstance(lowerCamelCase__     ,      Image.Image  )
  
          # Test not batched input
          __UpperCAmelCase									=			image_processing(image_inputs[0]     ,      return_tensors='''pt'''  ).pixel_values
          self.assertEqual(
              encoded_images.shape     ,      (
                  1,
                  self.image_processor_tester.num_channels,
                  self.image_processor_tester.size['''height'''],
                  self.image_processor_tester.size['''width'''],
              )     ,      )
  
          # Test batched
          __UpperCAmelCase									=			image_processing(lowerCamelCase__     ,      return_tensors='''pt'''  ).pixel_values
          self.assertEqual(
              encoded_images.shape     ,      (
                  self.image_processor_tester.batch_size,
                  self.image_processor_tester.num_channels,
                  self.image_processor_tester.size['''height'''],
                  self.image_processor_tester.size['''width'''],
              )     ,      )
  
  
      def      lowerCAmelCase_						(self  )     ->      Optional[int]:
          # Initialize image_processing
          __UpperCAmelCase									=			self.image_processing_class(**self.image_processor_dict  )
          # create random numpy tensors
          __UpperCAmelCase									=			prepare_image_inputs(self.image_processor_tester     ,      equal_resolution=lowerCamelCase__     ,      numpify=lowerCamelCase__  )
          for image in image_inputs:
              self.assertIsInstance(lowerCamelCase__     ,      np.ndarray  )
  
          # Test not batched input
          __UpperCAmelCase									=			image_processing(image_inputs[0]     ,      return_tensors='''pt'''  ).pixel_values
          self.assertEqual(
              encoded_images.shape     ,      (
                  1,
                  self.image_processor_tester.num_channels,
                  self.image_processor_tester.size['''height'''],
                  self.image_processor_tester.size['''width'''],
              )     ,      )
  
          # Test batched
          __UpperCAmelCase									=			image_processing(lowerCamelCase__     ,      return_tensors='''pt'''  ).pixel_values
          self.assertEqual(
              encoded_images.shape     ,      (
                  self.image_processor_tester.batch_size,
                  self.image_processor_tester.num_channels,
                  self.image_processor_tester.size['''height'''],
                  self.image_processor_tester.size['''width'''],
              )     ,      )
  
  
      def      lowerCAmelCase_						(self  )     ->      str:
          # Initialize image_processing
          __UpperCAmelCase									=			self.image_processing_class(**self.image_processor_dict  )
          # create random PyTorch tensors
          __UpperCAmelCase									=			prepare_image_inputs(self.image_processor_tester     ,      equal_resolution=lowerCamelCase__     ,      torchify=lowerCamelCase__  )
          for image in image_inputs:
              self.assertIsInstance(lowerCamelCase__     ,      torch.Tensor  )
  
          # Test not batched input
          __UpperCAmelCase									=			image_processing(image_inputs[0]     ,      return_tensors='''pt'''  ).pixel_values
          self.assertEqual(
              encoded_images.shape     ,      (
                  1,
                  self.image_processor_tester.num_channels,
                  self.image_processor_tester.size['''height'''],
                  self.image_processor_tester.size['''width'''],
              )     ,      )
  
          # Test batched
          __UpperCAmelCase									=			image_processing(lowerCamelCase__     ,      return_tensors='''pt'''  ).pixel_values
          self.assertEqual(
              encoded_images.shape     ,      (
                  self.image_processor_tester.batch_size,
                  self.image_processor_tester.num_channels,
                  self.image_processor_tester.size['''height'''],
                  self.image_processor_tester.size['''width'''],
              )     ,      )
  
  
      def      lowerCAmelCase_						(self  )     ->      Optional[int]:
          # Initialize image_processing
          __UpperCAmelCase									=			self.image_processing_class(**self.image_processor_dict  )
          # create random PyTorch tensors
          __UpperCAmelCase									=			prepare_image_inputs(self.image_processor_tester     ,      equal_resolution=lowerCamelCase__     ,      torchify=lowerCamelCase__  )
          __UpperCAmelCase									=			[]
          for image in image_inputs:
              self.assertIsInstance(lowerCamelCase__     ,      torch.Tensor  )
              maps.append(torch.zeros(image.shape[-2:]  ).long()  )
  
          # Test not batched input
          __UpperCAmelCase									=			image_processing(image_inputs[0]     ,      maps[0]     ,      return_tensors='''pt'''  )
          self.assertEqual(
              encoding['''pixel_values'''].shape     ,      (
                  1,
                  self.image_processor_tester.num_channels,
                  self.image_processor_tester.size['''height'''],
                  self.image_processor_tester.size['''width'''],
              )     ,      )
          self.assertEqual(
              encoding['''labels'''].shape     ,      (
                  1,
                  self.image_processor_tester.size['''height'''],
                  self.image_processor_tester.size['''width'''],
              )     ,      )
          self.assertEqual(encoding['''labels'''].dtype     ,      torch.long  )
          self.assertTrue(encoding['''labels'''].min().item() >= 0  )
          self.assertTrue(encoding['''labels'''].max().item() <= 255  )
  
          # Test batched
          __UpperCAmelCase									=			image_processing(lowerCamelCase__     ,      lowerCamelCase__     ,      return_tensors='''pt'''  )
          self.assertEqual(
              encoding['''pixel_values'''].shape     ,      (
                  self.image_processor_tester.batch_size,
                  self.image_processor_tester.num_channels,
                  self.image_processor_tester.size['''height'''],
                  self.image_processor_tester.size['''width'''],
              )     ,      )
          self.assertEqual(
              encoding['''labels'''].shape     ,      (
                  self.image_processor_tester.batch_size,
                  self.image_processor_tester.size['''height'''],
                  self.image_processor_tester.size['''width'''],
              )     ,      )
          self.assertEqual(encoding['''labels'''].dtype     ,      torch.long  )
          self.assertTrue(encoding['''labels'''].min().item() >= 0  )
          self.assertTrue(encoding['''labels'''].max().item() <= 255  )
  
          # Test not batched input (PIL images)
          __UpperCAmelCase									=			prepare_semantic_single_inputs()
  
          __UpperCAmelCase									=			image_processing(lowerCamelCase__     ,      lowerCamelCase__     ,      return_tensors='''pt'''  )
          self.assertEqual(
              encoding['''pixel_values'''].shape     ,      (
                  1,
                  self.image_processor_tester.num_channels,
                  self.image_processor_tester.size['''height'''],
                  self.image_processor_tester.size['''width'''],
              )     ,      )
          self.assertEqual(
              encoding['''labels'''].shape     ,      (
                  1,
                  self.image_processor_tester.size['''height'''],
                  self.image_processor_tester.size['''width'''],
              )     ,      )
          self.assertEqual(encoding['''labels'''].dtype     ,      torch.long  )
          self.assertTrue(encoding['''labels'''].min().item() >= 0  )
          self.assertTrue(encoding['''labels'''].max().item() <= 255  )
  
          # Test batched input (PIL images)
          __UpperCAmelCase									=			prepare_semantic_batch_inputs()
  
          __UpperCAmelCase									=			image_processing(lowerCamelCase__     ,      lowerCamelCase__     ,      return_tensors='''pt'''  )
          self.assertEqual(
              encoding['''pixel_values'''].shape     ,      (
                  2,
                  self.image_processor_tester.num_channels,
                  self.image_processor_tester.size['''height'''],
                  self.image_processor_tester.size['''width'''],
              )     ,      )
          self.assertEqual(
              encoding['''labels'''].shape     ,      (
                  2,
                  self.image_processor_tester.size['''height'''],
                  self.image_processor_tester.size['''width'''],
              )     ,      )
          self.assertEqual(encoding['''labels'''].dtype     ,      torch.long  )
          self.assertTrue(encoding['''labels'''].min().item() >= 0  )
          self.assertTrue(encoding['''labels'''].max().item() <= 255  )
  
  
  
  
  
  
      def      lowerCAmelCase_						(self  )     ->      Union[str, Any]:
          # Initialize image_processing
          __UpperCAmelCase									=			self.image_processing_class(**self.image_processor_dict  )
  
          # ADE20k has 150 classes, and the background is included, so labels should be between 0 and 150
          __UpperCAmelCase									=			prepare_semantic_single_inputs()
          __UpperCAmelCase									=			image_processing(lowerCamelCase__     ,      lowerCamelCase__     ,      return_tensors='''pt'''  )
          self.assertTrue(encoding['''labels'''].min().item() >= 0  )
          self.assertTrue(encoding['''labels'''].max().item() <= 150  )
  
          __UpperCAmelCase									=			True
          __UpperCAmelCase									=			image_processing(lowerCamelCase__     ,      lowerCamelCase__     ,      return_tensors='''pt'''  )
          self.assertTrue(encoding['''labels'''].min().item() >= 0  )
          self.assertTrue(encoding['''labels'''].max().item() <= 255  )
  
  
  
  
  
  
style_context: 
  
  from __future__ import annotations
  
  import unittest
  
  from transformers import MPNetConfig, is_tf_available
  from transformers.testing_utils import require_tf, slow
  
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
  from ...test_pipeline_mixin import PipelineTesterMixin
  
  
  if is_tf_available():
         import tensorflow as tf
  
         from transformers.models.mpnet.modeling_tf_mpnet import (
             TFMPNetForMaskedLM,
             TFMPNetForMultipleChoice,
             TFMPNetForQuestionAnswering,
             TFMPNetForSequenceClassification,
             TFMPNetForTokenClassification,
             TFMPNetModel,
         )
  class 					A_   :
  
  
      '''simple docstring'''
  
  
  
  
  
  
      def __init__(self     ,      lowercase__     ,      lowercase__=13     ,      lowercase__=7     ,      lowercase__=True     ,      lowercase__=True     ,      lowercase__=False     ,      lowercase__=True     ,      lowercase__=99     ,      lowercase__=64     ,      lowercase__=2     ,      lowercase__=4     ,      lowercase__=64     ,      lowercase__="gelu"     ,      lowercase__=0.1     ,      lowercase__=0.1     ,      lowercase__=512     ,      lowercase__=16     ,      lowercase__=2     ,      lowercase__=0.02     ,      lowercase__=3     ,      lowercase__=4     ,      lowercase__=None     ,      )     ->      Tuple:
          __UpperCAmelCase									=			parent
          __UpperCAmelCase									=			batch_size
          __UpperCAmelCase									=			seq_length
          __UpperCAmelCase									=			is_training
          __UpperCAmelCase									=			use_input_mask
          __UpperCAmelCase									=			use_token_type_ids
          __UpperCAmelCase									=			use_labels
          __UpperCAmelCase									=			vocab_size
          __UpperCAmelCase									=			hidden_size
          __UpperCAmelCase									=			num_hidden_layers
          __UpperCAmelCase									=			num_attention_heads
          __UpperCAmelCase									=			intermediate_size
          __UpperCAmelCase									=			hidden_act
          __UpperCAmelCase									=			hidden_dropout_prob
          __UpperCAmelCase									=			attention_probs_dropout_prob
          __UpperCAmelCase									=			max_position_embeddings
          __UpperCAmelCase									=			type_vocab_size
          __UpperCAmelCase									=			type_sequence_label_size
          __UpperCAmelCase									=			initializer_range
          __UpperCAmelCase									=			num_labels
          __UpperCAmelCase									=			num_choices
          __UpperCAmelCase									=			scope
  
  
      def      lowerCAmelCase_						(self  )     ->      str:
          __UpperCAmelCase									=			ids_tensor([self.batch_size, self.seq_length]     ,      self.vocab_size  )
  
          __UpperCAmelCase									=			None
          if self.use_input_mask:
              __UpperCAmelCase									=			random_attention_mask([self.batch_size, self.seq_length]  )
  
          __UpperCAmelCase									=			None
          __UpperCAmelCase									=			None
          __UpperCAmelCase									=			None
          if self.use_labels:
              __UpperCAmelCase									=			ids_tensor([self.batch_size]     ,      self.type_sequence_label_size  )
              __UpperCAmelCase									=			ids_tensor([self.batch_size, self.seq_length]     ,      self.num_labels  )
              __UpperCAmelCase									=			ids_tensor([self.batch_size]     ,      self.num_choices  )
  
          __UpperCAmelCase									=			MPNetConfig(
              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     ,      initializer_range=self.initializer_range     ,      )
          return config, input_ids, input_mask, sequence_labels, token_labels, choice_labels
  
  
      def      lowerCAmelCase_						(self     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__  )     ->      List[Any]:
          __UpperCAmelCase									=			TFMPNetModel(config=lowercase__  )
          __UpperCAmelCase									=			{'''input_ids''': input_ids, '''attention_mask''': input_mask}
          __UpperCAmelCase									=			model(lowercase__  )
          __UpperCAmelCase									=			[input_ids, input_mask]
          __UpperCAmelCase									=			model(lowercase__  )
          self.parent.assertEqual(result.last_hidden_state.shape     ,      (self.batch_size, self.seq_length, self.hidden_size)  )
  
  
      def      lowerCAmelCase_						(self     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__  )     ->      Dict:
          __UpperCAmelCase									=			TFMPNetForMaskedLM(config=lowercase__  )
          __UpperCAmelCase									=			{'''input_ids''': input_ids, '''attention_mask''': input_mask}
          __UpperCAmelCase									=			model(lowercase__  )
          self.parent.assertEqual(result.logits.shape     ,      (self.batch_size, self.seq_length, self.vocab_size)  )
  
  
      def      lowerCAmelCase_						(self     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__  )     ->      List[Any]:
          __UpperCAmelCase									=			TFMPNetForQuestionAnswering(config=lowercase__  )
          __UpperCAmelCase									=			{
              '''input_ids''': input_ids,
              '''attention_mask''': input_mask,
          }
          __UpperCAmelCase									=			model(lowercase__  )
          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      lowerCAmelCase_						(self     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__  )     ->      str:
          __UpperCAmelCase									=			self.num_labels
          __UpperCAmelCase									=			TFMPNetForSequenceClassification(lowercase__  )
          __UpperCAmelCase									=			{'''input_ids''': input_ids, '''attention_mask''': input_mask}
          __UpperCAmelCase									=			model(lowercase__  )
          self.parent.assertEqual(result.logits.shape     ,      (self.batch_size, self.num_labels)  )
  
  
      def      lowerCAmelCase_						(self     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__  )     ->      str:
          __UpperCAmelCase									=			self.num_choices
          __UpperCAmelCase									=			TFMPNetForMultipleChoice(lowercase__  )
          __UpperCAmelCase									=			tf.tile(tf.expand_dims(lowercase__     ,      1  )     ,      (1, self.num_choices, 1)  )
          __UpperCAmelCase									=			tf.tile(tf.expand_dims(lowercase__     ,      1  )     ,      (1, self.num_choices, 1)  )
          __UpperCAmelCase									=			{
              '''input_ids''': multiple_choice_inputs_ids,
              '''attention_mask''': multiple_choice_input_mask,
          }
          __UpperCAmelCase									=			model(lowercase__  )
          self.parent.assertEqual(result.logits.shape     ,      (self.batch_size, self.num_choices)  )
  
  
      def      lowerCAmelCase_						(self     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__  )     ->      List[str]:
          __UpperCAmelCase									=			self.num_labels
          __UpperCAmelCase									=			TFMPNetForTokenClassification(lowercase__  )
          __UpperCAmelCase									=			{'''input_ids''': input_ids, '''attention_mask''': input_mask}
          __UpperCAmelCase									=			model(lowercase__  )
          self.parent.assertEqual(result.logits.shape     ,      (self.batch_size, self.seq_length, self.num_labels)  )
  
  
  
  
  
  
      def      lowerCAmelCase_						(self  )     ->      Optional[Any]:
          __UpperCAmelCase									=			self.prepare_config_and_inputs()
          ((__UpperCAmelCase)					,     (__UpperCAmelCase)					,     (__UpperCAmelCase)					,     (__UpperCAmelCase)					,     (__UpperCAmelCase)					,     (__UpperCAmelCase))									=			config_and_inputs
          __UpperCAmelCase									=			{'''input_ids''': input_ids, '''attention_mask''': input_mask}
          return config, inputs_dict
  
  
  
  
  
  
  @require_tf
  class 					A_   (      _a ,     _a ,     unittest.TestCase						):
  
  
      '''simple docstring'''
  
  
  
  
  
  
      a__     							=       (
          (
              TFMPNetForMaskedLM,
              TFMPNetForMultipleChoice,
              TFMPNetForQuestionAnswering,
              TFMPNetForSequenceClassification,
              TFMPNetForTokenClassification,
              TFMPNetModel,
          )
          if is_tf_available()
          else ()
      )
      a__     							=       (
          {
              "feature-extraction": TFMPNetModel,
              "fill-mask": TFMPNetForMaskedLM,
              "question-answering": TFMPNetForQuestionAnswering,
              "text-classification": TFMPNetForSequenceClassification,
              "token-classification": TFMPNetForTokenClassification,
              "zero-shot": TFMPNetForSequenceClassification,
          }
          if is_tf_available()
          else {}
      )
      a__     							=       False
      a__     							=       False
  
  
      def      lowerCAmelCase_						(self  )     ->      int:
          __UpperCAmelCase									=			TFMPNetModelTester(self  )
          __UpperCAmelCase									=			ConfigTester(self     ,      config_class=lowercase__     ,      hidden_size=37  )
  
  
      def      lowerCAmelCase_						(self  )     ->      Optional[int]:
          self.config_tester.run_common_tests()
  
  
      def      lowerCAmelCase_						(self  )     ->      Dict:
          __UpperCAmelCase									=			self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_mpnet_model(*lowercase__  )
  
  
      def      lowerCAmelCase_						(self  )     ->      Any:
          __UpperCAmelCase									=			self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_mpnet_for_masked_lm(*lowercase__  )
  
  
      def      lowerCAmelCase_						(self  )     ->      int:
          __UpperCAmelCase									=			self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_mpnet_for_question_answering(*lowercase__  )
  
  
      def      lowerCAmelCase_						(self  )     ->      Optional[int]:
          __UpperCAmelCase									=			self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_mpnet_for_sequence_classification(*lowercase__  )
  
  
      def      lowerCAmelCase_						(self  )     ->      str:
          __UpperCAmelCase									=			self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_mpnet_for_multiple_choice(*lowercase__  )
  
  
      def      lowerCAmelCase_						(self  )     ->      str:
          __UpperCAmelCase									=			self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_mpnet_for_token_classification(*lowercase__  )
  
  
  
  
  
  
      @slow
      def      lowerCAmelCase_						(self  )     ->      List[str]:
          for model_name in ["microsoft/mpnet-base"]:
              __UpperCAmelCase									=			TFMPNetModel.from_pretrained(lowercase__  )
              self.assertIsNotNone(lowercase__  )
  
  
  
  
  
  
  @require_tf
  class 					A_   (      unittest.TestCase						):
  
  
      '''simple docstring'''
  
  
  
  
  
  
      @slow
      def      lowerCAmelCase_						(self  )     ->      Any:
          __UpperCAmelCase									=			TFMPNetModel.from_pretrained('''microsoft/mpnet-base'''  )
          __UpperCAmelCase									=			tf.constant([[0, 1, 2, 3, 4, 5]]  )
          __UpperCAmelCase									=			model(lowercase__  )[0]
  
          __UpperCAmelCase									=			[1, 6, 768]
          self.assertEqual(output.shape     ,      lowercase__  )
  
          __UpperCAmelCase									=			tf.constant(
              [
                  [
                      [-0.1067172, 0.08216473, 0.0024543],
                      [-0.03465879, 0.8354118, -0.03252288],
                      [-0.06569476, -0.12424111, -0.0494436],
                  ]
              ]  )
          tf.debugging.assert_near(output[:, :3, :3]     ,      lowercase__     ,      atol=1E-4  )
  
  
  
  
  