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
...@@ -28,9 +28,7 @@ from ...utils import ( ...@@ -28,9 +28,7 @@ from ...utils import (
) )
_import_structure = { _import_structure = {"processing_layoutxlm": ["LayoutXLMProcessor"]}
"processing_layoutxlm": ["LayoutXLMProcessor"],
}
try: try:
if not is_sentencepiece_available(): if not is_sentencepiece_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, is_vision_available from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
_import_structure = { _import_structure = {"configuration_maskformer": ["MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "MaskFormerConfig"]}
"configuration_maskformer": ["MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "MaskFormerConfig"],
}
try: try:
if not is_vision_available(): if not is_vision_available():
......
...@@ -28,9 +28,7 @@ from ...utils import ( ...@@ -28,9 +28,7 @@ from ...utils import (
) )
_import_structure = { _import_structure = {"configuration_mbart": ["MBART_PRETRAINED_CONFIG_ARCHIVE_MAP", "MBartConfig", "MBartOnnxConfig"]}
"configuration_mbart": ["MBART_PRETRAINED_CONFIG_ARCHIVE_MAP", "MBartConfig", "MBartOnnxConfig"],
}
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 from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
_import_structure = { _import_structure = {"configuration_mmbt": ["MMBTConfig"]}
"configuration_mmbt": ["MMBTConfig"],
}
try: try:
if not is_torch_available(): if not is_torch_available():
......
...@@ -43,9 +43,7 @@ else: ...@@ -43,9 +43,7 @@ else:
MT5TokenizerFast = T5TokenizerFast MT5TokenizerFast = T5TokenizerFast
_import_structure = { _import_structure = {"configuration_mt5": ["MT5Config"]}
"configuration_mt5": ["MT5Config"],
}
try: try:
if not is_torch_available(): if not is_torch_available():
......
...@@ -20,9 +20,7 @@ from typing import TYPE_CHECKING ...@@ -20,9 +20,7 @@ from typing import TYPE_CHECKING
from ...utils import _LazyModule, is_tokenizers_available, is_torch_available from ...utils import _LazyModule, is_tokenizers_available, is_torch_available
_import_structure = { _import_structure = {"configuration_opt": ["OPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "OPTConfig"]}
"configuration_opt": ["OPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "OPTConfig"],
}
if is_torch_available(): if is_torch_available():
......
...@@ -28,9 +28,7 @@ from ...utils import ( ...@@ -28,9 +28,7 @@ from ...utils import (
) )
_import_structure = { _import_structure = {"configuration_pegasus": ["PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP", "PegasusConfig"]}
"configuration_pegasus": ["PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP", "PegasusConfig"],
}
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_phobert": ["PhobertTokenizer"]}
"tokenization_phobert": ["PhobertTokenizer"],
}
if TYPE_CHECKING: if TYPE_CHECKING:
......
...@@ -26,9 +26,7 @@ from ...utils import ( ...@@ -26,9 +26,7 @@ from ...utils import (
) )
_import_structure = { _import_structure = {"configuration_plbart": ["PLBART_PRETRAINED_CONFIG_ARCHIVE_MAP", "PLBartConfig"]}
"configuration_plbart": ["PLBART_PRETRAINED_CONFIG_ARCHIVE_MAP", "PLBartConfig"],
}
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_poolformer": ["POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "PoolFormerConfig"]}
"configuration_poolformer": ["POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "PoolFormerConfig"],
}
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_qdqbert": ["QDQBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "QDQBertConfig"]}
"configuration_qdqbert": ["QDQBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "QDQBertConfig"],
}
try: try:
if not is_torch_available(): if not is_torch_available():
......
...@@ -27,9 +27,7 @@ from ...utils import ( ...@@ -27,9 +27,7 @@ from ...utils import (
) )
_import_structure = { _import_structure = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"]}
"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"],
}
try: try:
if not is_sentencepiece_available(): if not is_sentencepiece_available():
......
...@@ -22,9 +22,7 @@ from ...file_utils import _LazyModule, is_torch_available ...@@ -22,9 +22,7 @@ from ...file_utils import _LazyModule, is_torch_available
from ...utils import OptionalDependencyNotAvailable from ...utils import OptionalDependencyNotAvailable
_import_structure = { _import_structure = {"configuration_regnet": ["REGNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "RegNetConfig"]}
"configuration_regnet": ["REGNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "RegNetConfig"],
}
try: try:
if not is_torch_available(): if not is_torch_available():
......
...@@ -28,9 +28,7 @@ from ...utils import ( ...@@ -28,9 +28,7 @@ from ...utils import (
) )
_import_structure = { _import_structure = {"configuration_rembert": ["REMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "RemBertConfig"]}
"configuration_rembert": ["REMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "RemBertConfig"],
}
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 from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
_import_structure = { _import_structure = {"configuration_resnet": ["RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "ResNetConfig"]}
"configuration_resnet": ["RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "ResNetConfig"],
}
try: try:
if not is_torch_available(): if not is_torch_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, is_vision_available from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
_import_structure = { _import_structure = {"configuration_segformer": ["SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "SegformerConfig"]}
"configuration_segformer": ["SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "SegformerConfig"],
}
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_sew": ["SEW_PRETRAINED_CONFIG_ARCHIVE_MAP", "SEWConfig"]}
"configuration_sew": ["SEW_PRETRAINED_CONFIG_ARCHIVE_MAP", "SEWConfig"],
}
try: try:
if not is_torch_available(): if not is_torch_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_sew_d": ["SEW_D_PRETRAINED_CONFIG_ARCHIVE_MAP", "SEWDConfig"]}
"configuration_sew_d": ["SEW_D_PRETRAINED_CONFIG_ARCHIVE_MAP", "SEWDConfig"],
}
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_flax_available, is_torch_available from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available
_import_structure = { _import_structure = {"configuration_speech_encoder_decoder": ["SpeechEncoderDecoderConfig"]}
"configuration_speech_encoder_decoder": ["SpeechEncoderDecoderConfig"],
}
try: try:
if not is_torch_available(): if not is_torch_available():
......
...@@ -28,10 +28,7 @@ from ...utils import ( ...@@ -28,10 +28,7 @@ from ...utils import (
_import_structure = { _import_structure = {
"configuration_speech_to_text": [ "configuration_speech_to_text": ["SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP", "Speech2TextConfig"],
"SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP",
"Speech2TextConfig",
],
} }
try: try:
......
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