DoruC/Grounded-Segment-Anything
0
1# Copyright 2021 The HuggingFace Team. All rights reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14from typing import TYPE_CHECKING15 16from ...utils import (17 OptionalDependencyNotAvailable,18 _LazyModule,19 is_tf_available,20 is_torch_available,21 is_vision_available,22)23 24 25_import_structure = {"configuration_deit": ["DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "DeiTConfig", "DeiTOnnxConfig"]}26 27try:28 if not is_vision_available():29 raise OptionalDependencyNotAvailable()30except OptionalDependencyNotAvailable:31 pass32else:33 _import_structure["feature_extraction_deit"] = ["DeiTFeatureExtractor"]34 _import_structure["image_processing_deit"] = ["DeiTImageProcessor"]35 36try:37 if not is_torch_available():38 raise OptionalDependencyNotAvailable()39except OptionalDependencyNotAvailable:40 pass41else:42 _import_structure["modeling_deit"] = [43 "DEIT_PRETRAINED_MODEL_ARCHIVE_LIST",44 "DeiTForImageClassification",45 "DeiTForImageClassificationWithTeacher",46 "DeiTForMaskedImageModeling",47 "DeiTModel",48 "DeiTPreTrainedModel",49 ]50 51try:52 if not is_tf_available():53 raise OptionalDependencyNotAvailable()54except OptionalDependencyNotAvailable:55 pass56else:57 _import_structure["modeling_tf_deit"] = [58 "TF_DEIT_PRETRAINED_MODEL_ARCHIVE_LIST",59 "TFDeiTForImageClassification",60 "TFDeiTForImageClassificationWithTeacher",61 "TFDeiTForMaskedImageModeling",62 "TFDeiTModel",63 "TFDeiTPreTrainedModel",64 ]65 66 67if TYPE_CHECKING:68 from .configuration_deit import DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP, DeiTConfig, DeiTOnnxConfig69 70 try:71 if not is_vision_available():72 raise OptionalDependencyNotAvailable()73 except OptionalDependencyNotAvailable:74 pass75 else:76 from .feature_extraction_deit import DeiTFeatureExtractor77 from .image_processing_deit import DeiTImageProcessor78 79 try:80 if not is_torch_available():81 raise OptionalDependencyNotAvailable()82 except OptionalDependencyNotAvailable:83 pass84 else:85 from .modeling_deit import (86 DEIT_PRETRAINED_MODEL_ARCHIVE_LIST,87 DeiTForImageClassification,88 DeiTForImageClassificationWithTeacher,89 DeiTForMaskedImageModeling,90 DeiTModel,91 DeiTPreTrainedModel,92 )93 94 try:95 if not is_tf_available():96 raise OptionalDependencyNotAvailable()97 except OptionalDependencyNotAvailable:98 pass99 else:100 from .modeling_tf_deit import (101 TF_DEIT_PRETRAINED_MODEL_ARCHIVE_LIST,102 TFDeiTForImageClassification,103 TFDeiTForImageClassificationWithTeacher,104 TFDeiTForMaskedImageModeling,105 TFDeiTModel,106 TFDeiTPreTrainedModel,107 )108 109 110else:111 import sys112 113 sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)114 