



"""simple docstring"""
import inspect
import unittest
from typing import List

import numpy as np

from transformers import EfficientFormerConfig
from transformers.testing_utils import require_tf, require_vision, slow
from transformers.utils import cached_property, is_tf_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
      import tensorflow as tf

      from transformers import (
          TFEfficientFormerForImageClassification,
          TFEfficientFormerForImageClassificationWithTeacher,
          TFEfficientFormerModel,
      )
      from transformers.models.efficientformer.modeling_tf_efficientformer import (
          TF_EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
      )


if is_vision_available():
      from PIL import Image

      from transformers import EfficientFormerImageProcessor



class       SCREAMING_SNAKE_CASE__  :

   def __init__(   self      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE = 13      ,     _SCREAMING_SNAKE_CASE = 64      ,     _SCREAMING_SNAKE_CASE = 2      ,     _SCREAMING_SNAKE_CASE = 3      ,     _SCREAMING_SNAKE_CASE = 3      ,     _SCREAMING_SNAKE_CASE = True      ,     _SCREAMING_SNAKE_CASE = True      ,     _SCREAMING_SNAKE_CASE = 128      ,     _SCREAMING_SNAKE_CASE=[16, 32, 64, 128]      ,     _SCREAMING_SNAKE_CASE = 7      ,     _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 = 10      ,     _SCREAMING_SNAKE_CASE = 0.02      ,     _SCREAMING_SNAKE_CASE = 2      ,     _SCREAMING_SNAKE_CASE = 1      ,     _SCREAMING_SNAKE_CASE = 128      ,     _SCREAMING_SNAKE_CASE = [2, 2, 2, 2]      ,     _SCREAMING_SNAKE_CASE = 2      ,     _SCREAMING_SNAKE_CASE = 2      ,     )  ->      Union[str, Any]:





    '''simple docstring'''




    UpperCAmelCase	:					Tuple	=	parent
    UpperCAmelCase	:					Optional[int]	=	batch_size
    UpperCAmelCase	:					Any	=	image_size
    UpperCAmelCase	:					Tuple	=	patch_size
    UpperCAmelCase	:					int	=	num_channels
    UpperCAmelCase	:					List[Any]	=	is_training
    UpperCAmelCase	:					List[Any]	=	use_labels
    UpperCAmelCase	:					Dict	=	hidden_size
    UpperCAmelCase	:					Optional[Any]	=	num_hidden_layers
    UpperCAmelCase	:					Union[str, Any]	=	num_attention_heads
    UpperCAmelCase	:					List[str]	=	intermediate_size
    UpperCAmelCase	:					Dict	=	hidden_act
    UpperCAmelCase	:					int	=	hidden_dropout_prob
    UpperCAmelCase	:					Dict	=	attention_probs_dropout_prob
    UpperCAmelCase	:					Any	=	type_sequence_label_size
    UpperCAmelCase	:					List[Any]	=	initializer_range
    UpperCAmelCase	:					Union[str, Any]	=	encoder_stride
    UpperCAmelCase	:					Dict	=	num_attention_outputs
    UpperCAmelCase	:					List[str]	=	embed_dim
    UpperCAmelCase	:					int	=	embed_dim + 1
    UpperCAmelCase	:					Union[str, Any]	=	resolution
    UpperCAmelCase	:					Any	=	depths
    UpperCAmelCase	:					int	=	hidden_sizes
    UpperCAmelCase	:					List[str]	=	dim
    UpperCAmelCase	:					Optional[Any]	=	mlp_expansion_ratio

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





    '''simple docstring'''




    UpperCAmelCase	:					List[str]	=	floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]						)

    UpperCAmelCase	:					Dict	=	None
    if self.use_labels:
     UpperCAmelCase	:					Dict	=	ids_tensor([self.batch_size]      ,     self.type_sequence_label_size						)

    UpperCAmelCase	:					Any	=	self.get_config()

    return config, pixel_values, labels

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





    '''simple docstring'''




    return EfficientFormerConfig(
        image_size=self.image_size      ,     patch_size=self.patch_size      ,     num_channels=self.num_channels      ,     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      ,     is_decoder=_SCREAMING_SNAKE_CASE      ,     initializer_range=self.initializer_range      ,     encoder_stride=self.encoder_stride      ,     resolution=self.resolution      ,     depths=self.depths      ,     hidden_sizes=self.hidden_sizes      ,     dim=self.dim      ,     mlp_expansion_ratio=self.mlp_expansion_ratio      ,     )

   def 	SCREAMING_SNAKE_CASE     (   self      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						)  ->      Union[str, Any]:





    '''simple docstring'''




    UpperCAmelCase	:					Optional[int]	=	TFEfficientFormerModel(config=_SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					Any	=	model(_SCREAMING_SNAKE_CASE      ,     training=_SCREAMING_SNAKE_CASE						)
    self.parent.assertEqual(result.last_hidden_state.shape      ,     (self.batch_size, self.seq_length, self.hidden_size)						)

   def 	SCREAMING_SNAKE_CASE     (   self      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						)  ->      Dict:





    '''simple docstring'''




    UpperCAmelCase	:					Any	=	self.type_sequence_label_size
    UpperCAmelCase	:					Optional[Any]	=	TFEfficientFormerForImageClassification(_SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					Dict	=	model(_SCREAMING_SNAKE_CASE      ,     labels=_SCREAMING_SNAKE_CASE      ,     training=_SCREAMING_SNAKE_CASE						)
    self.parent.assertEqual(result.logits.shape      ,     (self.batch_size, self.type_sequence_label_size)						)

    # test greyscale images
    UpperCAmelCase	:					List[str]	=	1
    UpperCAmelCase	:					Optional[Any]	=	TFEfficientFormerForImageClassification(_SCREAMING_SNAKE_CASE						)

    UpperCAmelCase	:					Dict	=	floats_tensor([self.batch_size, 1, self.image_size, self.image_size]						)
    UpperCAmelCase	:					Dict	=	model(_SCREAMING_SNAKE_CASE      ,     labels=_SCREAMING_SNAKE_CASE						)
    self.parent.assertEqual(result.logits.shape      ,     (self.batch_size, self.type_sequence_label_size)						)




   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      Dict:





    '''simple docstring'''




    UpperCAmelCase	:					List[str]	=	self.prepare_config_and_inputs()
    UpperCAmelCase	,		UpperCAmelCase	,		UpperCAmelCase	:					Tuple	=	config_and_inputs
    UpperCAmelCase	:					List[str]	=	{"""pixel_values""": pixel_values}
    return config, inputs_dict



@require_tf
class       SCREAMING_SNAKE_CASE__  (					UpperCAmelCase__      ,			UpperCAmelCase__      ,			unittest.TestCase ):
   __lowerCAmelCase  :   Optional[int]						=						(
       (
           TFEfficientFormerModel,
           TFEfficientFormerForImageClassificationWithTeacher,
           TFEfficientFormerForImageClassification,
       )
       if is_tf_available()
       else ()
   )
   __lowerCAmelCase  :   Optional[int]						=						(
       {
           'feature-extraction': TFEfficientFormerModel,
           'image-classification': (
               TFEfficientFormerForImageClassification,
               TFEfficientFormerForImageClassificationWithTeacher,
           ),
       }
       if is_tf_available()
       else {}
   )

   __lowerCAmelCase  :   Any						=						False

   __lowerCAmelCase  :   str						=						False
   __lowerCAmelCase  :   Union[str, Any]						=						False
   __lowerCAmelCase  :   Dict						=						False
   __lowerCAmelCase  :   Tuple						=						False

   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      Any:





    '''simple docstring'''




    UpperCAmelCase	:					Optional[Any]	=	TFEfficientFormerModelTester(self						)
    UpperCAmelCase	:					List[str]	=	ConfigTester(
        self      ,     config_class=_SCREAMING_SNAKE_CASE      ,     has_text_modality=_SCREAMING_SNAKE_CASE      ,     hidden_size=37						)

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





    '''simple docstring'''




    self.config_tester.run_common_tests()

   @unittest.skip(reason="""EfficientFormer does not use inputs_embeds"""						)
   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      Dict:





    '''simple docstring'''




    pass

   @unittest.skip(reason="""EfficientFormer does not support input and output embeddings"""						)
   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      int:





    '''simple docstring'''




    pass

   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      Tuple:





    '''simple docstring'''




    UpperCAmelCase	,		UpperCAmelCase	:					Dict	=	self.model_tester.prepare_config_and_inputs_for_common()

    for model_class in self.all_model_classes:
     UpperCAmelCase	:					Any	=	model_class(_SCREAMING_SNAKE_CASE						)
     UpperCAmelCase	:					List[str]	=	inspect.signature(model.call						)
     # signature.parameters is an OrderedDict => so arg_names order is deterministic
     UpperCAmelCase	:					Any	=	[*signature.parameters.keys()]

     UpperCAmelCase	:					int	=	["""pixel_values"""]
     self.assertListEqual(arg_names[:1]      ,     _SCREAMING_SNAKE_CASE						)

   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      List[Any]:





    '''simple docstring'''




    def check_hidden_states_output(_SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						):
     UpperCAmelCase	:					Any	=	model_class(_SCREAMING_SNAKE_CASE						)

     UpperCAmelCase	:					int	=	model(**self._prepare_for_class(_SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						)      ,     training=_SCREAMING_SNAKE_CASE						)
     UpperCAmelCase	:					Tuple	=	outputs.encoder_hidden_states if config.is_encoder_decoder else outputs.hidden_states

     UpperCAmelCase	:					Optional[Any]	=	getattr(
         self.model_tester      ,     """expected_num_hidden_layers"""      ,     self.model_tester.num_hidden_layers + 1						)
     self.assertEqual(len(_SCREAMING_SNAKE_CASE						)      ,     _SCREAMING_SNAKE_CASE						)

     if hasattr(self.model_tester      ,     """encoder_seq_length"""						):
      UpperCAmelCase	:					str	=	self.model_tester.encoder_seq_length
      if hasattr(self.model_tester      ,     """chunk_length"""						) and self.model_tester.chunk_length > 1:
       UpperCAmelCase	:					List[Any]	=	seq_length * self.model_tester.chunk_length
     else:
      UpperCAmelCase	:					str	=	self.model_tester.seq_length

     self.assertListEqual(
         list(hidden_states[-1].shape[-2:]						)      ,     [seq_length, self.model_tester.hidden_size]      ,     )

     if config.is_encoder_decoder:
      UpperCAmelCase	:					Dict	=	outputs.decoder_hidden_states

      self.asseretIsInstance(_SCREAMING_SNAKE_CASE      ,     (list, tuple)						)
      self.assertEqual(len(_SCREAMING_SNAKE_CASE						)      ,     _SCREAMING_SNAKE_CASE						)
      UpperCAmelCase	:					Dict	=	getattr(self.model_tester      ,     """seq_length"""      ,     _SCREAMING_SNAKE_CASE						)
      UpperCAmelCase	:					Optional[Any]	=	getattr(self.model_tester      ,     """decoder_seq_length"""      ,     _SCREAMING_SNAKE_CASE						)

      self.assertListEqual(
          list(hidden_states[-1].shape[-2:]						)      ,     [decoder_seq_length, self.model_tester.hidden_size]      ,     )

    UpperCAmelCase	,		UpperCAmelCase	:					str	=	self.model_tester.prepare_config_and_inputs_for_common()

    for model_class in self.all_model_classes:
     UpperCAmelCase	:					Optional[int]	=	True
     check_hidden_states_output(_SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						)

     # check that output_hidden_states also work using config
     del inputs_dict["output_hidden_states"]
     UpperCAmelCase	:					Optional[int]	=	True

     check_hidden_states_output(_SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						)

   def 	SCREAMING_SNAKE_CASE     (   self      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE=False						)  ->      Dict:





    '''simple docstring'''




    UpperCAmelCase	:					Dict	=	super()._prepare_for_class(_SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE      ,     return_labels=_SCREAMING_SNAKE_CASE						)

    if return_labels:
     if model_class.__name__ == "TFEfficientFormerForImageClassificationWithTeacher":
      del inputs_dict["labels"]

    return inputs_dict

   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      int:





    '''simple docstring'''




    UpperCAmelCase	:					Optional[Any]	=	self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_model(*_SCREAMING_SNAKE_CASE						)

   @unittest.skip(reason="""EfficientFormer does not implement masked image modeling yet"""						)
   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      List[Any]:





    '''simple docstring'''




    UpperCAmelCase	:					str	=	self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_for_masked_image_modeling(*_SCREAMING_SNAKE_CASE						)

   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      int:





    '''simple docstring'''




    UpperCAmelCase	:					Optional[int]	=	self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_for_image_classification(*_SCREAMING_SNAKE_CASE						)

   @slow
   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      int:





    '''simple docstring'''




    for model_name in TF_EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
     UpperCAmelCase	:					Optional[Any]	=	TFEfficientFormerModel.from_pretrained(_SCREAMING_SNAKE_CASE						)
     self.assertIsNotNone(_SCREAMING_SNAKE_CASE						)

   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      List[Any]:





    '''simple docstring'''




    UpperCAmelCase	,		UpperCAmelCase	:					List[Any]	=	self.model_tester.prepare_config_and_inputs_for_common()
    UpperCAmelCase	:					Optional[Any]	=	True

    UpperCAmelCase	:					Tuple	=	getattr(self.model_tester      ,     """seq_length"""      ,     _SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					List[Any]	=	getattr(self.model_tester      ,     """encoder_seq_length"""      ,     _SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					Any	=	getattr(self.model_tester      ,     """key_length"""      ,     _SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					int	=	getattr(self.model_tester      ,     """chunk_length"""      ,     _SCREAMING_SNAKE_CASE						)

    if chunk_length is not None and hasattr(self.model_tester      ,     """num_hashes"""						):
     UpperCAmelCase	:					Dict	=	encoder_seq_length * self.model_tester.num_hashes

    for model_class in self.all_model_classes:
     UpperCAmelCase	:					Optional[Any]	=	True
     UpperCAmelCase	:					str	=	False
     UpperCAmelCase	:					List[Any]	=	True
     UpperCAmelCase	:					Union[str, Any]	=	model_class(_SCREAMING_SNAKE_CASE						)

     UpperCAmelCase	:					Dict	=	model(**self._prepare_for_class(_SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						)      ,     training=_SCREAMING_SNAKE_CASE						)
     UpperCAmelCase	:					Tuple	=	outputs.encoder_attentions if config.is_encoder_decoder else outputs.attentions
     self.assertEqual(len(_SCREAMING_SNAKE_CASE						)      ,     self.model_tester.num_attention_outputs						)

     # check that output_attentions also work using config
     del inputs_dict["output_attentions"]
     UpperCAmelCase	:					Optional[Any]	=	True
     UpperCAmelCase	:					Dict	=	model_class(_SCREAMING_SNAKE_CASE						)
     UpperCAmelCase	:					Optional[Any]	=	model(**self._prepare_for_class(_SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						)      ,     training=_SCREAMING_SNAKE_CASE						)

     UpperCAmelCase	:					Union[str, Any]	=	outputs.encoder_attentions if config.is_encoder_decoder else outputs.attentions
     self.assertEqual(len(_SCREAMING_SNAKE_CASE						)      ,     self.model_tester.num_attention_outputs						)

     if chunk_length is not None:
      self.assertListEqual(
          list(attentions[0].shape[-4:]						)      ,     [self.model_tester.num_attention_heads, encoder_seq_length, chunk_length, encoder_key_length]      ,     )
     else:
      self.assertListEqual(
          list(attentions[0].shape[-3:]						)      ,     [self.model_tester.num_attention_heads, encoder_seq_length, encoder_key_length]      ,     )




   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      int:





    '''simple docstring'''




    UpperCAmelCase	,		UpperCAmelCase	:					str	=	self.model_tester.prepare_config_and_inputs_for_common()

    for model_class in self.all_model_classes:
     # Prepare our model
     UpperCAmelCase	:					Tuple	=	model_class(_SCREAMING_SNAKE_CASE						)
     # These are maximally general inputs for the model, with multiple None dimensions
     # Hopefully this will catch any conditionals that fail for flexible shapes
     UpperCAmelCase	:					Optional[int]	=	{
         key: tf.keras.Input(shape=val.shape[1:]      ,     dtype=val.dtype      ,     name=_SCREAMING_SNAKE_CASE						)
         for key, val in model.input_signature.items()
         if key in model.dummy_inputs
     }
     UpperCAmelCase	:					Union[str, Any]	=	model(_SCREAMING_SNAKE_CASE						)
     self.assertTrue(outputs_dict is not None						)

def       _snake_case						(						):
 UpperCAmelCase	:					Tuple	=	Image.open("""./tests/fixtures/tests_samples/COCO/000000039769.png"""						)
 return image



@require_tf
@require_vision
class       SCREAMING_SNAKE_CASE__  (					unittest.TestCase ):

   @cached_property
   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      List[str]:





    '''simple docstring'''




    return (
        EfficientFormerImageProcessor.from_pretrained("""snap-research/efficientformer-l1-300"""						)
        if is_vision_available()
        else None
    )

   @slow
   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      Any:





    '''simple docstring'''




    UpperCAmelCase	:					Any	=	TFEfficientFormerForImageClassification.from_pretrained("""snap-research/efficientformer-l1-300"""						)
    UpperCAmelCase	:					List[str]	=	self.default_image_processor
    UpperCAmelCase	:					Optional[Any]	=	prepare_img()
    UpperCAmelCase	:					str	=	image_processor(images=_SCREAMING_SNAKE_CASE      ,     return_tensors="""tf"""						)
    # forward pass
    UpperCAmelCase	:					List[Any]	=	model(**_SCREAMING_SNAKE_CASE      ,     training=_SCREAMING_SNAKE_CASE						)
    # verify the logits
    UpperCAmelCase	:					str	=	tf.TensorShape((1, 1000)						)
    self.assertEqual(outputs.logits.shape      ,     _SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					Union[str, Any]	=	tf.constant([-0.0555, 0.4825, -0.0852]						)
    self.assertTrue(np.allclose(outputs.logits[0, :3]      ,     _SCREAMING_SNAKE_CASE      ,     atol=1E-4						)						)




   @slow
   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      str:





    '''simple docstring'''




    UpperCAmelCase	:					str	=	TFEfficientFormerForImageClassificationWithTeacher.from_pretrained(
        """snap-research/efficientformer-l1-300"""						)
    UpperCAmelCase	:					str	=	self.default_image_processor
    UpperCAmelCase	:					List[Any]	=	prepare_img()
    UpperCAmelCase	:					List[str]	=	image_processor(images=_SCREAMING_SNAKE_CASE      ,     return_tensors="""tf"""						)
    # forward pass
    UpperCAmelCase	:					List[str]	=	model(**_SCREAMING_SNAKE_CASE      ,     training=_SCREAMING_SNAKE_CASE						)
    # verify the logits
    UpperCAmelCase	:					Dict	=	tf.TensorShape((1, 1000)						)
    self.assertEqual(outputs.logits.shape      ,     _SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					List[Any]	=	tf.constant([-0.1312, 0.4353, -1.0499]						)
    self.assertTrue(np.allclose(outputs.logits[0, :3]      ,     _SCREAMING_SNAKE_CASE      ,     atol=1E-4						)						)





"""simple docstring"""
from typing import TYPE_CHECKING

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


A:   str								=		{
    "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:   Dict								=		["DistilBertTokenizerFast"]

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A:   List[Any]								=		[
          "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:   Dict								=		[
          "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:   int								=		[
          "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:   Optional[int]								=		_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
