



"""simple docstring"""
import unittest

from transformers import MobileBertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
   import torch

   from transformers import (
       MODEL_FOR_PRETRAINING_MAPPING,
       MobileBertForMaskedLM,
       MobileBertForMultipleChoice,
       MobileBertForNextSentencePrediction,
       MobileBertForPreTraining,
       MobileBertForQuestionAnswering,
       MobileBertForSequenceClassification,
       MobileBertForTokenClassification,
       MobileBertModel,
   )
class 					a	:



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


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Tuple     			=parent
     SCREAMING_SNAKE_CASE_: Any     			=batch_size
     SCREAMING_SNAKE_CASE_: str     			=seq_length
     SCREAMING_SNAKE_CASE_: Union[str, Any]     			=is_training
     SCREAMING_SNAKE_CASE_: Any     			=use_input_mask
     SCREAMING_SNAKE_CASE_: Dict     			=use_token_type_ids
     SCREAMING_SNAKE_CASE_: Any     			=use_labels
     SCREAMING_SNAKE_CASE_: List[Any]     			=vocab_size
     SCREAMING_SNAKE_CASE_: int     			=hidden_size
     SCREAMING_SNAKE_CASE_: int     			=embedding_size
     SCREAMING_SNAKE_CASE_: str     			=num_hidden_layers
     SCREAMING_SNAKE_CASE_: Optional[Any]     			=num_attention_heads
     SCREAMING_SNAKE_CASE_: List[Any]     			=intermediate_size
     SCREAMING_SNAKE_CASE_: Optional[int]     			=hidden_act
     SCREAMING_SNAKE_CASE_: List[Any]     			=hidden_dropout_prob
     SCREAMING_SNAKE_CASE_: str     			=attention_probs_dropout_prob
     SCREAMING_SNAKE_CASE_: Union[str, Any]     			=max_position_embeddings
     SCREAMING_SNAKE_CASE_: Dict     			=type_vocab_size
     SCREAMING_SNAKE_CASE_: List[str]     			=type_sequence_label_size
     SCREAMING_SNAKE_CASE_: List[Any]     			=initializer_range
     SCREAMING_SNAKE_CASE_: Optional[Any]     			=num_labels
     SCREAMING_SNAKE_CASE_: Any     			=num_choices
     SCREAMING_SNAKE_CASE_: List[str]     			=scope



  def 	lowerCamelCase__       (						self :					Optional[int]		)     ->					List[str]:


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: str     			=ids_tensor([self.batch_size, self.seq_length]       ,		self.vocab_size		)

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

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

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

     SCREAMING_SNAKE_CASE_: List[str]     			=self.get_config()

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



  def 	lowerCamelCase__       (						self :					List[Any]		)     ->					int:


     '''simple docstring'''




     return MobileBertConfig(
         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       ,		embedding_size=self.embedding_size       ,		hidden_act=self.hidden_act       ,		hidden_dropout_prob=self.hidden_dropout_prob       ,		attention_probs_dropout_prob=self.attention_probs_dropout_prob       ,		max_position_embeddings=self.max_position_embeddings       ,		type_vocab_size=self.type_vocab_size       ,		is_decoder=lowerCAmelCase       ,		initializer_range=self.initializer_range       ,		)



  def 	lowerCamelCase__       (						self :					Any       ,		lowerCAmelCase :					Optional[Any]       ,		lowerCAmelCase :					Tuple       ,		lowerCAmelCase :					Union[str, Any]       ,		lowerCAmelCase :					Optional[int]       ,		lowerCAmelCase :					Any       ,		lowerCAmelCase :					Union[str, Any]       ,		lowerCAmelCase :					Tuple		)     ->					int:


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Dict     			=MobileBertModel(config=lowerCAmelCase		)
     model.to(lowerCAmelCase		)
     model.eval()
     SCREAMING_SNAKE_CASE_: Any     			=model(lowerCAmelCase       ,		attention_mask=lowerCAmelCase       ,		token_type_ids=lowerCAmelCase		)
     SCREAMING_SNAKE_CASE_: str     			=model(lowerCAmelCase       ,		token_type_ids=lowerCAmelCase		)
     SCREAMING_SNAKE_CASE_: Any     			=model(lowerCAmelCase		)

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



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


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Union[str, Any]     			=MobileBertForMaskedLM(config=lowerCAmelCase		)
     model.to(lowerCAmelCase		)
     model.eval()
     SCREAMING_SNAKE_CASE_: List[str]     			=model(lowerCAmelCase       ,		attention_mask=lowerCAmelCase       ,		token_type_ids=lowerCAmelCase       ,		labels=lowerCAmelCase		)
     self.parent.assertEqual(result.logits.shape       ,		(self.batch_size, self.seq_length, self.vocab_size)		)



  def 	lowerCamelCase__       (						self :					Optional[int]       ,		lowerCAmelCase :					Dict       ,		lowerCAmelCase :					Any       ,		lowerCAmelCase :					Any       ,		lowerCAmelCase :					Optional[Any]       ,		lowerCAmelCase :					Tuple       ,		lowerCAmelCase :					Tuple       ,		lowerCAmelCase :					List[Any]		)     ->					List[str]:


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Tuple     			=MobileBertForNextSentencePrediction(config=lowerCAmelCase		)
     model.to(lowerCAmelCase		)
     model.eval()
     SCREAMING_SNAKE_CASE_: List[Any]     			=model(
         lowerCAmelCase       ,		attention_mask=lowerCAmelCase       ,		token_type_ids=lowerCAmelCase       ,		labels=lowerCAmelCase       ,		)
     self.parent.assertEqual(result.logits.shape       ,		(self.batch_size, 2)		)



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


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Optional[Any]     			=MobileBertForPreTraining(config=lowerCAmelCase		)
     model.to(lowerCAmelCase		)
     model.eval()
     SCREAMING_SNAKE_CASE_: List[Any]     			=model(
         lowerCAmelCase       ,		attention_mask=lowerCAmelCase       ,		token_type_ids=lowerCAmelCase       ,		labels=lowerCAmelCase       ,		next_sentence_label=lowerCAmelCase       ,		)
     self.parent.assertEqual(result.prediction_logits.shape       ,		(self.batch_size, self.seq_length, self.vocab_size)		)
     self.parent.assertEqual(result.seq_relationship_logits.shape       ,		(self.batch_size, 2)		)



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


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Tuple     			=MobileBertForQuestionAnswering(config=lowerCAmelCase		)
     model.to(lowerCAmelCase		)
     model.eval()
     SCREAMING_SNAKE_CASE_: Union[str, Any]     			=model(
         lowerCAmelCase       ,		attention_mask=lowerCAmelCase       ,		token_type_ids=lowerCAmelCase       ,		start_positions=lowerCAmelCase       ,		end_positions=lowerCAmelCase       ,		)
     self.parent.assertEqual(result.start_logits.shape       ,		(self.batch_size, self.seq_length)		)
     self.parent.assertEqual(result.end_logits.shape       ,		(self.batch_size, self.seq_length)		)



  def 	lowerCamelCase__       (						self :					List[Any]       ,		lowerCAmelCase :					Dict       ,		lowerCAmelCase :					Union[str, Any]       ,		lowerCAmelCase :					Optional[Any]       ,		lowerCAmelCase :					Optional[int]       ,		lowerCAmelCase :					Any       ,		lowerCAmelCase :					List[str]       ,		lowerCAmelCase :					Tuple		)     ->					Tuple:


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Optional[Any]     			=self.num_labels
     SCREAMING_SNAKE_CASE_: List[Any]     			=MobileBertForSequenceClassification(lowerCAmelCase		)
     model.to(lowerCAmelCase		)
     model.eval()
     SCREAMING_SNAKE_CASE_: List[Any]     			=model(lowerCAmelCase       ,		attention_mask=lowerCAmelCase       ,		token_type_ids=lowerCAmelCase       ,		labels=lowerCAmelCase		)
     self.parent.assertEqual(result.logits.shape       ,		(self.batch_size, self.num_labels)		)



  def 	lowerCamelCase__       (						self :					Optional[int]       ,		lowerCAmelCase :					Union[str, Any]       ,		lowerCAmelCase :					Dict       ,		lowerCAmelCase :					int       ,		lowerCAmelCase :					Optional[int]       ,		lowerCAmelCase :					Tuple       ,		lowerCAmelCase :					Optional[Any]       ,		lowerCAmelCase :					Tuple		)     ->					Union[str, Any]:


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Optional[Any]     			=self.num_labels
     SCREAMING_SNAKE_CASE_: Union[str, Any]     			=MobileBertForTokenClassification(config=lowerCAmelCase		)
     model.to(lowerCAmelCase		)
     model.eval()
     SCREAMING_SNAKE_CASE_: Dict     			=model(lowerCAmelCase       ,		attention_mask=lowerCAmelCase       ,		token_type_ids=lowerCAmelCase       ,		labels=lowerCAmelCase		)
     self.parent.assertEqual(result.logits.shape       ,		(self.batch_size, self.seq_length, self.num_labels)		)



  def 	lowerCamelCase__       (						self :					Any       ,		lowerCAmelCase :					Optional[Any]       ,		lowerCAmelCase :					Tuple       ,		lowerCAmelCase :					Any       ,		lowerCAmelCase :					int       ,		lowerCAmelCase :					Any       ,		lowerCAmelCase :					str       ,		lowerCAmelCase :					Any		)     ->					Tuple:


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Tuple     			=self.num_choices
     SCREAMING_SNAKE_CASE_: Union[str, Any]     			=MobileBertForMultipleChoice(config=lowerCAmelCase		)
     model.to(lowerCAmelCase		)
     model.eval()
     SCREAMING_SNAKE_CASE_: str     			=input_ids.unsqueeze(1		).expand(-1       ,		self.num_choices       ,		-1		).contiguous()
     SCREAMING_SNAKE_CASE_: Any     			=token_type_ids.unsqueeze(1		).expand(-1       ,		self.num_choices       ,		-1		).contiguous()
     SCREAMING_SNAKE_CASE_: List[str]     			=input_mask.unsqueeze(1		).expand(-1       ,		self.num_choices       ,		-1		).contiguous()
     SCREAMING_SNAKE_CASE_: Optional[Any]     			=model(
         lowerCAmelCase       ,		attention_mask=lowerCAmelCase       ,		token_type_ids=lowerCAmelCase       ,		labels=lowerCAmelCase       ,		)
     self.parent.assertEqual(result.logits.shape       ,		(self.batch_size, self.num_choices)		)





  def 	lowerCamelCase__       (						self :					str		)     ->					Any:


     '''simple docstring'''




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







