Skip to content

Commit

Permalink
Removal of deprecated maps (huggingface#30576)
Browse files Browse the repository at this point in the history
* [test_all] Remove all imports

Remove remaining ARCHIVE MAPS

Remove remaining PRETRAINED maps

* review comments

* [test_all] empty commit to trigger tests
  • Loading branch information
LysandreJik authored May 9, 2024
1 parent 8c5b3c1 commit 297b732
Show file tree
Hide file tree
Showing 723 changed files with 584 additions and 7,268 deletions.
1,331 changes: 220 additions & 1,111 deletions src/transformers/__init__.py

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions src/transformers/models/albert/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


_import_structure = {
"configuration_albert": ["ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "AlbertConfig", "AlbertOnnxConfig"],
"configuration_albert": ["AlbertConfig", "AlbertOnnxConfig"],
}

try:
Expand All @@ -52,7 +52,6 @@
pass
else:
_import_structure["modeling_albert"] = [
"ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
"AlbertForMaskedLM",
"AlbertForMultipleChoice",
"AlbertForPreTraining",
Expand All @@ -71,7 +70,6 @@
pass
else:
_import_structure["modeling_tf_albert"] = [
"TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
"TFAlbertForMaskedLM",
"TFAlbertForMultipleChoice",
"TFAlbertForPreTraining",
Expand Down Expand Up @@ -101,7 +99,7 @@
]

if TYPE_CHECKING:
from .configuration_albert import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, AlbertConfig, AlbertOnnxConfig
from .configuration_albert import AlbertConfig, AlbertOnnxConfig

try:
if not is_sentencepiece_available():
Expand All @@ -126,7 +124,6 @@
pass
else:
from .modeling_albert import (
ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
AlbertForMaskedLM,
AlbertForMultipleChoice,
AlbertForPreTraining,
Expand All @@ -145,7 +142,6 @@
pass
else:
from .modeling_tf_albert import (
TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
TFAlbertForMaskedLM,
TFAlbertForMultipleChoice,
TFAlbertForPreTraining,
Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/albert/configuration_albert.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ..deprecated._archive_maps import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402


class AlbertConfig(PretrainedConfig):
Expand Down
3 changes: 0 additions & 3 deletions src/transformers/models/albert/modeling_albert.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@
_CONFIG_FOR_DOC = "AlbertConfig"


from ..deprecated._archive_maps import ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402


def load_tf_weights_in_albert(model, config, tf_checkpoint_path):
"""Load tf checkpoints in a pytorch model."""
try:
Expand Down
3 changes: 0 additions & 3 deletions src/transformers/models/albert/modeling_tf_albert.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@
_CONFIG_FOR_DOC = "AlbertConfig"


from ..deprecated._archive_maps import TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402


class TFAlbertPreTrainingLoss:
"""
Loss function suitable for ALBERT pretraining, that is, the task of pretraining a language model by combining SOP +
Expand Down
4 changes: 0 additions & 4 deletions src/transformers/models/align/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

_import_structure = {
"configuration_align": [
"ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP",
"AlignConfig",
"AlignTextConfig",
"AlignVisionConfig",
Expand All @@ -37,7 +36,6 @@
pass
else:
_import_structure["modeling_align"] = [
"ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST",
"AlignModel",
"AlignPreTrainedModel",
"AlignTextModel",
Expand All @@ -46,7 +44,6 @@

if TYPE_CHECKING:
from .configuration_align import (
ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP,
AlignConfig,
AlignTextConfig,
AlignVisionConfig,
Expand All @@ -60,7 +57,6 @@
pass
else:
from .modeling_align import (
ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST,
AlignModel,
AlignPreTrainedModel,
AlignTextModel,
Expand Down
3 changes: 0 additions & 3 deletions src/transformers/models/align/configuration_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
logger = logging.get_logger(__name__)


from ..deprecated._archive_maps import ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402


class AlignTextConfig(PretrainedConfig):
r"""
This is the configuration class to store the configuration of a [`AlignTextModel`]. It is used to instantiate a
Expand Down
3 changes: 0 additions & 3 deletions src/transformers/models/align/modeling_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
_CONFIG_FOR_DOC = "AlignConfig"


from ..deprecated._archive_maps import ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402


ALIGN_START_DOCSTRING = r"""
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
Expand Down
4 changes: 0 additions & 4 deletions src/transformers/models/altclip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

_import_structure = {
"configuration_altclip": [
"ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP",
"AltCLIPConfig",
"AltCLIPTextConfig",
"AltCLIPVisionConfig",
Expand All @@ -33,7 +32,6 @@
pass
else:
_import_structure["modeling_altclip"] = [
"ALTCLIP_PRETRAINED_MODEL_ARCHIVE_LIST",
"AltCLIPPreTrainedModel",
"AltCLIPModel",
"AltCLIPTextModel",
Expand All @@ -43,7 +41,6 @@

if TYPE_CHECKING:
from .configuration_altclip import (
ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
AltCLIPConfig,
AltCLIPTextConfig,
AltCLIPVisionConfig,
Expand All @@ -57,7 +54,6 @@
pass
else:
from .modeling_altclip import (
ALTCLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
AltCLIPModel,
AltCLIPPreTrainedModel,
AltCLIPTextModel,
Expand Down
3 changes: 0 additions & 3 deletions src/transformers/models/altclip/configuration_altclip.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
logger = logging.get_logger(__name__)


from ..deprecated._archive_maps import ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402


class AltCLIPTextConfig(PretrainedConfig):
r"""
This is the configuration class to store the configuration of a [`AltCLIPTextModel`]. It is used to instantiate a
Expand Down
3 changes: 0 additions & 3 deletions src/transformers/models/altclip/modeling_altclip.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
_CONFIG_FOR_DOC = "AltCLIPConfig"


from ..deprecated._archive_maps import ALTCLIP_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402


ALTCLIP_START_DOCSTRING = r"""
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@


_import_structure = {
"configuration_audio_spectrogram_transformer": [
"AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
"ASTConfig",
],
"configuration_audio_spectrogram_transformer": ["ASTConfig"],
"feature_extraction_audio_spectrogram_transformer": ["ASTFeatureExtractor"],
}

Expand All @@ -31,7 +28,6 @@
pass
else:
_import_structure["modeling_audio_spectrogram_transformer"] = [
"AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
"ASTForAudioClassification",
"ASTModel",
"ASTPreTrainedModel",
Expand All @@ -40,7 +36,6 @@

if TYPE_CHECKING:
from .configuration_audio_spectrogram_transformer import (
AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
ASTConfig,
)
from .feature_extraction_audio_spectrogram_transformer import ASTFeatureExtractor
Expand All @@ -52,7 +47,6 @@
pass
else:
from .modeling_audio_spectrogram_transformer import (
AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
ASTForAudioClassification,
ASTModel,
ASTPreTrainedModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
logger = logging.get_logger(__name__)


from ..deprecated._archive_maps import AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402


class ASTConfig(PretrainedConfig):
r"""
This is the configuration class to store the configuration of a [`ASTModel`]. It is used to instantiate an AST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@
_SEQ_CLASS_EXPECTED_LOSS = 0.17


from ..deprecated._archive_maps import AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402


class ASTEmbeddings(nn.Module):
"""
Construct the CLS token, position and patch embeddings.
Expand Down
4 changes: 2 additions & 2 deletions src/transformers/models/auto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

_import_structure = {
"auto_factory": ["get_values"],
"configuration_auto": ["ALL_PRETRAINED_CONFIG_ARCHIVE_MAP", "CONFIG_MAPPING", "MODEL_NAMES_MAPPING", "AutoConfig"],
"configuration_auto": ["CONFIG_MAPPING", "MODEL_NAMES_MAPPING", "AutoConfig"],
"feature_extraction_auto": ["FEATURE_EXTRACTOR_MAPPING", "AutoFeatureExtractor"],
"image_processing_auto": ["IMAGE_PROCESSOR_MAPPING", "AutoImageProcessor"],
"processing_auto": ["PROCESSOR_MAPPING", "AutoProcessor"],
Expand Down Expand Up @@ -213,7 +213,7 @@

if TYPE_CHECKING:
from .auto_factory import get_values
from .configuration_auto import ALL_PRETRAINED_CONFIG_ARCHIVE_MAP, CONFIG_MAPPING, MODEL_NAMES_MAPPING, AutoConfig
from .configuration_auto import CONFIG_MAPPING, MODEL_NAMES_MAPPING, AutoConfig
from .feature_extraction_auto import FEATURE_EXTRACTOR_MAPPING, AutoFeatureExtractor
from .image_processing_auto import IMAGE_PROCESSOR_MAPPING, AutoImageProcessor
from .processing_auto import PROCESSOR_MAPPING, AutoProcessor
Expand Down
6 changes: 0 additions & 6 deletions src/transformers/models/auto/configuration_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
logger = logging.get_logger(__name__)


from ..deprecated._archive_maps import CONFIG_ARCHIVE_MAP_MAPPING_NAMES # noqa: F401, E402


CONFIG_MAPPING_NAMES = OrderedDict(
[
# Add configs here
Expand Down Expand Up @@ -982,6 +979,3 @@ def register(model_type, config, exist_ok=False):
"match!"
)
CONFIG_MAPPING.register(model_type, config, exist_ok=exist_ok)


ALL_PRETRAINED_CONFIG_ARCHIVE_MAP = _LazyLoadAllMappings(CONFIG_ARCHIVE_MAP_MAPPING_NAMES)
8 changes: 1 addition & 7 deletions src/transformers/models/autoformer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@


_import_structure = {
"configuration_autoformer": [
"AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
"AutoformerConfig",
],
"configuration_autoformer": ["AutoformerConfig"],
}

try:
Expand All @@ -31,7 +28,6 @@
pass
else:
_import_structure["modeling_autoformer"] = [
"AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
"AutoformerForPrediction",
"AutoformerModel",
"AutoformerPreTrainedModel",
Expand All @@ -40,7 +36,6 @@

if TYPE_CHECKING:
from .configuration_autoformer import (
AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
AutoformerConfig,
)

Expand All @@ -51,7 +46,6 @@
pass
else:
from .modeling_autoformer import (
AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
AutoformerForPrediction,
AutoformerModel,
AutoformerPreTrainedModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
logger = logging.get_logger(__name__)


from ..deprecated._archive_maps import AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402


class AutoformerConfig(PretrainedConfig):
r"""
This is the configuration class to store the configuration of an [`AutoformerModel`]. It is used to instantiate an
Expand Down
3 changes: 0 additions & 3 deletions src/transformers/models/autoformer/modeling_autoformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,6 @@ class AutoformerModelOutput(ModelOutput):
static_features: Optional[torch.FloatTensor] = None


from ..deprecated._archive_maps import AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402


# Copied from transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesFeatureEmbedder with TimeSeries->Autoformer
class AutoformerFeatureEmbedder(nn.Module):
"""
Expand Down
4 changes: 0 additions & 4 deletions src/transformers/models/bark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

_import_structure = {
"configuration_bark": [
"BARK_PRETRAINED_CONFIG_ARCHIVE_MAP",
"BarkCoarseConfig",
"BarkConfig",
"BarkFineConfig",
Expand All @@ -38,7 +37,6 @@
pass
else:
_import_structure["modeling_bark"] = [
"BARK_PRETRAINED_MODEL_ARCHIVE_LIST",
"BarkFineModel",
"BarkSemanticModel",
"BarkCoarseModel",
Expand All @@ -49,7 +47,6 @@

if TYPE_CHECKING:
from .configuration_bark import (
BARK_PRETRAINED_CONFIG_ARCHIVE_MAP,
BarkCoarseConfig,
BarkConfig,
BarkFineConfig,
Expand All @@ -64,7 +61,6 @@
pass
else:
from .modeling_bark import (
BARK_PRETRAINED_MODEL_ARCHIVE_LIST,
BarkCausalModel,
BarkCoarseModel,
BarkFineModel,
Expand Down
3 changes: 0 additions & 3 deletions src/transformers/models/bark/modeling_bark.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@
_CONFIG_FOR_DOC = "BarkConfig"


from ..deprecated._archive_maps import BARK_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402


# Copied from transformers.models.llama.modeling_llama._get_unpad_data
def _get_unpad_data(attention_mask):
seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32)
Expand Down
Loading

0 comments on commit 297b732

Please sign in to comment.