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,6 +14,8 @@ ...@@ -14,6 +14,8 @@
# limitations under the License. # limitations under the License.
"""Feature extractor class for OwlViT.""" """Feature extractor class for OwlViT."""
import warnings
from ...utils import logging from ...utils import logging
from .image_processing_owlvit import OwlViTImageProcessor from .image_processing_owlvit import OwlViTImageProcessor
...@@ -21,4 +23,11 @@ from .image_processing_owlvit import OwlViTImageProcessor ...@@ -21,4 +23,11 @@ from .image_processing_owlvit import OwlViTImageProcessor
logger = logging.get_logger(__name__) logger = logging.get_logger(__name__)
OwlViTFeatureExtractor = OwlViTImageProcessor class OwlViTFeatureExtractor(OwlViTImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class OwlViTFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"
" use OwlViTImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
# limitations under the License. # limitations under the License.
"""Feature extractor class for Perceiver.""" """Feature extractor class for Perceiver."""
import warnings
from ...utils import logging from ...utils import logging
from .image_processing_perceiver import PerceiverImageProcessor from .image_processing_perceiver import PerceiverImageProcessor
...@@ -21,4 +23,11 @@ from .image_processing_perceiver import PerceiverImageProcessor ...@@ -21,4 +23,11 @@ from .image_processing_perceiver import PerceiverImageProcessor
logger = logging.get_logger(__name__) logger = logging.get_logger(__name__)
PerceiverFeatureExtractor = PerceiverImageProcessor class PerceiverFeatureExtractor(PerceiverImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class PerceiverFeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use PerceiverImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
# limitations under the License. # limitations under the License.
"""Feature extractor class for PoolFormer.""" """Feature extractor class for PoolFormer."""
import warnings
from ...utils import logging from ...utils import logging
from .image_processing_poolformer import PoolFormerImageProcessor from .image_processing_poolformer import PoolFormerImageProcessor
...@@ -21,4 +23,11 @@ from .image_processing_poolformer import PoolFormerImageProcessor ...@@ -21,4 +23,11 @@ from .image_processing_poolformer import PoolFormerImageProcessor
logger = logging.get_logger(__name__) logger = logging.get_logger(__name__)
PoolFormerFeatureExtractor = PoolFormerImageProcessor class PoolFormerFeatureExtractor(PoolFormerImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class PoolFormerFeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use PoolFormerImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
# limitations under the License. # limitations under the License.
"""Feature extractor class for SegFormer.""" """Feature extractor class for SegFormer."""
import warnings
from ...utils import logging from ...utils import logging
from .image_processing_segformer import SegformerImageProcessor from .image_processing_segformer import SegformerImageProcessor
...@@ -21,4 +23,11 @@ from .image_processing_segformer import SegformerImageProcessor ...@@ -21,4 +23,11 @@ from .image_processing_segformer import SegformerImageProcessor
logger = logging.get_logger(__name__) logger = logging.get_logger(__name__)
SegformerFeatureExtractor = SegformerImageProcessor class SegformerFeatureExtractor(SegformerImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class SegformerFeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use SegformerImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
# limitations under the License. # limitations under the License.
"""Feature extractor class for VideoMAE.""" """Feature extractor class for VideoMAE."""
import warnings
from ...utils import logging from ...utils import logging
from .image_processing_videomae import VideoMAEImageProcessor from .image_processing_videomae import VideoMAEImageProcessor
...@@ -21,4 +23,11 @@ from .image_processing_videomae import VideoMAEImageProcessor ...@@ -21,4 +23,11 @@ from .image_processing_videomae import VideoMAEImageProcessor
logger = logging.get_logger(__name__) logger = logging.get_logger(__name__)
VideoMAEFeatureExtractor = VideoMAEImageProcessor class VideoMAEFeatureExtractor(VideoMAEImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class VideoMAEFeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use VideoMAEImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
# limitations under the License. # limitations under the License.
"""Feature extractor class for ViLT.""" """Feature extractor class for ViLT."""
import warnings
from ...utils import logging from ...utils import logging
from .image_processing_vilt import ViltImageProcessor from .image_processing_vilt import ViltImageProcessor
...@@ -21,4 +23,11 @@ from .image_processing_vilt import ViltImageProcessor ...@@ -21,4 +23,11 @@ from .image_processing_vilt import ViltImageProcessor
logger = logging.get_logger(__name__) logger = logging.get_logger(__name__)
ViltFeatureExtractor = ViltImageProcessor class ViltFeatureExtractor(ViltImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class ViltFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"
" use ViltImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
# limitations under the License. # limitations under the License.
"""Feature extractor class for ViT.""" """Feature extractor class for ViT."""
import warnings
from ...utils import logging from ...utils import logging
from .image_processing_vit import ViTImageProcessor from .image_processing_vit import ViTImageProcessor
...@@ -21,5 +23,11 @@ from .image_processing_vit import ViTImageProcessor ...@@ -21,5 +23,11 @@ from .image_processing_vit import ViTImageProcessor
logger = logging.get_logger(__name__) logger = logging.get_logger(__name__)
# Feature extractor for ViT is being replaced by image processor class ViTFeatureExtractor(ViTImageProcessor):
ViTFeatureExtractor = ViTImageProcessor def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class ViTFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"
" use ViTImageProcessor instead.",
FutureWarning,
)
super().__init__(*args, **kwargs)
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
# limitations under the License. # limitations under the License.
"""Feature extractor class for YOLOS.""" """Feature extractor class for YOLOS."""
import warnings
from ...utils import logging from ...utils import logging
from .image_processing_yolos import YolosImageProcessor from .image_processing_yolos import YolosImageProcessor
...@@ -21,4 +23,11 @@ from .image_processing_yolos import YolosImageProcessor ...@@ -21,4 +23,11 @@ from .image_processing_yolos import YolosImageProcessor
logger = logging.get_logger(__name__) logger = logging.get_logger(__name__)
YolosFeatureExtractor = YolosImageProcessor class YolosFeatureExtractor(YolosImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class YolosFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"
" use YolosImageProcessor 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