@require_torch
class 					a	(  __UpperCAmelCase	,      __UpperCAmelCase	,      unittest.TestCase       ):
  UpperCamelCase	:				Union[str, Any]     						=					(
      (
          MobileBertModel,
          MobileBertForMaskedLM,
          MobileBertForMultipleChoice,
          MobileBertForNextSentencePrediction,
          MobileBertForPreTraining,
          MobileBertForQuestionAnswering,
          MobileBertForSequenceClassification,
          MobileBertForTokenClassification,
      )
      if is_torch_available()
      else ()
  )
  UpperCamelCase	:				List[str]     						=					(
      {
          'feature-extraction': MobileBertModel,
          'fill-mask': MobileBertForMaskedLM,
          'question-answering': MobileBertForQuestionAnswering,
          'text-classification': MobileBertForSequenceClassification,
          'token-classification': MobileBertForTokenClassification,
          'zero-shot': MobileBertForSequenceClassification,
      }
      if is_torch_available()
      else {}
  )
  UpperCamelCase	:				int     						=					True



  def 	lowerCamelCase__       (						self :					List[Any]       ,		lowerCAmelCase :					List[str]       ,		lowerCAmelCase :					List[Any]       ,		lowerCAmelCase :					Any=False		)     ->					Dict:


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Optional[int]     			=super()._prepare_for_class(lowerCAmelCase       ,		lowerCAmelCase       ,		return_labels=lowerCAmelCase		)

     if return_labels:
        if model_class in get_values(lowerCAmelCase		):
           SCREAMING_SNAKE_CASE_: Tuple     			=torch.zeros(
               (self.model_tester.batch_size, self.model_tester.seq_length)       ,		dtype=torch.long       ,		device=lowerCAmelCase		)
           SCREAMING_SNAKE_CASE_: int     			=torch.zeros(
               self.model_tester.batch_size       ,		dtype=torch.long       ,		device=lowerCAmelCase		)
     return inputs_dict



  def 	lowerCamelCase__       (						self :					int		)     ->					str:


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Optional[int]     			=MobileBertModelTester(self		)
     SCREAMING_SNAKE_CASE_: int     			=ConfigTester(self       ,		config_class=lowerCAmelCase       ,		hidden_size=37		)



  def 	lowerCamelCase__       (						self :					str		)     ->					Optional[Any]:


     '''simple docstring'''




     self.config_tester.run_common_tests()



  def 	lowerCamelCase__       (						self :					List[str]		)     ->					Union[str, Any]:


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Union[str, Any]     			=self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_model(*lowerCAmelCase		)



  def 	lowerCamelCase__       (						self :					Dict		)     ->					Union[str, Any]:


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Union[str, Any]     			=self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_for_masked_lm(*lowerCAmelCase		)



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


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Optional[Any]     			=self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_for_multiple_choice(*lowerCAmelCase		)



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


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Optional[Any]     			=self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_for_next_sequence_prediction(*lowerCAmelCase		)



  def 	lowerCamelCase__       (						self :					int		)     ->					Any:


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Union[str, Any]     			=self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_for_pretraining(*lowerCAmelCase		)



  def 	lowerCamelCase__       (						self :					Tuple		)     ->					int:


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: List[str]     			=self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_for_question_answering(*lowerCAmelCase		)



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


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Dict     			=self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_for_sequence_classification(*lowerCAmelCase		)





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


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: int     			=self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_for_token_classification(*lowerCAmelCase		)







