Unverified Commit 56b35ce3 authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Make check_init script more robust and clean inits (#17408)

parent bd908e9b
...@@ -27,9 +27,7 @@ from ...utils import ( ...@@ -27,9 +27,7 @@ from ...utils import (
) )
_import_structure = { _import_structure = {"configuration_beit": ["BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BeitConfig", "BeitOnnxConfig"]}
"configuration_beit": ["BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BeitConfig", "BeitOnnxConfig"],
}
try: try:
if not is_vision_available(): if not is_vision_available():
......
...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING ...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available
_import_structure = { _import_structure = {"configuration_bert_generation": ["BertGenerationConfig"]}
"configuration_bert_generation": ["BertGenerationConfig"],
}
try: try:
if not is_sentencepiece_available(): if not is_sentencepiece_available():
......
...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING ...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING
from ...utils import _LazyModule from ...utils import _LazyModule
_import_structure = { _import_structure = {"tokenization_bert_japanese": ["BertJapaneseTokenizer", "CharacterTokenizer", "MecabTokenizer"]}
"tokenization_bert_japanese": ["BertJapaneseTokenizer", "CharacterTokenizer", "MecabTokenizer"],
}
if TYPE_CHECKING: if TYPE_CHECKING:
......
...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING ...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING
from ...utils import _LazyModule from ...utils import _LazyModule
_import_structure = { _import_structure = {"tokenization_bertweet": ["BertweetTokenizer"]}
"tokenization_bertweet": ["BertweetTokenizer"],
}
if TYPE_CHECKING: if TYPE_CHECKING:
......
...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING ...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING
from ...utils import _LazyModule from ...utils import _LazyModule
_import_structure = { _import_structure = {"tokenization_byt5": ["ByT5Tokenizer"]}
"tokenization_byt5": ["ByT5Tokenizer"],
}
if TYPE_CHECKING: if TYPE_CHECKING:
......
...@@ -27,9 +27,7 @@ from ...utils import ( ...@@ -27,9 +27,7 @@ from ...utils import (
) )
_import_structure = { _import_structure = {"configuration_convnext": ["CONVNEXT_PRETRAINED_CONFIG_ARCHIVE_MAP", "ConvNextConfig"]}
"configuration_convnext": ["CONVNEXT_PRETRAINED_CONFIG_ARCHIVE_MAP", "ConvNextConfig"],
}
try: try:
if not is_vision_available(): if not is_vision_available():
......
...@@ -20,9 +20,7 @@ from typing import TYPE_CHECKING ...@@ -20,9 +20,7 @@ from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
_import_structure = { _import_structure = {"configuration_cvt": ["CVT_PRETRAINED_CONFIG_ARCHIVE_MAP", "CvtConfig"]}
"configuration_cvt": ["CVT_PRETRAINED_CONFIG_ARCHIVE_MAP", "CvtConfig"],
}
try: try:
......
...@@ -22,10 +22,7 @@ from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_availabl ...@@ -22,10 +22,7 @@ from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_availabl
_import_structure = { _import_structure = {
"configuration_data2vec_audio": [ "configuration_data2vec_audio": ["DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP", "Data2VecAudioConfig"],
"DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP",
"Data2VecAudioConfig",
],
"configuration_data2vec_text": [ "configuration_data2vec_text": [
"DATA2VEC_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP", "DATA2VEC_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP",
"Data2VecTextConfig", "Data2VecTextConfig",
......
...@@ -20,9 +20,7 @@ from typing import TYPE_CHECKING ...@@ -20,9 +20,7 @@ from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
_import_structure = { _import_structure = {"configuration_deit": ["DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "DeiTConfig", "DeiTOnnxConfig"]}
"configuration_deit": ["DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "DeiTConfig", "DeiTOnnxConfig"],
}
try: try:
if not is_vision_available(): if not is_vision_available():
......
...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING ...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_timm_available, is_vision_available from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_timm_available, is_vision_available
_import_structure = { _import_structure = {"configuration_detr": ["DETR_PRETRAINED_CONFIG_ARCHIVE_MAP", "DetrConfig"]}
"configuration_detr": ["DETR_PRETRAINED_CONFIG_ARCHIVE_MAP", "DetrConfig"],
}
try: try:
if not is_vision_available(): if not is_vision_available():
......
...@@ -21,9 +21,7 @@ from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_availab ...@@ -21,9 +21,7 @@ from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_availab
from ...utils import OptionalDependencyNotAvailable from ...utils import OptionalDependencyNotAvailable
_import_structure = { _import_structure = {"configuration_dpt": ["DPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "DPTConfig"]}
"configuration_dpt": ["DPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "DPTConfig"],
}
try: try:
if not is_vision_available(): if not is_vision_available():
......
...@@ -27,9 +27,7 @@ from ...utils import ( ...@@ -27,9 +27,7 @@ from ...utils import (
) )
_import_structure = { _import_structure = {"configuration_encoder_decoder": ["EncoderDecoderConfig"]}
"configuration_encoder_decoder": ["EncoderDecoderConfig"],
}
try: try:
if not is_torch_available(): if not is_torch_available():
......
...@@ -26,9 +26,7 @@ from ...utils import ( ...@@ -26,9 +26,7 @@ from ...utils import (
) )
_import_structure = { _import_structure = {"configuration_fnet": ["FNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "FNetConfig"]}
"configuration_fnet": ["FNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "FNetConfig"],
}
try: try:
if not is_sentencepiece_available(): if not is_sentencepiece_available():
......
...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING ...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
_import_structure = { _import_structure = {"configuration_glpn": ["GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP", "GLPNConfig"]}
"configuration_glpn": ["GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP", "GLPNConfig"],
}
try: try:
if not is_vision_available(): if not is_vision_available():
......
...@@ -21,9 +21,7 @@ from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_availab ...@@ -21,9 +21,7 @@ from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_availab
from ...utils import OptionalDependencyNotAvailable from ...utils import OptionalDependencyNotAvailable
_import_structure = { _import_structure = {"configuration_gpt_neox": ["GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTNeoXConfig"]}
"configuration_gpt_neox": ["GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTNeoXConfig"],
}
try: try:
if not is_tokenizers_available(): if not is_tokenizers_available():
......
...@@ -26,9 +26,7 @@ from ...utils import ( ...@@ -26,9 +26,7 @@ from ...utils import (
) )
_import_structure = { _import_structure = {"configuration_gptj": ["GPTJ_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTJConfig", "GPTJOnnxConfig"]}
"configuration_gptj": ["GPTJ_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTJConfig", "GPTJOnnxConfig"],
}
try: try:
if not is_torch_available(): if not is_torch_available():
......
...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING ...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available
_import_structure = { _import_structure = {"tokenization_herbert": ["HerbertTokenizer"]}
"tokenization_herbert": ["HerbertTokenizer"],
}
try: try:
if not is_tokenizers_available(): if not is_tokenizers_available():
......
...@@ -20,10 +20,7 @@ from typing import TYPE_CHECKING ...@@ -20,10 +20,7 @@ from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
_import_structure = { _import_structure = {"configuration_hubert": ["HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "HubertConfig"]}
".wav2vec2.feature_extraction_wav2vec2": ["Wav2Vec2FeatureExtractor"],
"configuration_hubert": ["HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "HubertConfig"],
}
try: try:
if not is_torch_available(): if not is_torch_available():
...@@ -54,7 +51,6 @@ else: ...@@ -54,7 +51,6 @@ else:
] ]
if TYPE_CHECKING: if TYPE_CHECKING:
from ..wav2vec2.feature_extraction_wav2vec2 import Wav2Vec2FeatureExtractor
from .configuration_hubert import HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, HubertConfig from .configuration_hubert import HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, HubertConfig
try: try:
......
...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING ...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
_import_structure = { _import_structure = {"configuration_ibert": ["IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "IBertConfig", "IBertOnnxConfig"]}
"configuration_ibert": ["IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "IBertConfig", "IBertOnnxConfig"],
}
try: try:
if not is_torch_available(): if not is_torch_available():
......
...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING ...@@ -21,9 +21,7 @@ from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
_import_structure = { _import_structure = {"configuration_imagegpt": ["IMAGEGPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "ImageGPTConfig"]}
"configuration_imagegpt": ["IMAGEGPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "ImageGPTConfig"],
}
try: try:
if not is_vision_available(): if not is_vision_available():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment