


"""simple docstring"""
from __future__ import annotations

import os
import tempfile
import unittest

from transformers import ConvBertConfig, 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 import (
     TFConvBertForMaskedLM,
     TFConvBertForMultipleChoice,
     TFConvBertForQuestionAnswering,
     TFConvBertForSequenceClassification,
     TFConvBertForTokenClassification,
     TFConvBertModel,
 )




class 	lowercase__				:





   def __init__(							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE=13      ,   SCREAMING_SNAKE_CASE=7      ,   SCREAMING_SNAKE_CASE=True      ,   SCREAMING_SNAKE_CASE=True      ,   SCREAMING_SNAKE_CASE=True      ,   SCREAMING_SNAKE_CASE=True      ,   SCREAMING_SNAKE_CASE=99      ,   SCREAMING_SNAKE_CASE=32      ,   SCREAMING_SNAKE_CASE=2      ,   SCREAMING_SNAKE_CASE=4      ,   SCREAMING_SNAKE_CASE=37      ,   SCREAMING_SNAKE_CASE="gelu"      ,   SCREAMING_SNAKE_CASE=0.1      ,   SCREAMING_SNAKE_CASE=0.1      ,   SCREAMING_SNAKE_CASE=512      ,   SCREAMING_SNAKE_CASE=16      ,   SCREAMING_SNAKE_CASE=2      ,   SCREAMING_SNAKE_CASE=0.02      ,   SCREAMING_SNAKE_CASE=3      ,   SCREAMING_SNAKE_CASE=4      ,   SCREAMING_SNAKE_CASE=None      ,   )  ->  Optional[int]:
      _lowerCamelCase	:					Tuple   =		parent
      _lowerCamelCase	:					List[Any]   =		13
      _lowerCamelCase	:					Union[str, Any]   =		7
      _lowerCamelCase	:					Optional[Any]   =		True
      _lowerCamelCase	:					List[Any]   =		True
      _lowerCamelCase	:					Tuple   =		True
      _lowerCamelCase	:					int   =		True
      _lowerCamelCase	:					Any   =		99
      _lowerCamelCase	:					Optional[int]   =		384
      _lowerCamelCase	:					Tuple   =		2
      _lowerCamelCase	:					List[Any]   =		4
      _lowerCamelCase	:					Any   =		37
      _lowerCamelCase	:					Any   =		"""gelu"""
      _lowerCamelCase	:					Optional[Any]   =		0.1
      _lowerCamelCase	:					Optional[Any]   =		0.1
      _lowerCamelCase	:					Optional[Any]   =		512
      _lowerCamelCase	:					Any   =		16
      _lowerCamelCase	:					int   =		2
      _lowerCamelCase	:					Any   =		0.02
      _lowerCamelCase	:					Tuple   =		3
      _lowerCamelCase	:					Optional[int]   =		4
      _lowerCamelCase	:					Dict   =		128
      _lowerCamelCase	:					List[str]   =		2
      _lowerCamelCase	:					int   =		9
      _lowerCamelCase	:					Optional[Any]   =		1
      _lowerCamelCase	:					Any   =		None





   def 		UpperCamelCase_  (							self)  ->  str:
      _lowerCamelCase	:					Optional[Any]   =		ids_tensor([self.batch_size, self.seq_length]      ,   self.vocab_size)

      _lowerCamelCase	:					Tuple   =		None
      if self.use_input_mask:
         _lowerCamelCase	:					Optional[Any]   =		random_attention_mask([self.batch_size, self.seq_length])

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

      _lowerCamelCase	:					Any   =		None
      _lowerCamelCase	:					str   =		None
      _lowerCamelCase	:					List[Any]   =		None
      if self.use_labels:
         _lowerCamelCase	:					Optional[Any]   =		ids_tensor([self.batch_size]      ,   self.type_sequence_label_size)
         _lowerCamelCase	:					Union[str, Any]   =		ids_tensor([self.batch_size, self.seq_length]      ,   self.num_labels)
         _lowerCamelCase	:					Optional[int]   =		ids_tensor([self.batch_size]      ,   self.num_choices)

      _lowerCamelCase	:					Union[str, Any]   =		ConvBertConfig(
          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      ,   initializer_range=self.initializer_range      ,   return_dict=SCREAMING_SNAKE_CASE      ,   )

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





   def 		UpperCamelCase_  (							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)  ->  Optional[int]:
      _lowerCamelCase	:					str   =		TFConvBertModel(config=SCREAMING_SNAKE_CASE)
      _lowerCamelCase	:					List[str]   =		{"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}

      _lowerCamelCase	:					int   =		[input_ids, input_mask]
      _lowerCamelCase	:					Tuple   =		model(SCREAMING_SNAKE_CASE)

      _lowerCamelCase	:					List[Any]   =		model(SCREAMING_SNAKE_CASE)

      self.parent.assertEqual(result.last_hidden_state.shape      ,   (self.batch_size, self.seq_length, self.hidden_size))





   def 		UpperCamelCase_  (							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)  ->  int:
      _lowerCamelCase	:					List[str]   =		TFConvBertForMaskedLM(config=SCREAMING_SNAKE_CASE)
      _lowerCamelCase	:					Optional[int]   =		{
          """input_ids""": input_ids,
          """attention_mask""": input_mask,
          """token_type_ids""": token_type_ids,
      }
      _lowerCamelCase	:					Tuple   =		model(SCREAMING_SNAKE_CASE)
      self.parent.assertEqual(result.logits.shape      ,   (self.batch_size, self.seq_length, self.vocab_size))





   def 		UpperCamelCase_  (							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)  ->  List[str]:
      _lowerCamelCase	:					Tuple   =		self.num_labels
      _lowerCamelCase	:					Optional[int]   =		TFConvBertForSequenceClassification(config=SCREAMING_SNAKE_CASE)
      _lowerCamelCase	:					Optional[Any]   =		{
          """input_ids""": input_ids,
          """attention_mask""": input_mask,
          """token_type_ids""": token_type_ids,
      }

      _lowerCamelCase	:					int   =		model(SCREAMING_SNAKE_CASE)
      self.parent.assertEqual(result.logits.shape      ,   (self.batch_size, self.num_labels))





   def 		UpperCamelCase_  (							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)  ->  Dict:
      _lowerCamelCase	:					Optional[Any]   =		self.num_choices
      _lowerCamelCase	:					Optional[int]   =		TFConvBertForMultipleChoice(config=SCREAMING_SNAKE_CASE)
      _lowerCamelCase	:					Optional[Any]   =		tf.tile(tf.expand_dims(SCREAMING_SNAKE_CASE      ,   1)      ,   (1, self.num_choices, 1))
      _lowerCamelCase	:					Union[str, Any]   =		tf.tile(tf.expand_dims(SCREAMING_SNAKE_CASE      ,   1)      ,   (1, self.num_choices, 1))
      _lowerCamelCase	:					Dict   =		tf.tile(tf.expand_dims(SCREAMING_SNAKE_CASE      ,   1)      ,   (1, self.num_choices, 1))
      _lowerCamelCase	:					Dict   =		{
          """input_ids""": multiple_choice_inputs_ids,
          """attention_mask""": multiple_choice_input_mask,
          """token_type_ids""": multiple_choice_token_type_ids,
      }
      _lowerCamelCase	:					Dict   =		model(SCREAMING_SNAKE_CASE)
      self.parent.assertEqual(result.logits.shape      ,   (self.batch_size, self.num_choices))





   def 		UpperCamelCase_  (							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)  ->  List[Any]:
      _lowerCamelCase	:					str   =		self.num_labels
      _lowerCamelCase	:					Optional[int]   =		TFConvBertForTokenClassification(config=SCREAMING_SNAKE_CASE)
      _lowerCamelCase	:					Optional[int]   =		{
          """input_ids""": input_ids,
          """attention_mask""": input_mask,
          """token_type_ids""": token_type_ids,
      }
      _lowerCamelCase	:					List[Any]   =		model(SCREAMING_SNAKE_CASE)
      self.parent.assertEqual(result.logits.shape      ,   (self.batch_size, self.seq_length, self.num_labels))





   def 		UpperCamelCase_  (							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)  ->  List[str]:
      _lowerCamelCase	:					List[str]   =		TFConvBertForQuestionAnswering(config=SCREAMING_SNAKE_CASE)
      _lowerCamelCase	:					Optional[Any]   =		{
          """input_ids""": input_ids,
          """attention_mask""": input_mask,
          """token_type_ids""": token_type_ids,
      }

      _lowerCamelCase	:					str   =		model(SCREAMING_SNAKE_CASE)
      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 		UpperCamelCase_  (							self)  ->  Dict:
      _lowerCamelCase	:					int   =		self.prepare_config_and_inputs()
      (
          (
          _lowerCamelCase
      )   ,    (
          _lowerCamelCase
      )   ,    (
          _lowerCamelCase
      )   ,    (
          _lowerCamelCase
      )   ,    (
          _lowerCamelCase
      )   ,    (
          _lowerCamelCase
      )   ,    (
          _lowerCamelCase
      )   ,    
      )	:					Union[str, Any]   =		config_and_inputs
      _lowerCamelCase	:					Tuple   =		{"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """attention_mask""": input_mask}
      return config, inputs_dict







@require_tf
class 	lowercase__				(					A_ ,A_ ,unittest.TestCase				):
   __UpperCAmelCase							       =					(
       (
           TFConvBertModel,
           TFConvBertForMaskedLM,
           TFConvBertForQuestionAnswering,
           TFConvBertForSequenceClassification,
           TFConvBertForTokenClassification,
           TFConvBertForMultipleChoice,
       )
       if is_tf_available()
       else ()
   )
   __UpperCAmelCase							       =					(
       {
           '''feature-extraction''': TFConvBertModel,
           '''fill-mask''': TFConvBertForMaskedLM,
           '''question-answering''': TFConvBertForQuestionAnswering,
           '''text-classification''': TFConvBertForSequenceClassification,
           '''token-classification''': TFConvBertForTokenClassification,
           '''zero-shot''': TFConvBertForSequenceClassification,
       }
       if is_tf_available()
       else {}
   )
   __UpperCAmelCase							       =					False
   __UpperCAmelCase							       =					False
   __UpperCAmelCase							       =					False





   def 		UpperCamelCase_  (							self)  ->  Dict:
      _lowerCamelCase	:					List[str]   =		TFConvBertModelTester(self)
      _lowerCamelCase	:					Tuple   =		ConfigTester(self      ,   config_class=SCREAMING_SNAKE_CASE      ,   hidden_size=37)





   def 		UpperCamelCase_  (							self)  ->  List[Any]:
      self.config_tester.run_common_tests()





   def 		UpperCamelCase_  (							self)  ->  Dict:
      _lowerCamelCase	:					int   =		self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_model(*SCREAMING_SNAKE_CASE)





   def 		UpperCamelCase_  (							self)  ->  Optional[Any]:
      _lowerCamelCase	:					Optional[int]   =		self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_for_masked_lm(*SCREAMING_SNAKE_CASE)





   def 		UpperCamelCase_  (							self)  ->  Optional[Any]:
      _lowerCamelCase	:					Union[str, Any]   =		self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_for_multiple_choice(*SCREAMING_SNAKE_CASE)





   def 		UpperCamelCase_  (							self)  ->  int:
      _lowerCamelCase	:					str   =		self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_for_question_answering(*SCREAMING_SNAKE_CASE)





   def 		UpperCamelCase_  (							self)  ->  Any:
      _lowerCamelCase	:					str   =		self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_for_sequence_classification(*SCREAMING_SNAKE_CASE)





   def 		UpperCamelCase_  (							self)  ->  Any:
      _lowerCamelCase	:					Tuple   =		self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_for_token_classification(*SCREAMING_SNAKE_CASE)





   @slow
   def 		UpperCamelCase_  (							self)  ->  Optional[Any]:
      _lowerCamelCase   ,    _lowerCamelCase	:					List[str]   =		self.model_tester.prepare_config_and_inputs_for_common()
      _lowerCamelCase	:					List[str]   =		True
      _lowerCamelCase	:					Union[str, Any]   =		True

      if hasattr(SCREAMING_SNAKE_CASE      ,   """use_cache"""):
         _lowerCamelCase	:					List[Any]   =		True

      _lowerCamelCase	:					Optional[Any]   =		getattr(self.model_tester      ,   """encoder_seq_length"""      ,   self.model_tester.seq_length)
      _lowerCamelCase	:					Optional[Any]   =		getattr(self.model_tester      ,   """key_length"""      ,   SCREAMING_SNAKE_CASE)

      for model_class in self.all_model_classes:
         _lowerCamelCase	:					Union[str, Any]   =		self._prepare_for_class(SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)
         _lowerCamelCase	:					Dict   =		model_class(SCREAMING_SNAKE_CASE)
         _lowerCamelCase	:					int   =		len(model(SCREAMING_SNAKE_CASE))

         with tempfile.TemporaryDirectory() as tmpdirname:
            model.save_pretrained(SCREAMING_SNAKE_CASE      ,   saved_model=SCREAMING_SNAKE_CASE)
            _lowerCamelCase	:					List[Any]   =		os.path.join(SCREAMING_SNAKE_CASE      ,   """saved_model"""      ,   """1""")
            _lowerCamelCase	:					str   =		tf.keras.models.load_model(SCREAMING_SNAKE_CASE)
            _lowerCamelCase	:					List[str]   =		model(SCREAMING_SNAKE_CASE)

            if self.is_encoder_decoder:
               _lowerCamelCase	:					Any   =		outputs["""encoder_hidden_states"""]
               _lowerCamelCase	:					Union[str, Any]   =		outputs["""encoder_attentions"""]
            else:
               _lowerCamelCase	:					Tuple   =		outputs["""hidden_states"""]
               _lowerCamelCase	:					List[Any]   =		outputs["""attentions"""]

            self.assertEqual(len(SCREAMING_SNAKE_CASE)      ,   SCREAMING_SNAKE_CASE)

            _lowerCamelCase	:					Optional[int]   =		getattr(
                self.model_tester      ,   """expected_num_hidden_layers"""      ,   self.model_tester.num_hidden_layers + 1)

            self.assertEqual(len(SCREAMING_SNAKE_CASE)      ,   SCREAMING_SNAKE_CASE)
            self.assertListEqual(
                list(output_hidden_states[0].shape[-2:])      ,   [self.model_tester.seq_length, self.model_tester.hidden_size]      ,   )

            self.assertEqual(len(SCREAMING_SNAKE_CASE)      ,   self.model_tester.num_hidden_layers)
            self.assertListEqual(
                list(output_attentions[0].shape[-3:])      ,   [self.model_tester.num_attention_heads / 2, encoder_seq_length, encoder_key_length]      ,   )





   @slow
   def 		UpperCamelCase_  (							self)  ->  List[Any]:
      _lowerCamelCase	:					Tuple   =		TFConvBertModel.from_pretrained("""YituTech/conv-bert-base""")
      self.assertIsNotNone(SCREAMING_SNAKE_CASE)





   def 		UpperCamelCase_  (							self)  ->  List[Any]:
      _lowerCamelCase   ,    _lowerCamelCase	:					int   =		self.model_tester.prepare_config_and_inputs_for_common()
      _lowerCamelCase	:					Tuple   =		True
      _lowerCamelCase	:					List[str]   =		getattr(self.model_tester      ,   """decoder_seq_length"""      ,   self.model_tester.seq_length)
      _lowerCamelCase	:					int   =		getattr(self.model_tester      ,   """encoder_seq_length"""      ,   self.model_tester.seq_length)
      _lowerCamelCase	:					List[str]   =		getattr(self.model_tester      ,   """key_length"""      ,   SCREAMING_SNAKE_CASE)
      _lowerCamelCase	:					List[str]   =		getattr(self.model_tester      ,   """key_length"""      ,   SCREAMING_SNAKE_CASE)

      def check_decoder_attentions_output(SCREAMING_SNAKE_CASE):
         _lowerCamelCase	:					List[str]   =		len(SCREAMING_SNAKE_CASE)
         self.assertEqual(out_len % 2      ,   0)
         _lowerCamelCase	:					List[str]   =		outputs.decoder_attentions
         self.assertEqual(len(SCREAMING_SNAKE_CASE)      ,   self.model_tester.num_hidden_layers)
         self.assertListEqual(
             list(decoder_attentions[0].shape[-3:])      ,   [self.model_tester.num_attention_heads / 2, decoder_seq_length, decoder_key_length]      ,   )

      def check_encoder_attentions_output(SCREAMING_SNAKE_CASE):
         _lowerCamelCase	:					int   =		[
             t.numpy() for t in (outputs.encoder_attentions if config.is_encoder_decoder else outputs.attentions)
         ]
         self.assertEqual(len(SCREAMING_SNAKE_CASE)      ,   self.model_tester.num_hidden_layers)
         self.assertListEqual(
             list(attentions[0].shape[-3:])      ,   [self.model_tester.num_attention_heads / 2, encoder_seq_length, encoder_key_length]      ,   )

      for model_class in self.all_model_classes:
         _lowerCamelCase	:					Optional[Any]   =		True
         _lowerCamelCase	:					Tuple   =		False
         _lowerCamelCase	:					Tuple   =		model_class(SCREAMING_SNAKE_CASE)
         _lowerCamelCase	:					Optional[int]   =		model(self._prepare_for_class(SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE))
         _lowerCamelCase	:					Union[str, Any]   =		len(SCREAMING_SNAKE_CASE)
         self.assertEqual(config.output_hidden_states      ,   SCREAMING_SNAKE_CASE)
         check_encoder_attentions_output(SCREAMING_SNAKE_CASE)

         if self.is_encoder_decoder:
            _lowerCamelCase	:					Optional[int]   =		model_class(SCREAMING_SNAKE_CASE)
            _lowerCamelCase	:					List[Any]   =		model(self._prepare_for_class(SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE))
            self.assertEqual(config.output_hidden_states      ,   SCREAMING_SNAKE_CASE)
            check_decoder_attentions_output(SCREAMING_SNAKE_CASE)

         # Check that output attentions can also be changed via the config
         del inputs_dict["output_attentions"]
         _lowerCamelCase	:					Optional[Any]   =		True
         _lowerCamelCase	:					Union[str, Any]   =		model_class(SCREAMING_SNAKE_CASE)
         _lowerCamelCase	:					Union[str, Any]   =		model(self._prepare_for_class(SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE))
         self.assertEqual(config.output_hidden_states      ,   SCREAMING_SNAKE_CASE)
         check_encoder_attentions_output(SCREAMING_SNAKE_CASE)

         # Check attention is always last and order is fine
         _lowerCamelCase	:					List[str]   =		True
         _lowerCamelCase	:					Optional[Any]   =		True
         _lowerCamelCase	:					Dict   =		model_class(SCREAMING_SNAKE_CASE)
         _lowerCamelCase	:					List[Any]   =		model(self._prepare_for_class(SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE))

         self.assertEqual(out_len + (2 if self.is_encoder_decoder else 1)      ,   len(SCREAMING_SNAKE_CASE))
         self.assertEqual(model.config.output_hidden_states      ,   SCREAMING_SNAKE_CASE)
         check_encoder_attentions_output(SCREAMING_SNAKE_CASE)







@require_tf
class 	lowercase__				(					unittest.TestCase				):





   @slow
   def 		UpperCamelCase_  (							self)  ->  Dict:
      _lowerCamelCase	:					List[Any]   =		TFConvBertModel.from_pretrained("""YituTech/conv-bert-base""")
      _lowerCamelCase	:					Optional[Any]   =		tf.constant([[0, 1, 2, 3, 4, 5]])
      _lowerCamelCase	:					Optional[int]   =		model(SCREAMING_SNAKE_CASE)[0]

      _lowerCamelCase	:					str   =		[1, 6, 768]
      self.assertEqual(output.shape      ,   SCREAMING_SNAKE_CASE)

      _lowerCamelCase	:					List[str]   =		tf.constant(
          [
              [
                  [-0.03_47_54_93, -0.4_68_60_34, -0.30_63_88_32],
                  [0.22_63_72_48, -0.26_98_86_46, -0.7_42_34_24],
                  [0.10_32_48_68, -0.45_01_35_08, -0.58_28_07_84],
              ]
          ])
      tf.debugging.assert_near(output[:, :3, :3]      ,   SCREAMING_SNAKE_CASE      ,   atol=1e-4)






"""simple docstring"""







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available


A		=						{}

try:
			if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			A		=						['GPTSw3Tokenizer']


if TYPE_CHECKING:
			try:
						if not is_sentencepiece_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .tokenization_gpt_swa import GPTSwaTokenizer

else:
			import sys

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



