Unverified Commit c56ebbbe authored by amyeroberts's avatar amyeroberts Committed by GitHub
Browse files

Add deprecation warning when image FE instantiated (#20427)



* Add deprecation warning when image FE instantiated

* Update src/transformers/models/beit/feature_extraction_beit.py
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>

* Update v2.7 -> v5 and add for new IPs

* Add message to Chinese CLIP
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
parent 183af58b
......@@ -14,10 +14,20 @@
# limitations under the License.
"""Feature extractor class for BEiT."""
import warnings
from ...utils import logging
from .image_processing_beit import BeitImageProcessor
logger = logging.get_logger(__name__)
BeitFeatureExtractor = BeitImageProcessor
class BeitFeatureExtractor(BeitImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class BeitFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"
" use BeitImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,6 +14,8 @@
# limitations under the License.
"""Feature extractor class for Chinese-CLIP."""
import warnings
from ...utils import logging
from .image_processing_chinese_clip import ChineseCLIPImageProcessor
......@@ -21,4 +23,11 @@ from .image_processing_chinese_clip import ChineseCLIPImageProcessor
logger = logging.get_logger(__name__)
ChineseCLIPFeatureExtractor = ChineseCLIPImageProcessor
class ChineseCLIPFeatureExtractor(ChineseCLIPImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class ChineseCLIPFeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use ChineseCLIPImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,6 +14,8 @@
# limitations under the License.
"""Feature extractor class for CLIP."""
import warnings
from ...utils import logging
from .image_processing_clip import CLIPImageProcessor
......@@ -21,4 +23,11 @@ from .image_processing_clip import CLIPImageProcessor
logger = logging.get_logger(__name__)
CLIPFeatureExtractor = CLIPImageProcessor
class CLIPFeatureExtractor(CLIPImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class CLIPFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"
" use CLIPImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,10 +14,20 @@
# limitations under the License.
"""Feature extractor class for Conditional DETR."""
import warnings
from ...utils import logging
from .image_processing_conditional_detr import ConditionalDetrImageProcessor
logger = logging.get_logger(__name__)
ConditionalDetrFeatureExtractor = ConditionalDetrImageProcessor
class ConditionalDetrFeatureExtractor(ConditionalDetrImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class ConditionalDetrFeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use ConditionalDetrImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,6 +14,8 @@
# limitations under the License.
"""Feature extractor class for ConvNeXT."""
import warnings
from ...utils import logging
from .image_processing_convnext import ConvNextImageProcessor
......@@ -21,4 +23,11 @@ from .image_processing_convnext import ConvNextImageProcessor
logger = logging.get_logger(__name__)
ConvNextFeatureExtractor = ConvNextImageProcessor
class ConvNextFeatureExtractor(ConvNextImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class ConvNextFeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use ConvNextImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,10 +14,20 @@
# limitations under the License.
"""Feature extractor class for Deformable DETR."""
import warnings
from ...utils import logging
from .image_processing_deformable_detr import DeformableDetrImageProcessor
logger = logging.get_logger(__name__)
DeformableDetrFeatureExtractor = DeformableDetrImageProcessor
class DeformableDetrFeatureExtractor(DeformableDetrImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class DeformableDetrFeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use DeformableDetrImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,10 +14,20 @@
# limitations under the License.
"""Feature extractor class for DeiT."""
import warnings
from ...utils import logging
from .image_processing_deit import DeiTImageProcessor
logger = logging.get_logger(__name__)
DeiTFeatureExtractor = DeiTImageProcessor
class DeiTFeatureExtractor(DeiTImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class DeiTFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"
" use DeiTImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,9 +14,20 @@
# limitations under the License.
"""Feature extractor class for DETR."""
import warnings
from ...utils import logging
from .image_processing_detr import DetrImageProcessor
logger = logging.get_logger(__name__)
DetrFeatureExtractor = DetrImageProcessor
class DetrFeatureExtractor(DetrImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class DetrFeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use DetrImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,6 +14,8 @@
# limitations under the License.
"""Feature extractor class for Donut."""
import warnings
from ...utils import logging
from .image_processing_donut import DonutImageProcessor
......@@ -21,4 +23,11 @@ from .image_processing_donut import DonutImageProcessor
logger = logging.get_logger(__name__)
DonutFeatureExtractor = DonutImageProcessor
class DonutFeatureExtractor(DonutImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class DonutFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"
" use DonutImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,6 +14,8 @@
# limitations under the License.
"""Feature extractor class for DPT."""
import warnings
from ...utils import logging
from .image_processing_dpt import DPTImageProcessor
......@@ -21,4 +23,11 @@ from .image_processing_dpt import DPTImageProcessor
logger = logging.get_logger(__name__)
DPTFeatureExtractor = DPTImageProcessor
class DPTFeatureExtractor(DPTImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class DPTFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"
" use DPTImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,10 +14,20 @@
# limitations under the License.
"""Feature extractor class for FLAVA."""
import warnings
from ...utils import logging
from .image_processing_flava import FlavaImageProcessor
logger = logging.get_logger(__name__)
FlavaFeatureExtractor = FlavaImageProcessor
class FlavaFeatureExtractor(FlavaImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class FlavaFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"
" use FlavaImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,11 +14,20 @@
# limitations under the License.
"""Feature extractor class for GLPN."""
import warnings
from ...utils import logging
from .image_processing_glpn import GLPNImageProcessor
logger = logging.get_logger(__name__)
# Feature extractor for GLPN is being replaced by image processor
GLPNFeatureExtractor = GLPNImageProcessor
class GLPNFeatureExtractor(GLPNImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class GLPNFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"
" use GLPNImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,6 +14,8 @@
# limitations under the License.
"""Feature extractor class for ImageGPT."""
import warnings
from ...utils import logging
from .image_processing_imagegpt import ImageGPTImageProcessor
......@@ -21,4 +23,11 @@ from .image_processing_imagegpt import ImageGPTImageProcessor
logger = logging.get_logger(__name__)
ImageGPTFeatureExtractor = ImageGPTImageProcessor
class ImageGPTFeatureExtractor(ImageGPTImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class ImageGPTFeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use ImageGPTImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -16,10 +16,20 @@
Feature extractor class for LayoutLMv2.
"""
import warnings
from ...utils import logging
from .image_processing_layoutlmv2 import LayoutLMv2ImageProcessor
logger = logging.get_logger(__name__)
LayoutLMv2FeatureExtractor = LayoutLMv2ImageProcessor
class LayoutLMv2FeatureExtractor(LayoutLMv2ImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class LayoutLMv2FeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use LayoutLMv2ImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -16,6 +16,8 @@
Feature extractor class for LayoutLMv3.
"""
import warnings
from ...utils import logging
from .image_processing_layoutlmv3 import LayoutLMv3ImageProcessor
......@@ -23,4 +25,11 @@ from .image_processing_layoutlmv3 import LayoutLMv3ImageProcessor
logger = logging.get_logger(__name__)
LayoutLMv3FeatureExtractor = LayoutLMv3ImageProcessor
class LayoutLMv3FeatureExtractor(LayoutLMv3ImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class LayoutLMv3FeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use LayoutLMv3ImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,6 +14,8 @@
# limitations under the License.
"""Feature extractor class for LeViT."""
import warnings
from ...utils import logging
from .image_processing_levit import LevitImageProcessor
......@@ -21,5 +23,11 @@ from .image_processing_levit import LevitImageProcessor
logger = logging.get_logger(__name__)
# Feature extractor for Levit is being replaced by image processor
LevitFeatureExtractor = LevitImageProcessor
class LevitFeatureExtractor(LevitImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class LevitFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"
" use LevitImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,6 +14,8 @@
# limitations under the License.
"""Feature extractor class for MaskFormer."""
import warnings
from transformers.utils import logging
from .image_processing_maskformer import MaskFormerImageProcessor
......@@ -21,4 +23,12 @@ from .image_processing_maskformer import MaskFormerImageProcessor
logger = logging.get_logger(__name__)
MaskFormerFeatureExtractor = MaskFormerImageProcessor
class MaskFormerFeatureExtractor(MaskFormerImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class MaskFormerFeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use MaskFormerImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,6 +14,8 @@
# limitations under the License.
"""Feature extractor class for MobileNetV1."""
import warnings
from ...utils import logging
from .image_processing_mobilenet_v1 import MobileNetV1ImageProcessor
......@@ -21,4 +23,11 @@ from .image_processing_mobilenet_v1 import MobileNetV1ImageProcessor
logger = logging.get_logger(__name__)
MobileNetV1FeatureExtractor = MobileNetV1ImageProcessor
class MobileNetV1FeatureExtractor(MobileNetV1ImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class MobileNetV1FeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use MobileNetV1ImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,6 +14,8 @@
# limitations under the License.
"""Feature extractor class for MobileNetV2."""
import warnings
from ...utils import logging
from .image_processing_mobilenet_v2 import MobileNetV2ImageProcessor
......@@ -21,4 +23,11 @@ from .image_processing_mobilenet_v2 import MobileNetV2ImageProcessor
logger = logging.get_logger(__name__)
MobileNetV2FeatureExtractor = MobileNetV2ImageProcessor
class MobileNetV2FeatureExtractor(MobileNetV2ImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class MobileNetV2FeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use MobileNetV2ImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
......@@ -14,6 +14,8 @@
# limitations under the License.
"""Feature extractor class for MobileViT."""
import warnings
from ...utils import logging
from .image_processing_mobilevit import MobileViTImageProcessor
......@@ -21,4 +23,11 @@ from .image_processing_mobilevit import MobileViTImageProcessor
logger = logging.get_logger(__name__)
MobileViTFeatureExtractor = MobileViTImageProcessor
class MobileViTFeatureExtractor(MobileViTImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class MobileViTFeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use MobileViTImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
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