





from __future__ import annotations

import unittest

from transformers import RoFormerConfig, 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 (
         TFRoFormerForCausalLM,
         TFRoFormerForMaskedLM,
         TFRoFormerForMultipleChoice,
         TFRoFormerForQuestionAnswering,
         TFRoFormerForSequenceClassification,
         TFRoFormerForTokenClassification,
         TFRoFormerModel,
     )
     from transformers.models.roformer.modeling_tf_roformer import (
         TFRoFormerSelfAttention,
         TFRoFormerSinusoidalPositionalEmbedding,
     )



class    _SCREAMING_SNAKE_CASE						:







 '''simple docstring'''

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



   '''simple docstring'''



   lowerCamelCase__:      Any			  =parent
   lowerCamelCase__:      int			  =13
   lowerCamelCase__:      List[str]			  =7
   lowerCamelCase__:      int			  =True
   lowerCamelCase__:      int			  =True
   lowerCamelCase__:      Tuple			  =True
   lowerCamelCase__:      List[str]			  =True
   lowerCamelCase__:      Any			  =99
   lowerCamelCase__:      List[Any]			  =32
   lowerCamelCase__:      Union[str, Any]			  =2
   lowerCamelCase__:      List[str]			  =4
   lowerCamelCase__:      Optional[Any]			  =37
   lowerCamelCase__:      Any			  ="gelu"
   lowerCamelCase__:      int			  =0.1
   lowerCamelCase__:      List[str]			  =0.1
   lowerCamelCase__:      str			  =512
   lowerCamelCase__:      Tuple			  =16
   lowerCamelCase__:      Optional[int]			  =2
   lowerCamelCase__:      List[Any]			  =0.02
   lowerCamelCase__:      str			  =3
   lowerCamelCase__:      int			  =4
   lowerCamelCase__:      int			  =None

 def 							SCREAMING_SNAKE_CASE_					(self				:   Any)       ->int:



   '''simple docstring'''



   lowerCamelCase__:      Dict			  =ids_tensor([self.batch_size, self.seq_length]       , self.vocab_size)

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

   lowerCamelCase__:      Optional[Any]			  =None
   if self.use_token_type_ids:
     lowerCamelCase__:      Dict			  =ids_tensor([self.batch_size, self.seq_length]       , self.type_vocab_size)

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

   lowerCamelCase__:      List[Any]			  =RoFormerConfig(
       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=UpperCAmelCase_       , )

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

 def 							SCREAMING_SNAKE_CASE_					(self				:   List[str]       , UpperCAmelCase_				:   Optional[int]       , UpperCAmelCase_				:   Dict       , UpperCAmelCase_				:   Union[str, Any]       , UpperCAmelCase_				:   Union[str, Any]       , UpperCAmelCase_				:   str       , UpperCAmelCase_				:   List[str]       , UpperCAmelCase_				:   List[Any])       ->int:



   '''simple docstring'''



   lowerCamelCase__:      List[Any]			  =TFRoFormerModel(config=UpperCAmelCase_)
   lowerCamelCase__:      Union[str, Any]			  ={"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}

   lowerCamelCase__:      List[Any]			  =[input_ids, input_mask]
   lowerCamelCase__:      Dict			  =model(UpperCAmelCase_)

   lowerCamelCase__:      str			  =model(UpperCAmelCase_)

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

 def 							SCREAMING_SNAKE_CASE_					(self				:   Optional[Any]       , UpperCAmelCase_				:   Any       , UpperCAmelCase_				:   Dict       , UpperCAmelCase_				:   Union[str, Any]       , UpperCAmelCase_				:   int       , UpperCAmelCase_				:   Optional[Any]       , UpperCAmelCase_				:   Dict       , UpperCAmelCase_				:   Union[str, Any])       ->Dict:



   '''simple docstring'''



   lowerCamelCase__:      Optional[Any]			  =True
   lowerCamelCase__:      int			  =TFRoFormerForCausalLM(config=UpperCAmelCase_)
   lowerCamelCase__:      Optional[int]			  ={
       "input_ids": input_ids,
       "attention_mask": input_mask,
       "token_type_ids": token_type_ids,
   }
   lowerCamelCase__:      Any			  =model(UpperCAmelCase_)["logits"]
   self.parent.assertListEqual(
       list(prediction_scores.numpy().shape)       , [self.batch_size, self.seq_length, self.vocab_size])

 def 							SCREAMING_SNAKE_CASE_					(self				:   int       , UpperCAmelCase_				:   Optional[Any]       , UpperCAmelCase_				:   List[Any]       , UpperCAmelCase_				:   Dict       , UpperCAmelCase_				:   str       , UpperCAmelCase_				:   Optional[int]       , UpperCAmelCase_				:   Dict       , UpperCAmelCase_				:   List[str])       ->int:



   '''simple docstring'''



   lowerCamelCase__:      Union[str, Any]			  =TFRoFormerForMaskedLM(config=UpperCAmelCase_)
   lowerCamelCase__:      Tuple			  ={
       "input_ids": input_ids,
       "attention_mask": input_mask,
       "token_type_ids": token_type_ids,
   }
   lowerCamelCase__:      Union[str, Any]			  =model(UpperCAmelCase_)
   self.parent.assertEqual(result.logits.shape       , (self.batch_size, self.seq_length, self.vocab_size))

 def 							SCREAMING_SNAKE_CASE_					(self				:   Any       , UpperCAmelCase_				:   int       , UpperCAmelCase_				:   str       , UpperCAmelCase_				:   Optional[int]       , UpperCAmelCase_				:   Any       , UpperCAmelCase_				:   Union[str, Any]       , UpperCAmelCase_				:   List[str]       , UpperCAmelCase_				:   Tuple)       ->List[Any]:



   '''simple docstring'''



   lowerCamelCase__:      List[Any]			  =self.num_labels
   lowerCamelCase__:      Tuple			  =TFRoFormerForSequenceClassification(config=UpperCAmelCase_)
   lowerCamelCase__:      List[Any]			  ={
       "input_ids": input_ids,
       "attention_mask": input_mask,
       "token_type_ids": token_type_ids,
   }

   lowerCamelCase__:      Tuple			  =model(UpperCAmelCase_)
   self.parent.assertEqual(result.logits.shape       , (self.batch_size, self.num_labels))

 def 							SCREAMING_SNAKE_CASE_					(self				:   Any       , UpperCAmelCase_				:   Union[str, Any]       , UpperCAmelCase_				:   int       , UpperCAmelCase_				:   List[str]       , UpperCAmelCase_				:   Union[str, Any]       , UpperCAmelCase_				:   List[str]       , UpperCAmelCase_				:   Optional[int]       , UpperCAmelCase_				:   int)       ->List[str]:



   '''simple docstring'''



   lowerCamelCase__:      Dict			  =self.num_choices
   lowerCamelCase__:      List[Any]			  =TFRoFormerForMultipleChoice(config=UpperCAmelCase_)
   lowerCamelCase__:      List[Any]			  =tf.tile(tf.expand_dims(UpperCAmelCase_       , 1)       , (1, self.num_choices, 1))
   lowerCamelCase__:      List[Any]			  =tf.tile(tf.expand_dims(UpperCAmelCase_       , 1)       , (1, self.num_choices, 1))
   lowerCamelCase__:      int			  =tf.tile(tf.expand_dims(UpperCAmelCase_       , 1)       , (1, self.num_choices, 1))
   lowerCamelCase__:      List[Any]			  ={
       "input_ids": multiple_choice_inputs_ids,
       "attention_mask": multiple_choice_input_mask,
       "token_type_ids": multiple_choice_token_type_ids,
   }
   lowerCamelCase__:      Tuple			  =model(UpperCAmelCase_)
   self.parent.assertEqual(result.logits.shape       , (self.batch_size, self.num_choices))

 def 							SCREAMING_SNAKE_CASE_					(self				:   Tuple       , UpperCAmelCase_				:   Any       , UpperCAmelCase_				:   List[Any]       , UpperCAmelCase_				:   str       , UpperCAmelCase_				:   List[str]       , UpperCAmelCase_				:   str       , UpperCAmelCase_				:   str       , UpperCAmelCase_				:   List[Any])       ->List[Any]:



   '''simple docstring'''



   lowerCamelCase__:      List[str]			  =self.num_labels
   lowerCamelCase__:      Optional[int]			  =TFRoFormerForTokenClassification(config=UpperCAmelCase_)
   lowerCamelCase__:      Dict			  ={
       "input_ids": input_ids,
       "attention_mask": input_mask,
       "token_type_ids": token_type_ids,
   }
   lowerCamelCase__:      Union[str, Any]			  =model(UpperCAmelCase_)
   self.parent.assertEqual(result.logits.shape       , (self.batch_size, self.seq_length, self.num_labels))

 def 							SCREAMING_SNAKE_CASE_					(self				:   List[str]       , UpperCAmelCase_				:   Tuple       , UpperCAmelCase_				:   Tuple       , UpperCAmelCase_				:   int       , UpperCAmelCase_				:   Optional[int]       , UpperCAmelCase_				:   str       , UpperCAmelCase_				:   int       , UpperCAmelCase_				:   int)       ->str:



   '''simple docstring'''



   lowerCamelCase__:      Dict			  =TFRoFormerForQuestionAnswering(config=UpperCAmelCase_)
   lowerCamelCase__:      Optional[int]			  ={
       "input_ids": input_ids,
       "attention_mask": input_mask,
       "token_type_ids": token_type_ids,
   }

   lowerCamelCase__:      Optional[Any]			  =model(UpperCAmelCase_)
   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 							SCREAMING_SNAKE_CASE_					(self				:   int)       ->Tuple:



   '''simple docstring'''



   lowerCamelCase__:      Optional[Any]			  =self.prepare_config_and_inputs()
   (
       (
       lowerCamelCase__
   )  ,					(
       lowerCamelCase__
   )  ,					(
       lowerCamelCase__
   )  ,					(
       lowerCamelCase__
   )  ,					(
       lowerCamelCase__
   )  ,					(
       lowerCamelCase__
   )  ,					(
       lowerCamelCase__
   )  ,					
   ):      int			  =config_and_inputs
   lowerCamelCase__:      Optional[Any]			  ={"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
   return config, inputs_dict



@require_tf
class    _SCREAMING_SNAKE_CASE						(	__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							unittest.TestCase    ):







 '''simple docstring'''
 lowercase_		=			(
     (
         TFRoFormerModel,
         TFRoFormerForCausalLM,
         TFRoFormerForMaskedLM,
         TFRoFormerForQuestionAnswering,
         TFRoFormerForSequenceClassification,
         TFRoFormerForTokenClassification,
         TFRoFormerForMultipleChoice,
     )
     if is_tf_available()
     else ()
 )
 lowercase_		=			(
     {
         "feature-extraction": TFRoFormerModel,
         "fill-mask": TFRoFormerForMaskedLM,
         "question-answering": TFRoFormerForQuestionAnswering,
         "text-classification": TFRoFormerForSequenceClassification,
         "text-generation": TFRoFormerForCausalLM,
         "token-classification": TFRoFormerForTokenClassification,
         "zero-shot": TFRoFormerForSequenceClassification,
     }
     if is_tf_available()
     else {}
 )

 lowercase_		=			False
 lowercase_		=			False

 def 							SCREAMING_SNAKE_CASE_					(self				:   List[Any]       , UpperCAmelCase_				:   Optional[int]       , UpperCAmelCase_				:   str       , UpperCAmelCase_				:   List[str]       , UpperCAmelCase_				:   List[Any]       , UpperCAmelCase_				:   int)       ->str:



   '''simple docstring'''



   if pipeline_test_casse_name == "TextGenerationPipelineTests":
     return True

   return False

 def 							SCREAMING_SNAKE_CASE_					(self				:   Optional[int])       ->int:



   '''simple docstring'''



   lowerCamelCase__:      int			  =TFRoFormerModelTester(self)
   lowerCamelCase__:      Any			  =ConfigTester(self       , config_class=UpperCAmelCase_       , hidden_size=37)

 def 							SCREAMING_SNAKE_CASE_					(self				:   Optional[Any])       ->Any:



   '''simple docstring'''



   self.config_tester.run_common_tests()

 def 							SCREAMING_SNAKE_CASE_					(self				:   List[str])       ->Dict:



   '''simple docstring'''



   lowerCamelCase__:      Dict			  =self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_model(*UpperCAmelCase_)

 def 							SCREAMING_SNAKE_CASE_					(self				:   int)       ->Optional[int]:



   '''simple docstring'''



   lowerCamelCase__:      int			  =self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_for_masked_lm(*UpperCAmelCase_)

 def 							SCREAMING_SNAKE_CASE_					(self				:   str)       ->List[str]:



   '''simple docstring'''



   lowerCamelCase__:      List[str]			  =self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_lm_head(*UpperCAmelCase_)

 def 							SCREAMING_SNAKE_CASE_					(self				:   List[str])       ->str:



   '''simple docstring'''



   lowerCamelCase__:      Optional[int]			  =self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_for_multiple_choice(*UpperCAmelCase_)

 def 							SCREAMING_SNAKE_CASE_					(self				:   Any)       ->str:



   '''simple docstring'''



   lowerCamelCase__:      int			  =self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_for_question_answering(*UpperCAmelCase_)

 def 							SCREAMING_SNAKE_CASE_					(self				:   Tuple)       ->Dict:



   '''simple docstring'''



   lowerCamelCase__:      List[str]			  =self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_for_sequence_classification(*UpperCAmelCase_)

 def 							SCREAMING_SNAKE_CASE_					(self				:   List[str])       ->Dict:



   '''simple docstring'''



   lowerCamelCase__:      List[str]			  =self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_for_token_classification(*UpperCAmelCase_)







 @slow
 def 							SCREAMING_SNAKE_CASE_					(self				:   Union[str, Any])       ->Union[str, Any]:



   '''simple docstring'''



   lowerCamelCase__:      Dict			  =TFRoFormerModel.from_pretrained("junnyu/roformer_chinese_base")
   self.assertIsNotNone(UpperCAmelCase_)



@require_tf
class    _SCREAMING_SNAKE_CASE						(	unittest.TestCase    ):







 '''simple docstring'''

 @slow
 def 							SCREAMING_SNAKE_CASE_					(self				:   Tuple)       ->Union[str, Any]:



   '''simple docstring'''



   lowerCamelCase__:      List[str]			  =TFRoFormerForMaskedLM.from_pretrained("junnyu/roformer_chinese_base")
   lowerCamelCase__:      Union[str, Any]			  =tf.constant([[0, 1, 2, 3, 4, 5]])
   lowerCamelCase__:      int			  =model(UpperCAmelCase_)[0]

   # TODO Replace vocab size
   lowerCamelCase__:      str			  =50_000

   lowerCamelCase__:      int			  =[1, 6, vocab_size]
   self.assertEqual(output.shape       , UpperCAmelCase_)

   print(output[:, :3, :3])

   # TODO Replace values below with what was printed above.
   lowerCamelCase__:      List[Any]			  =tf.constant(
       [
           [
               [-0.1205_3341, -1.026_4901, 0.2922_1946],
               [-1.513_3783, 0.19_7433, 0.1519_0607],
               [-5.013_5403, -3.90_0256, -0.8403_8764],
           ]
       ])
   tf.debugging.assert_near(output[:, :3, :3]       , UpperCAmelCase_       , atol=1E-4)



@require_tf
class    _SCREAMING_SNAKE_CASE						(	unittest.TestCase    ):







 '''simple docstring'''
 lowercase_		=			1E-4

 def 							SCREAMING_SNAKE_CASE_					(self				:   List[str])       ->str:



   '''simple docstring'''



   lowerCamelCase__:      Optional[Any]			  =tf.constant([[4, 10]])
   lowerCamelCase__:      Any			  =TFRoFormerSinusoidalPositionalEmbedding(num_positions=6       , embedding_dim=6)

   lowerCamelCase__:      Dict			  =emba(input_ids.shape)
   lowerCamelCase__:      Dict			  =tf.constant(
       [[0.0000, 0.0000, 0.0000, 1.0000, 1.0000, 1.0000], [0.8415, 0.0464, 0.0022, 0.5403, 0.9989, 1.0000]])

   tf.debugging.assert_near(UpperCAmelCase_       , UpperCAmelCase_       , atol=self.tolerance)







 def 							SCREAMING_SNAKE_CASE_					(self				:   str)       ->int:



   '''simple docstring'''



   lowerCamelCase__:      Dict			  =tf.constant(
       [
           [0.0000, 0.0000, 0.0000, 0.0000, 0.0000],
           [0.8415, 0.8219, 0.8020, 0.7819, 0.7617],
           [0.9093, 0.9364, 0.9581, 0.9749, 0.9870],
       ])
   lowerCamelCase__:      List[str]			  =TFRoFormerSinusoidalPositionalEmbedding(num_positions=512       , embedding_dim=512)
   emba([2, 16, 512])
   lowerCamelCase__:      str			  =emba.weight[:3, :5]

   tf.debugging.assert_near(UpperCAmelCase_       , UpperCAmelCase_       , atol=self.tolerance)



@require_tf
class    _SCREAMING_SNAKE_CASE						(	unittest.TestCase    ):







 '''simple docstring'''
 lowercase_		=			1E-4

 def 							SCREAMING_SNAKE_CASE_					(self				:   Any)       ->Optional[int]:



   '''simple docstring'''



   lowerCamelCase__:      int			  =tf.reshape(tf.range(2 * 12 * 16 * 64       , dtype=tf.floataa)       , shape=(2, 12, 16, 64)) / 100

   lowerCamelCase__:      Tuple			  =-tf.reshape(tf.range(2 * 12 * 16 * 64       , dtype=tf.floataa)       , shape=(2, 12, 16, 64)) / 100

   lowerCamelCase__:      Any			  =TFRoFormerSinusoidalPositionalEmbedding(num_positions=32       , embedding_dim=64)
   lowerCamelCase__:      int			  =embed_positions([2, 16, 768])[None, None, :, :]

   lowerCamelCase__  ,					lowerCamelCase__:      int			  =TFRoFormerSelfAttention.apply_rotary_position_embeddings(
       UpperCAmelCase_       , UpperCAmelCase_       , UpperCAmelCase_)

   lowerCamelCase__:      Optional[int]			  =tf.constant(
       [
           [0.0000, 0.0100, 0.0200, 0.0300, 0.0400, 0.0500, 0.0600, 0.0700],
           [-0.2012, 0.8897, 0.0263, 0.9401, 0.2074, 0.9463, 0.3481, 0.9343],
           [-1.7057, 0.6271, -1.2145, 1.3897, -0.6303, 1.7647, -0.1173, 1.8985],
           [-2.1731, -1.6397, -2.7358, 0.2854, -2.1840, 1.7183, -1.3018, 2.4871],
           [0.2717, -3.6173, -2.9206, -2.1988, -3.6638, 0.3858, -2.9155, 2.2980],
           [3.9859, -2.1580, -0.7984, -4.4904, -4.1181, -2.0252, -4.4782, 1.1253],
       ])
   lowerCamelCase__:      Union[str, Any]			  =tf.constant(
       [
           [0.0000, -0.0100, -0.0200, -0.0300, -0.0400, -0.0500, -0.0600, -0.0700],
           [0.2012, -0.8897, -0.0263, -0.9401, -0.2074, -0.9463, -0.3481, -0.9343],
           [1.7057, -0.6271, 1.2145, -1.3897, 0.6303, -1.7647, 0.1173, -1.8985],
           [2.1731, 1.6397, 2.7358, -0.2854, 2.1840, -1.7183, 1.3018, -2.4871],
           [-0.2717, 3.6173, 2.9206, 2.1988, 3.6638, -0.3858, 2.9155, -2.2980],
           [-3.9859, 2.1580, 0.7984, 4.4904, 4.1181, 2.0252, 4.4782, -1.1253],
       ])

   tf.debugging.assert_near(query_layer[0, 0, :6, :8]       , UpperCAmelCase_       , atol=self.tolerance)
   tf.debugging.assert_near(key_layer[0, 0, :6, :8]       , UpperCAmelCase_       , atol=self.tolerance)








from typing import TYPE_CHECKING

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


__A									=				{
    "configuration_distilbert": [
        "DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "DistilBertConfig",
        "DistilBertOnnxConfig",
    ],
    "tokenization_distilbert": ["DistilBertTokenizer"],
}

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

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     __A									=				[
         "DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
         "DistilBertForMaskedLM",
         "DistilBertForMultipleChoice",
         "DistilBertForQuestionAnswering",
         "DistilBertForSequenceClassification",
         "DistilBertForTokenClassification",
         "DistilBertModel",
         "DistilBertPreTrainedModel",
     ]

try:
     if not is_tf_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     __A									=				[
         "TF_DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
         "TFDistilBertForMaskedLM",
         "TFDistilBertForMultipleChoice",
         "TFDistilBertForQuestionAnswering",
         "TFDistilBertForSequenceClassification",
         "TFDistilBertForTokenClassification",
         "TFDistilBertMainLayer",
         "TFDistilBertModel",
         "TFDistilBertPreTrainedModel",
     ]

try:
     if not is_flax_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     __A									=				[
         "FlaxDistilBertForMaskedLM",
         "FlaxDistilBertForMultipleChoice",
         "FlaxDistilBertForQuestionAnswering",
         "FlaxDistilBertForSequenceClassification",
         "FlaxDistilBertForTokenClassification",
         "FlaxDistilBertModel",
         "FlaxDistilBertPreTrainedModel",
     ]


if TYPE_CHECKING:
     from .configuration_distilbert import (
         DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
         DistilBertConfig,
         DistilBertOnnxConfig,
     )
     from .tokenization_distilbert import DistilBertTokenizer

     try:
          if not is_tokenizers_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .tokenization_distilbert_fast import DistilBertTokenizerFast

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_distilbert import (
              DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
              DistilBertForMaskedLM,
              DistilBertForMultipleChoice,
              DistilBertForQuestionAnswering,
              DistilBertForSequenceClassification,
              DistilBertForTokenClassification,
              DistilBertModel,
              DistilBertPreTrainedModel,
          )

     try:
          if not is_tf_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_tf_distilbert import (
              TF_DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
              TFDistilBertForMaskedLM,
              TFDistilBertForMultipleChoice,
              TFDistilBertForQuestionAnswering,
              TFDistilBertForSequenceClassification,
              TFDistilBertForTokenClassification,
              TFDistilBertMainLayer,
              TFDistilBertModel,
              TFDistilBertPreTrainedModel,
          )

     try:
          if not is_flax_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_flax_distilbert import (
              FlaxDistilBertForMaskedLM,
              FlaxDistilBertForMultipleChoice,
              FlaxDistilBertForQuestionAnswering,
              FlaxDistilBertForSequenceClassification,
              FlaxDistilBertForTokenClassification,
              FlaxDistilBertModel,
              FlaxDistilBertPreTrainedModel,
          )

else:
     import sys

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