def      __magic_name__				(							lowercase ):
   return torch.tensor(
       lowercase							,			dtype=torch.long							,			device=lowercase							,			)


_UpperCAmelCase     =   1e-3
@require_torch
@require_sentencepiece
@require_tokenizers
class 					a	(  unittest.TestCase       ):



  @slow
  def 	lowerCamelCase__       (						self :					Dict		)     ->					int:


     '''simple docstring'''




     SCREAMING_SNAKE_CASE_: Any     			=MobileBertModel.from_pretrained("""google/mobilebert-uncased"""		).to(lowerCAmelCase		)
     SCREAMING_SNAKE_CASE_: Dict     			=_long_tensor([[101, 7110, 1005, 1056, 2023, 1_1333, 1_7413, 1029, 102]]		)
     with torch.no_grad():
        SCREAMING_SNAKE_CASE_: List[str]     			=model(lowerCAmelCase		)[0]
     SCREAMING_SNAKE_CASE_: Dict     			=torch.Size((1, 9, 512)		)
     self.assertEqual(output.shape       ,		lowerCAmelCase		)
     SCREAMING_SNAKE_CASE_: int     			=torch.tensor(
         [
             [
                 [-2.4_736_526E07, 8.2_691_656E04, 1.6_521_838E05],
                 [-5.7_541_704E-01, 3.9_056_022E00, 4.4_011_507E00],
                 [2.6_047_359E00, 1.5_677_652E00, -1.7_324_188E-01],
             ]
         ]       ,		device=lowerCAmelCase       ,		)

     # MobileBERT results range from 10e0 to 10e8. Even a 0.0000001% difference with a value of 10e8 results in a
     # ~1 difference, it's therefore not a good idea to measure using addition.
     # Here, we instead divide the expected result with the result in order to obtain ~1. We then check that the
     # result is held between bounds: 1 - TOLERANCE < expected_result / result < 1 + TOLERANCE
     SCREAMING_SNAKE_CASE_: List[Any]     			=torch.all((expected_slice / output[..., :3, :3]) >= 1 - TOLERANCE		)
     SCREAMING_SNAKE_CASE_: int     			=torch.all((expected_slice / output[..., :3, :3]) <= 1 + TOLERANCE		)

     self.assertTrue(lower_bound and upper_bound		)








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

from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available
from ...utils import OptionalDependencyNotAvailable


_UpperCAmelCase     =			{"""configuration_dpt""": ["""DPT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """DPTConfig"""]}

try:
   if not is_vision_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _UpperCAmelCase     =			["""DPTFeatureExtractor"""]
   _UpperCAmelCase     =			["""DPTImageProcessor"""]

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _UpperCAmelCase     =			[
       """DPT_PRETRAINED_MODEL_ARCHIVE_LIST""",
       """DPTForDepthEstimation""",
       """DPTForSemanticSegmentation""",
       """DPTModel""",
       """DPTPreTrainedModel""",
   ]


if TYPE_CHECKING:
   from .configuration_dpt import DPT_PRETRAINED_CONFIG_ARCHIVE_MAP, DPTConfig

   try:
      if not is_vision_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .feature_extraction_dpt import DPTFeatureExtractor
      from .image_processing_dpt import DPTImageProcessor

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_dpt import (
          DPT_PRETRAINED_MODEL_ARCHIVE_LIST,
          DPTForDepthEstimation,
          DPTForSemanticSegmentation,
          DPTModel,
          DPTPreTrainedModel,
      )


else:
   import sys

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



