DoruC/Grounded-Segment-Anything
0
1# Copyright 2022 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.14 15from typing import TYPE_CHECKING16 17from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available18 19 20_import_structure = {21 "configuration_data2vec_audio": ["DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP", "Data2VecAudioConfig"],22 "configuration_data2vec_text": [23 "DATA2VEC_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP",24 "Data2VecTextConfig",25 "Data2VecTextOnnxConfig",26 ],27 "configuration_data2vec_vision": [28 "DATA2VEC_VISION_PRETRAINED_CONFIG_ARCHIVE_MAP",29 "Data2VecVisionConfig",30 "Data2VecVisionOnnxConfig",31 ],32}33 34try:35 if not is_torch_available():36 raise OptionalDependencyNotAvailable()37except OptionalDependencyNotAvailable:38 pass39else:40 _import_structure["modeling_data2vec_audio"] = [41 "DATA2VEC_AUDIO_PRETRAINED_MODEL_ARCHIVE_LIST",42 "Data2VecAudioForAudioFrameClassification",43 "Data2VecAudioForCTC",44 "Data2VecAudioForSequenceClassification",45 "Data2VecAudioForXVector",46 "Data2VecAudioModel",47 "Data2VecAudioPreTrainedModel",48 ]49 _import_structure["modeling_data2vec_text"] = [50 "DATA2VEC_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST",51 "Data2VecTextForCausalLM",52 "Data2VecTextForMaskedLM",53 "Data2VecTextForMultipleChoice",54 "Data2VecTextForQuestionAnswering",55 "Data2VecTextForSequenceClassification",56 "Data2VecTextForTokenClassification",57 "Data2VecTextModel",58 "Data2VecTextPreTrainedModel",59 ]60 _import_structure["modeling_data2vec_vision"] = [61 "DATA2VEC_VISION_PRETRAINED_MODEL_ARCHIVE_LIST",62 "Data2VecVisionForImageClassification",63 "Data2VecVisionForMaskedImageModeling",64 "Data2VecVisionForSemanticSegmentation",65 "Data2VecVisionModel",66 "Data2VecVisionPreTrainedModel",67 ]68 69if is_tf_available():70 _import_structure["modeling_tf_data2vec_vision"] = [71 "TFData2VecVisionForImageClassification",72 "TFData2VecVisionForSemanticSegmentation",73 "TFData2VecVisionModel",74 "TFData2VecVisionPreTrainedModel",75 ]76 77if TYPE_CHECKING:78 from .configuration_data2vec_audio import DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP, Data2VecAudioConfig79 from .configuration_data2vec_text import (80 DATA2VEC_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP,81 Data2VecTextConfig,82 Data2VecTextOnnxConfig,83 )84 from .configuration_data2vec_vision import (85 DATA2VEC_VISION_PRETRAINED_CONFIG_ARCHIVE_MAP,86 Data2VecVisionConfig,87 Data2VecVisionOnnxConfig,88 )89 90 try:91 if not is_torch_available():92 raise OptionalDependencyNotAvailable()93 except OptionalDependencyNotAvailable:94 pass95 else:96 from .modeling_data2vec_audio import (97 DATA2VEC_AUDIO_PRETRAINED_MODEL_ARCHIVE_LIST,98 Data2VecAudioForAudioFrameClassification,99 Data2VecAudioForCTC,100 Data2VecAudioForSequenceClassification,101 Data2VecAudioForXVector,102 Data2VecAudioModel,103 Data2VecAudioPreTrainedModel,104 )105 from .modeling_data2vec_text import (106 DATA2VEC_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST,107 Data2VecTextForCausalLM,108 Data2VecTextForMaskedLM,109 Data2VecTextForMultipleChoice,110 Data2VecTextForQuestionAnswering,111 Data2VecTextForSequenceClassification,112 Data2VecTextForTokenClassification,113 Data2VecTextModel,114 Data2VecTextPreTrainedModel,115 )116 from .modeling_data2vec_vision import (117 DATA2VEC_VISION_PRETRAINED_MODEL_ARCHIVE_LIST,118 Data2VecVisionForImageClassification,119 Data2VecVisionForMaskedImageModeling,120 Data2VecVisionForSemanticSegmentation,121 Data2VecVisionModel,122 Data2VecVisionPreTrainedModel,123 )124 if is_tf_available():125 from .modeling_tf_data2vec_vision import (126 TFData2VecVisionForImageClassification,127 TFData2VecVisionForSemanticSegmentation,128 TFData2VecVisionModel,129 TFData2VecVisionPreTrainedModel,130 )131 132else:133 import sys134 135 sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)136 