diff --git a/test/test_functional_tensor.py b/test/test_functional_tensor.py index e4d65a64afa..fb9838ec2e5 100644 --- a/test/test_functional_tensor.py +++ b/test/test_functional_tensor.py @@ -2,7 +2,6 @@ import itertools import math import os -import re from functools import partial from typing import Sequence @@ -144,20 +143,6 @@ def test_rotate_batch(self, device, dt): center = (20, 22) _test_fn_on_batch(batch_tensors, F.rotate, angle=32, interpolation=NEAREST, expand=True, center=center) - def test_rotate_interpolation_type(self): - tensor, _ = _create_data(26, 26) - # assert changed type warning - with pytest.warns( - UserWarning, - match=re.escape( - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " - "Please use InterpolationMode enum." - ), - ): - res1 = F.rotate(tensor, 45, interpolation=2) - res2 = F.rotate(tensor, 45, interpolation=BILINEAR) - assert_equal(res1, res2) - class TestAffine: @@ -364,22 +349,6 @@ def test_batches(self, device, dt): _test_fn_on_batch(batch_tensors, F.affine, angle=-43, translate=[-3, 4], scale=1.2, shear=[4.0, 5.0]) - @pytest.mark.parametrize("device", cpu_and_gpu()) - def test_warnings(self, device): - tensor, pil_img = _create_data(26, 26, device=device) - - # assert changed type warning - with pytest.warns( - UserWarning, - match=re.escape( - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " - "Please use InterpolationMode enum." - ), - ): - res1 = F.affine(tensor, 45, translate=[0, 0], scale=1.0, shear=[0.0, 0.0], interpolation=2) - res2 = F.affine(tensor, 45, translate=[0, 0], scale=1.0, shear=[0.0, 0.0], interpolation=BILINEAR) - assert_equal(res1, res2) - def _get_data_dims_and_points_for_perspective(): # Ideally we would parametrize independently over data dims and points, but @@ -478,23 +447,6 @@ def test_perspective_batch(device, dims_and_points, dt): ) -def test_perspective_interpolation_warning(): - # assert changed type warning - spoints = [[0, 0], [33, 0], [33, 25], [0, 25]] - epoints = [[3, 2], [32, 3], [30, 24], [2, 25]] - tensor = torch.randint(0, 256, (3, 26, 26)) - with pytest.warns( - UserWarning, - match=re.escape( - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " - "Please use InterpolationMode enum." - ), - ): - res1 = F.perspective(tensor, startpoints=spoints, endpoints=epoints, interpolation=2) - res2 = F.perspective(tensor, startpoints=spoints, endpoints=epoints, interpolation=BILINEAR) - assert_equal(res1, res2) - - @pytest.mark.parametrize("device", cpu_and_gpu()) @pytest.mark.parametrize("dt", [None, torch.float32, torch.float64, torch.float16]) @pytest.mark.parametrize( @@ -568,19 +520,6 @@ def test_resize_asserts(device): tensor, pil_img = _create_data(26, 36, device=device) - # assert changed type warning - with pytest.warns( - UserWarning, - match=re.escape( - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " - "Please use InterpolationMode enum." - ), - ): - res1 = F.resize(tensor, size=32, interpolation=2) - - res2 = F.resize(tensor, size=32, interpolation=BILINEAR) - assert_equal(res1, res2) - for img in (tensor, pil_img): exp_msg = "max_size should only be passed if size specifies the length of the smaller edge" with pytest.raises(ValueError, match=exp_msg): diff --git a/test/test_prototype_transforms_consistency.py b/test/test_prototype_transforms_consistency.py index 79a2b591a59..4ad968ba211 100644 --- a/test/test_prototype_transforms_consistency.py +++ b/test/test_prototype_transforms_consistency.py @@ -87,12 +87,6 @@ def __init__( ArgsKwargs((32, 29)), ArgsKwargs((31, 28), interpolation=prototype_transforms.InterpolationMode.NEAREST), ArgsKwargs((33, 26), interpolation=prototype_transforms.InterpolationMode.BICUBIC), - # FIXME: these are currently failing, since the new transform only supports the enum. The int input is - # already deprecated and scheduled to be removed in 0.15. Should we support ints on the prototype - # transform? I guess it depends if we roll out before 0.15 or not. - # ArgsKwargs((30, 27), interpolation=0), - # ArgsKwargs((35, 29), interpolation=2), - # ArgsKwargs((34, 25), interpolation=3), NotScriptableArgsKwargs(31, max_size=32), ArgsKwargs([31], max_size=32), NotScriptableArgsKwargs(30, max_size=100), diff --git a/test/test_transforms.py b/test/test_transforms.py index 0340f9f3f15..214f2963bfe 100644 --- a/test/test_transforms.py +++ b/test/test_transforms.py @@ -1872,17 +1872,6 @@ def test_random_rotation(): # Checking if RandomRotation can be printed as string t.__repr__() - # assert changed type warning - with pytest.warns( - UserWarning, - match=re.escape( - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " - "Please use InterpolationMode enum." - ), - ): - t = transforms.RandomRotation((-10, 10), interpolation=2) - assert t.interpolation == transforms.InterpolationMode.BILINEAR - def test_random_rotation_error(): # assert fill being either a Sequence or a Number @@ -2212,17 +2201,6 @@ def test_random_affine(): t = transforms.RandomAffine(10, interpolation=transforms.InterpolationMode.BILINEAR) assert "bilinear" in t.__repr__() - # assert changed type warning - with pytest.warns( - UserWarning, - match=re.escape( - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " - "Please use InterpolationMode enum." - ), - ): - t = transforms.RandomAffine(10, interpolation=2) - assert t.interpolation == transforms.InterpolationMode.BILINEAR - def test_elastic_transformation(): with pytest.raises(TypeError, match=r"alpha should be float or a sequence of floats"): diff --git a/torchvision/datasets/utils.py b/torchvision/datasets/utils.py index fb9de2e445d..86a489f15db 100644 --- a/torchvision/datasets/utils.py +++ b/torchvision/datasets/utils.py @@ -48,19 +48,6 @@ def _urlretrieve(url: str, filename: str, chunk_size: int = 1024 * 32) -> None: _save_response_content(iter(lambda: response.read(chunk_size), b""), filename, length=response.length) -def gen_bar_updater() -> Callable[[int, int, int], None]: - warnings.warn("The function `gen_bar_update` is deprecated since 0.13 and will be removed in 0.15.") - pbar = tqdm(total=None) - - def bar_update(count, block_size, total_size): - if pbar.total is None and total_size: - pbar.total = total_size - progress_bytes = count * block_size - pbar.update(progress_bytes - pbar.n) - - return bar_update - - def calculate_md5(fpath: str, chunk_size: int = 1024 * 1024) -> str: # Setting the `usedforsecurity` flag does not change anything about the functionality, but indicates that we are # not using the MD5 checksum for cryptography. This enables its usage in restricted environments like FIPS. Without diff --git a/torchvision/models/alexnet.py b/torchvision/models/alexnet.py index 5612fb45cff..4778a19a8ad 100644 --- a/torchvision/models/alexnet.py +++ b/torchvision/models/alexnet.py @@ -117,14 +117,3 @@ def alexnet(*, weights: Optional[AlexNet_Weights] = None, progress: bool = True, model.load_state_dict(weights.get_state_dict(progress=progress)) return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from ._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "alexnet": AlexNet_Weights.IMAGENET1K_V1.url, - } -) diff --git a/torchvision/models/densenet.py b/torchvision/models/densenet.py index 0668c76ef91..8253b9572b4 100644 --- a/torchvision/models/densenet.py +++ b/torchvision/models/densenet.py @@ -446,16 +446,3 @@ def densenet201(*, weights: Optional[DenseNet201_Weights] = None, progress: bool weights = DenseNet201_Weights.verify(weights) return _densenet(32, (6, 12, 48, 32), 64, weights, progress, **kwargs) - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from ._utils import _ModelURLs - -model_urls = _ModelURLs( - { - "densenet121": DenseNet121_Weights.IMAGENET1K_V1.url, - "densenet169": DenseNet169_Weights.IMAGENET1K_V1.url, - "densenet201": DenseNet201_Weights.IMAGENET1K_V1.url, - "densenet161": DenseNet161_Weights.IMAGENET1K_V1.url, - } -) diff --git a/torchvision/models/detection/faster_rcnn.py b/torchvision/models/detection/faster_rcnn.py index 1eaadaa2022..bda05211106 100644 --- a/torchvision/models/detection/faster_rcnn.py +++ b/torchvision/models/detection/faster_rcnn.py @@ -841,16 +841,3 @@ def fasterrcnn_mobilenet_v3_large_fpn( trainable_backbone_layers=trainable_backbone_layers, **kwargs, ) - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "fasterrcnn_resnet50_fpn_coco": FasterRCNN_ResNet50_FPN_Weights.COCO_V1.url, - "fasterrcnn_mobilenet_v3_large_320_fpn_coco": FasterRCNN_MobileNet_V3_Large_320_FPN_Weights.COCO_V1.url, - "fasterrcnn_mobilenet_v3_large_fpn_coco": FasterRCNN_MobileNet_V3_Large_FPN_Weights.COCO_V1.url, - } -) diff --git a/torchvision/models/detection/fcos.py b/torchvision/models/detection/fcos.py index a5c73c8b415..8c6f84ca5ff 100644 --- a/torchvision/models/detection/fcos.py +++ b/torchvision/models/detection/fcos.py @@ -769,14 +769,3 @@ def fcos_resnet50_fpn( model.load_state_dict(weights.get_state_dict(progress=progress)) return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "fcos_resnet50_fpn_coco": FCOS_ResNet50_FPN_Weights.COCO_V1.url, - } -) diff --git a/torchvision/models/detection/keypoint_rcnn.py b/torchvision/models/detection/keypoint_rcnn.py index 556ae7dc0d0..5db9911cac0 100644 --- a/torchvision/models/detection/keypoint_rcnn.py +++ b/torchvision/models/detection/keypoint_rcnn.py @@ -470,16 +470,3 @@ def keypointrcnn_resnet50_fpn( overwrite_eps(model, 0.0) return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - # legacy model for BC reasons, see https://github.com/pytorch/vision/issues/1606 - "keypointrcnn_resnet50_fpn_coco_legacy": KeypointRCNN_ResNet50_FPN_Weights.COCO_LEGACY.url, - "keypointrcnn_resnet50_fpn_coco": KeypointRCNN_ResNet50_FPN_Weights.COCO_V1.url, - } -) diff --git a/torchvision/models/detection/mask_rcnn.py b/torchvision/models/detection/mask_rcnn.py index df755e252cd..b2f2cbfe2e3 100644 --- a/torchvision/models/detection/mask_rcnn.py +++ b/torchvision/models/detection/mask_rcnn.py @@ -585,14 +585,3 @@ def maskrcnn_resnet50_fpn_v2( model.load_state_dict(weights.get_state_dict(progress=progress)) return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "maskrcnn_resnet50_fpn_coco": MaskRCNN_ResNet50_FPN_Weights.COCO_V1.url, - } -) diff --git a/torchvision/models/detection/retinanet.py b/torchvision/models/detection/retinanet.py index 44513d8e85c..3a14c983a64 100644 --- a/torchvision/models/detection/retinanet.py +++ b/torchvision/models/detection/retinanet.py @@ -897,14 +897,3 @@ def retinanet_resnet50_fpn_v2( model.load_state_dict(weights.get_state_dict(progress=progress)) return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "retinanet_resnet50_fpn_coco": RetinaNet_ResNet50_FPN_Weights.COCO_V1.url, - } -) diff --git a/torchvision/models/detection/ssd.py b/torchvision/models/detection/ssd.py index 8d75ff1894f..584798df7c1 100644 --- a/torchvision/models/detection/ssd.py +++ b/torchvision/models/detection/ssd.py @@ -680,25 +680,3 @@ def ssd300_vgg16( model.load_state_dict(weights.get_state_dict(progress=progress)) return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "ssd300_vgg16_coco": SSD300_VGG16_Weights.COCO_V1.url, - } -) - - -backbone_urls = _ModelURLs( - { - # We port the features of a VGG16 backbone trained by amdegroot because unlike the one on TorchVision, it uses - # the same input standardization method as the paper. - # Ref: https://s3.amazonaws.com/amdegroot-models/vgg16_reducedfc.pth - # Only the `features` weights have proper values, those on the `classifier` module are filled with nans. - "vgg16_features": VGG16_Weights.IMAGENET1K_FEATURES.url, - } -) diff --git a/torchvision/models/detection/ssdlite.py b/torchvision/models/detection/ssdlite.py index f06dcef521e..b1ef24ef14d 100644 --- a/torchvision/models/detection/ssdlite.py +++ b/torchvision/models/detection/ssdlite.py @@ -329,14 +329,3 @@ def ssdlite320_mobilenet_v3_large( model.load_state_dict(weights.get_state_dict(progress=progress)) return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "ssdlite320_mobilenet_v3_large_coco": SSDLite320_MobileNet_V3_Large_Weights.COCO_V1.url, - } -) diff --git a/torchvision/models/efficientnet.py b/torchvision/models/efficientnet.py index fc69771ce3c..bf8d4cee113 100644 --- a/torchvision/models/efficientnet.py +++ b/torchvision/models/efficientnet.py @@ -1,6 +1,5 @@ import copy import math -import warnings from dataclasses import dataclass from functools import partial from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union @@ -239,7 +238,6 @@ def __init__( num_classes: int = 1000, norm_layer: Optional[Callable[..., nn.Module]] = None, last_channel: Optional[int] = None, - **kwargs: Any, ) -> None: """ EfficientNet V1 and V2 main class @@ -263,16 +261,6 @@ def __init__( ): raise TypeError("The inverted_residual_setting should be List[MBConvConfig]") - if "block" in kwargs: - warnings.warn( - "The parameter 'block' is deprecated since 0.13 and will be removed 0.15. " - "Please pass this information on 'MBConvConfig.block' instead." - ) - if kwargs["block"] is not None: - for s in inverted_residual_setting: - if isinstance(s, MBConvConfig): - s.block = kwargs["block"] - if norm_layer is None: norm_layer = nn.BatchNorm2d @@ -1141,21 +1129,3 @@ def efficientnet_v2_l( norm_layer=partial(nn.BatchNorm2d, eps=1e-03), **kwargs, ) - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from ._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "efficientnet_b0": EfficientNet_B0_Weights.IMAGENET1K_V1.url, - "efficientnet_b1": EfficientNet_B1_Weights.IMAGENET1K_V1.url, - "efficientnet_b2": EfficientNet_B2_Weights.IMAGENET1K_V1.url, - "efficientnet_b3": EfficientNet_B3_Weights.IMAGENET1K_V1.url, - "efficientnet_b4": EfficientNet_B4_Weights.IMAGENET1K_V1.url, - "efficientnet_b5": EfficientNet_B5_Weights.IMAGENET1K_V1.url, - "efficientnet_b6": EfficientNet_B6_Weights.IMAGENET1K_V1.url, - "efficientnet_b7": EfficientNet_B7_Weights.IMAGENET1K_V1.url, - } -) diff --git a/torchvision/models/googlenet.py b/torchvision/models/googlenet.py index 02d379d73cd..947ae210e2d 100644 --- a/torchvision/models/googlenet.py +++ b/torchvision/models/googlenet.py @@ -343,15 +343,3 @@ def googlenet(*, weights: Optional[GoogLeNet_Weights] = None, progress: bool = T ) return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from ._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - # GoogLeNet ported from TensorFlow - "googlenet": GoogLeNet_Weights.IMAGENET1K_V1.url, - } -) diff --git a/torchvision/models/inception.py b/torchvision/models/inception.py index a7b2a8e440a..f7b00d49255 100644 --- a/torchvision/models/inception.py +++ b/torchvision/models/inception.py @@ -476,15 +476,3 @@ def inception_v3(*, weights: Optional[Inception_V3_Weights] = None, progress: bo model.AuxLogits = None return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from ._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - # Inception v3 ported from TensorFlow - "inception_v3_google": Inception_V3_Weights.IMAGENET1K_V1.url, - } -) diff --git a/torchvision/models/mobilenetv2.py b/torchvision/models/mobilenetv2.py index b6d59d10e64..451c553bc1a 100644 --- a/torchvision/models/mobilenetv2.py +++ b/torchvision/models/mobilenetv2.py @@ -258,14 +258,3 @@ def mobilenet_v2( model.load_state_dict(weights.get_state_dict(progress=progress)) return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from ._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "mobilenet_v2": MobileNet_V2_Weights.IMAGENET1K_V1.url, - } -) diff --git a/torchvision/models/mobilenetv3.py b/torchvision/models/mobilenetv3.py index 057fe26dba6..4489563e83f 100644 --- a/torchvision/models/mobilenetv3.py +++ b/torchvision/models/mobilenetv3.py @@ -421,15 +421,3 @@ def mobilenet_v3_small( inverted_residual_setting, last_channel = _mobilenet_v3_conf("mobilenet_v3_small", **kwargs) return _mobilenet_v3(inverted_residual_setting, last_channel, weights, progress, **kwargs) - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from ._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "mobilenet_v3_large": MobileNet_V3_Large_Weights.IMAGENET1K_V1.url, - "mobilenet_v3_small": MobileNet_V3_Small_Weights.IMAGENET1K_V1.url, - } -) diff --git a/torchvision/models/quantization/googlenet.py b/torchvision/models/quantization/googlenet.py index cb06594cde3..6998a2b5389 100644 --- a/torchvision/models/quantization/googlenet.py +++ b/torchvision/models/quantization/googlenet.py @@ -208,16 +208,3 @@ def googlenet( ) return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs -from ..googlenet import model_urls # noqa: F401 - - -quant_model_urls = _ModelURLs( - { - # fp32 GoogLeNet ported from TensorFlow, with weights quantized in PyTorch - "googlenet_fbgemm": GoogLeNet_QuantizedWeights.IMAGENET1K_FBGEMM_V1.url, - } -) diff --git a/torchvision/models/quantization/inception.py b/torchvision/models/quantization/inception.py index 46d4f6d66f9..3421095d780 100644 --- a/torchvision/models/quantization/inception.py +++ b/torchvision/models/quantization/inception.py @@ -271,16 +271,3 @@ def inception_v3( model.AuxLogits = None return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs -from ..inception import model_urls # noqa: F401 - - -quant_model_urls = _ModelURLs( - { - # fp32 weights ported from TensorFlow, quantized in PyTorch - "inception_v3_google_fbgemm": Inception_V3_QuantizedWeights.IMAGENET1K_FBGEMM_V1.url, - } -) diff --git a/torchvision/models/quantization/mobilenetv2.py b/torchvision/models/quantization/mobilenetv2.py index 8561c3cac40..1ac08f0416f 100644 --- a/torchvision/models/quantization/mobilenetv2.py +++ b/torchvision/models/quantization/mobilenetv2.py @@ -152,15 +152,3 @@ def mobilenet_v2( model.load_state_dict(weights.get_state_dict(progress=progress)) return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs -from ..mobilenetv2 import model_urls # noqa: F401 - - -quant_model_urls = _ModelURLs( - { - "mobilenet_v2_qnnpack": MobileNet_V2_QuantizedWeights.IMAGENET1K_QNNPACK_V1.url, - } -) diff --git a/torchvision/models/quantization/mobilenetv3.py b/torchvision/models/quantization/mobilenetv3.py index 4ee9434c839..e5686f02040 100644 --- a/torchvision/models/quantization/mobilenetv3.py +++ b/torchvision/models/quantization/mobilenetv3.py @@ -235,15 +235,3 @@ def mobilenet_v3_large( inverted_residual_setting, last_channel = _mobilenet_v3_conf("mobilenet_v3_large", **kwargs) return _mobilenet_v3_model(inverted_residual_setting, last_channel, weights, progress, quantize, **kwargs) - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs -from ..mobilenetv3 import model_urls # noqa: F401 - - -quant_model_urls = _ModelURLs( - { - "mobilenet_v3_large_qnnpack": MobileNet_V3_Large_QuantizedWeights.IMAGENET1K_QNNPACK_V1.url, - } -) diff --git a/torchvision/models/quantization/resnet.py b/torchvision/models/quantization/resnet.py index 0f376f5c906..18ccff66964 100644 --- a/torchvision/models/quantization/resnet.py +++ b/torchvision/models/quantization/resnet.py @@ -482,17 +482,3 @@ def resnext101_64x4d( _ovewrite_named_param(kwargs, "groups", 64) _ovewrite_named_param(kwargs, "width_per_group", 4) return _resnet(QuantizableBottleneck, [3, 4, 23, 3], weights, progress, quantize, **kwargs) - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs -from ..resnet import model_urls # noqa: F401 - - -quant_model_urls = _ModelURLs( - { - "resnet18_fbgemm": ResNet18_QuantizedWeights.IMAGENET1K_FBGEMM_V1.url, - "resnet50_fbgemm": ResNet50_QuantizedWeights.IMAGENET1K_FBGEMM_V1.url, - "resnext101_32x8d_fbgemm": ResNeXt101_32X8D_QuantizedWeights.IMAGENET1K_FBGEMM_V1.url, - } -) diff --git a/torchvision/models/quantization/shufflenetv2.py b/torchvision/models/quantization/shufflenetv2.py index d18b08bb2ee..d41a8444954 100644 --- a/torchvision/models/quantization/shufflenetv2.py +++ b/torchvision/models/quantization/shufflenetv2.py @@ -425,16 +425,3 @@ def shufflenet_v2_x2_0( return _shufflenetv2( [4, 8, 4], [24, 244, 488, 976, 2048], weights=weights, progress=progress, quantize=quantize, **kwargs ) - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs -from ..shufflenetv2 import model_urls # noqa: F401 - - -quant_model_urls = _ModelURLs( - { - "shufflenetv2_x0.5_fbgemm": ShuffleNet_V2_X0_5_QuantizedWeights.IMAGENET1K_FBGEMM_V1.url, - "shufflenetv2_x1.0_fbgemm": ShuffleNet_V2_X1_0_QuantizedWeights.IMAGENET1K_FBGEMM_V1.url, - } -) diff --git a/torchvision/models/regnet.py b/torchvision/models/regnet.py index a971dc09b33..e887640e872 100644 --- a/torchvision/models/regnet.py +++ b/torchvision/models/regnet.py @@ -1569,27 +1569,3 @@ def regnet_x_32gf(*, weights: Optional[RegNet_X_32GF_Weights] = None, progress: params = BlockParams.from_init_params(depth=23, w_0=320, w_a=69.86, w_m=2.0, group_width=168, **kwargs) return _regnet(params, weights, progress, **kwargs) - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from ._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "regnet_y_400mf": RegNet_Y_400MF_Weights.IMAGENET1K_V1.url, - "regnet_y_800mf": RegNet_Y_800MF_Weights.IMAGENET1K_V1.url, - "regnet_y_1_6gf": RegNet_Y_1_6GF_Weights.IMAGENET1K_V1.url, - "regnet_y_3_2gf": RegNet_Y_3_2GF_Weights.IMAGENET1K_V1.url, - "regnet_y_8gf": RegNet_Y_8GF_Weights.IMAGENET1K_V1.url, - "regnet_y_16gf": RegNet_Y_16GF_Weights.IMAGENET1K_V1.url, - "regnet_y_32gf": RegNet_Y_32GF_Weights.IMAGENET1K_V1.url, - "regnet_x_400mf": RegNet_X_400MF_Weights.IMAGENET1K_V1.url, - "regnet_x_800mf": RegNet_X_800MF_Weights.IMAGENET1K_V1.url, - "regnet_x_1_6gf": RegNet_X_1_6GF_Weights.IMAGENET1K_V1.url, - "regnet_x_3_2gf": RegNet_X_3_2GF_Weights.IMAGENET1K_V1.url, - "regnet_x_8gf": RegNet_X_8GF_Weights.IMAGENET1K_V1.url, - "regnet_x_16gf": RegNet_X_16GF_Weights.IMAGENET1K_V1.url, - "regnet_x_32gf": RegNet_X_32GF_Weights.IMAGENET1K_V1.url, - } -) diff --git a/torchvision/models/resnet.py b/torchvision/models/resnet.py index 1d3638917fe..40c8afb9a5a 100644 --- a/torchvision/models/resnet.py +++ b/torchvision/models/resnet.py @@ -983,22 +983,3 @@ def wide_resnet101_2( _ovewrite_named_param(kwargs, "width_per_group", 64 * 2) return _resnet(Bottleneck, [3, 4, 23, 3], weights, progress, **kwargs) - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from ._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "resnet18": ResNet18_Weights.IMAGENET1K_V1.url, - "resnet34": ResNet34_Weights.IMAGENET1K_V1.url, - "resnet50": ResNet50_Weights.IMAGENET1K_V1.url, - "resnet101": ResNet101_Weights.IMAGENET1K_V1.url, - "resnet152": ResNet152_Weights.IMAGENET1K_V1.url, - "resnext50_32x4d": ResNeXt50_32X4D_Weights.IMAGENET1K_V1.url, - "resnext101_32x8d": ResNeXt101_32X8D_Weights.IMAGENET1K_V1.url, - "wide_resnet50_2": Wide_ResNet50_2_Weights.IMAGENET1K_V1.url, - "wide_resnet101_2": Wide_ResNet101_2_Weights.IMAGENET1K_V1.url, - } -) diff --git a/torchvision/models/segmentation/deeplabv3.py b/torchvision/models/segmentation/deeplabv3.py index b08889538b1..5f615d2c9f0 100644 --- a/torchvision/models/segmentation/deeplabv3.py +++ b/torchvision/models/segmentation/deeplabv3.py @@ -388,16 +388,3 @@ def deeplabv3_mobilenet_v3_large( model.load_state_dict(weights.get_state_dict(progress=progress)) return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "deeplabv3_resnet50_coco": DeepLabV3_ResNet50_Weights.COCO_WITH_VOC_LABELS_V1.url, - "deeplabv3_resnet101_coco": DeepLabV3_ResNet101_Weights.COCO_WITH_VOC_LABELS_V1.url, - "deeplabv3_mobilenet_v3_large_coco": DeepLabV3_MobileNet_V3_Large_Weights.COCO_WITH_VOC_LABELS_V1.url, - } -) diff --git a/torchvision/models/segmentation/fcn.py b/torchvision/models/segmentation/fcn.py index fc13f1d7d18..7a270c99da2 100644 --- a/torchvision/models/segmentation/fcn.py +++ b/torchvision/models/segmentation/fcn.py @@ -230,15 +230,3 @@ def fcn_resnet101( model.load_state_dict(weights.get_state_dict(progress=progress)) return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "fcn_resnet50_coco": FCN_ResNet50_Weights.COCO_WITH_VOC_LABELS_V1.url, - "fcn_resnet101_coco": FCN_ResNet101_Weights.COCO_WITH_VOC_LABELS_V1.url, - } -) diff --git a/torchvision/models/segmentation/lraspp.py b/torchvision/models/segmentation/lraspp.py index d8a1d4ed7bb..ac1509d090a 100644 --- a/torchvision/models/segmentation/lraspp.py +++ b/torchvision/models/segmentation/lraspp.py @@ -176,14 +176,3 @@ def lraspp_mobilenet_v3_large( model.load_state_dict(weights.get_state_dict(progress=progress)) return model - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from .._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "lraspp_mobilenet_v3_large_coco": LRASPP_MobileNet_V3_Large_Weights.COCO_WITH_VOC_LABELS_V1.url, - } -) diff --git a/torchvision/models/shufflenetv2.py b/torchvision/models/shufflenetv2.py index 99583e3b91b..ba6056854e5 100644 --- a/torchvision/models/shufflenetv2.py +++ b/torchvision/models/shufflenetv2.py @@ -406,17 +406,3 @@ def shufflenet_v2_x2_0( weights = ShuffleNet_V2_X2_0_Weights.verify(weights) return _shufflenetv2(weights, progress, [4, 8, 4], [24, 244, 488, 976, 2048], **kwargs) - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from ._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "shufflenetv2_x0.5": ShuffleNet_V2_X0_5_Weights.IMAGENET1K_V1.url, - "shufflenetv2_x1.0": ShuffleNet_V2_X1_0_Weights.IMAGENET1K_V1.url, - "shufflenetv2_x1.5": None, - "shufflenetv2_x2.0": None, - } -) diff --git a/torchvision/models/squeezenet.py b/torchvision/models/squeezenet.py index 80ee7982e44..84097c24000 100644 --- a/torchvision/models/squeezenet.py +++ b/torchvision/models/squeezenet.py @@ -221,15 +221,3 @@ def squeezenet1_1( """ weights = SqueezeNet1_1_Weights.verify(weights) return _squeezenet("1_1", weights, progress, **kwargs) - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from ._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "squeezenet1_0": SqueezeNet1_0_Weights.IMAGENET1K_V1.url, - "squeezenet1_1": SqueezeNet1_1_Weights.IMAGENET1K_V1.url, - } -) diff --git a/torchvision/models/vgg.py b/torchvision/models/vgg.py index fca69928ac6..4bf1a8317f6 100644 --- a/torchvision/models/vgg.py +++ b/torchvision/models/vgg.py @@ -509,21 +509,3 @@ def vgg19_bn(*, weights: Optional[VGG19_BN_Weights] = None, progress: bool = Tru weights = VGG19_BN_Weights.verify(weights) return _vgg("E", True, weights, progress, **kwargs) - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from ._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "vgg11": VGG11_Weights.IMAGENET1K_V1.url, - "vgg13": VGG13_Weights.IMAGENET1K_V1.url, - "vgg16": VGG16_Weights.IMAGENET1K_V1.url, - "vgg19": VGG19_Weights.IMAGENET1K_V1.url, - "vgg11_bn": VGG11_BN_Weights.IMAGENET1K_V1.url, - "vgg13_bn": VGG13_BN_Weights.IMAGENET1K_V1.url, - "vgg16_bn": VGG16_BN_Weights.IMAGENET1K_V1.url, - "vgg19_bn": VGG19_BN_Weights.IMAGENET1K_V1.url, - } -) diff --git a/torchvision/models/vision_transformer.py b/torchvision/models/vision_transformer.py index 10a41444d9a..1e307531128 100644 --- a/torchvision/models/vision_transformer.py +++ b/torchvision/models/vision_transformer.py @@ -862,17 +862,3 @@ def interpolate_embeddings( model_state = model_state_copy return model_state - - -# The dictionary below is internal implementation detail and will be removed in v0.15 -from ._utils import _ModelURLs - - -model_urls = _ModelURLs( - { - "vit_b_16": ViT_B_16_Weights.IMAGENET1K_V1.url, - "vit_b_32": ViT_B_32_Weights.IMAGENET1K_V1.url, - "vit_l_16": ViT_L_16_Weights.IMAGENET1K_V1.url, - "vit_l_32": ViT_L_32_Weights.IMAGENET1K_V1.url, - } -) diff --git a/torchvision/transforms/functional.py b/torchvision/transforms/functional.py index 67399274b5f..abf827a08c7 100644 --- a/torchvision/transforms/functional.py +++ b/torchvision/transforms/functional.py @@ -421,8 +421,6 @@ def resize( Default is ``InterpolationMode.BILINEAR``. If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.NEAREST_EXACT``, ``InterpolationMode.BILINEAR`` and ``InterpolationMode.BICUBIC`` are supported. - For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still accepted, - but deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum. max_size (int, optional): The maximum allowed for the longer edge of the resized image: if the longer edge of the image is greater than ``max_size`` after being resized according to ``size``, then @@ -441,13 +439,6 @@ def resize( """ if not torch.jit.is_scripting() and not torch.jit.is_tracing(): _log_api_usage_once(resize) - # Backward compatibility with integer value - if isinstance(interpolation, int): - warnings.warn( - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " - "Please use InterpolationMode enum." - ) - interpolation = _interpolation_modes_from_int(interpolation) if not isinstance(interpolation, InterpolationMode): raise TypeError("Argument interpolation should be a InterpolationMode") @@ -623,8 +614,6 @@ def resized_crop( Default is ``InterpolationMode.BILINEAR``. If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.NEAREST_EXACT``, ``InterpolationMode.BILINEAR`` and ``InterpolationMode.BICUBIC`` are supported. - For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still accepted, - but deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum. antialias (bool, optional): antialias flag. If ``img`` is PIL Image, the flag is ignored and anti-alias is always used. If ``img`` is Tensor, the flag is False by default and can be set to True for ``InterpolationMode.BILINEAR`` and ``InterpolationMode.BICUBIC`` modes. @@ -707,8 +696,6 @@ def perspective( interpolation (InterpolationMode): Desired interpolation enum defined by :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.BILINEAR``. If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported. - For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still accepted, - but deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum. fill (sequence or number, optional): Pixel fill value for the area outside the transformed image. If given a number, the value is used for all bands respectively. @@ -724,14 +711,6 @@ def perspective( coeffs = _get_perspective_coeffs(startpoints, endpoints) - # Backward compatibility with integer value - if isinstance(interpolation, int): - warnings.warn( - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " - "Please use InterpolationMode enum." - ) - interpolation = _interpolation_modes_from_int(interpolation) - if not isinstance(interpolation, InterpolationMode): raise TypeError("Argument interpolation should be a InterpolationMode") @@ -1067,8 +1046,6 @@ def rotate( interpolation (InterpolationMode): Desired interpolation enum defined by :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``. If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported. - For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still accepted, - but deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum. expand (bool, optional): Optional expansion flag. If true, expands the output image to make it large enough to hold the entire rotated image. If false or omitted, make the output image the same size as the input image. @@ -1090,14 +1067,6 @@ def rotate( if not torch.jit.is_scripting() and not torch.jit.is_tracing(): _log_api_usage_once(rotate) - # Backward compatibility with integer value - if isinstance(interpolation, int): - warnings.warn( - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " - "Please use InterpolationMode enum." - ) - interpolation = _interpolation_modes_from_int(interpolation) - if not isinstance(angle, (int, float)): raise TypeError("Argument angle should be int or float") @@ -1148,8 +1117,6 @@ def affine( interpolation (InterpolationMode): Desired interpolation enum defined by :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``. If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported. - For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still accepted, - but deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum. fill (sequence or number, optional): Pixel fill value for the area outside the transformed image. If given a number, the value is used for all bands respectively. @@ -1165,14 +1132,6 @@ def affine( if not torch.jit.is_scripting() and not torch.jit.is_tracing(): _log_api_usage_once(affine) - # Backward compatibility with integer value - if isinstance(interpolation, int): - warnings.warn( - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " - "Please use InterpolationMode enum." - ) - interpolation = _interpolation_modes_from_int(interpolation) - if not isinstance(angle, (int, float)): raise TypeError("Argument angle should be int or float") diff --git a/torchvision/transforms/transforms.py b/torchvision/transforms/transforms.py index 18b87946a67..9395ca674f4 100644 --- a/torchvision/transforms/transforms.py +++ b/torchvision/transforms/transforms.py @@ -298,8 +298,6 @@ class Resize(torch.nn.Module): :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.BILINEAR``. If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.NEAREST_EXACT``, ``InterpolationMode.BILINEAR`` and ``InterpolationMode.BICUBIC`` are supported. - For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still accepted, - but deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum. max_size (int, optional): The maximum allowed for the longer edge of the resized image: if the longer edge of the image is greater than ``max_size`` after being resized according to ``size``, then @@ -324,14 +322,6 @@ def __init__(self, size, interpolation=InterpolationMode.BILINEAR, max_size=None self.size = size self.max_size = max_size - # Backward compatibility with integer value - if isinstance(interpolation, int): - warnings.warn( - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " - "Please use InterpolationMode enum." - ) - interpolation = _interpolation_modes_from_int(interpolation) - self.interpolation = interpolation self.antialias = antialias @@ -752,8 +742,6 @@ class RandomPerspective(torch.nn.Module): interpolation (InterpolationMode): Desired interpolation enum defined by :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.BILINEAR``. If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported. - For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still accepted, - but deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum. fill (sequence or number): Pixel fill value for the area outside the transformed image. Default is ``0``. If given a number, the value is used for all bands respectively. """ @@ -763,14 +751,6 @@ def __init__(self, distortion_scale=0.5, p=0.5, interpolation=InterpolationMode. _log_api_usage_once(self) self.p = p - # Backward compatibility with integer value - if isinstance(interpolation, int): - warnings.warn( - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " - "Please use InterpolationMode enum." - ) - interpolation = _interpolation_modes_from_int(interpolation) - self.interpolation = interpolation self.distortion_scale = distortion_scale @@ -867,8 +847,6 @@ class RandomResizedCrop(torch.nn.Module): :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.BILINEAR``. If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.NEAREST_EXACT``, ``InterpolationMode.BILINEAR`` and ``InterpolationMode.BICUBIC`` are supported. - For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still accepted, - but deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum. antialias (bool, optional): antialias flag. If ``img`` is PIL Image, the flag is ignored and anti-alias is always used. If ``img`` is Tensor, the flag is False by default and can be set to True for ``InterpolationMode.BILINEAR`` and ``InterpolationMode.BICUBIC`` modes. @@ -894,14 +872,6 @@ def __init__( if (scale[0] > scale[1]) or (ratio[0] > ratio[1]): warnings.warn("Scale and ratio should be of kind (min, max)") - # Backward compatibility with integer value - if isinstance(interpolation, int): - warnings.warn( - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " - "Please use InterpolationMode enum." - ) - interpolation = _interpolation_modes_from_int(interpolation) - self.interpolation = interpolation self.antialias = antialias self.scale = scale @@ -1288,8 +1258,6 @@ class RandomRotation(torch.nn.Module): interpolation (InterpolationMode): Desired interpolation enum defined by :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``. If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported. - For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still accepted, - but deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum. expand (bool, optional): Optional expansion flag. If true, expands the output to make it large enough to hold the entire rotated image. If false or omitted, make the output image the same size as the input image. @@ -1307,14 +1275,6 @@ def __init__(self, degrees, interpolation=InterpolationMode.NEAREST, expand=Fals super().__init__() _log_api_usage_once(self) - # Backward compatibility with integer value - if isinstance(interpolation, int): - warnings.warn( - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " - "Please use InterpolationMode enum." - ) - interpolation = _interpolation_modes_from_int(interpolation) - self.degrees = _setup_angle(degrees, name="degrees", req_sizes=(2,)) if center is not None: @@ -1398,8 +1358,6 @@ class RandomAffine(torch.nn.Module): interpolation (InterpolationMode): Desired interpolation enum defined by :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``. If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported. - For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still accepted, - but deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum. fill (sequence or number): Pixel fill value for the area outside the transformed image. Default is ``0``. If given a number, the value is used for all bands respectively. center (sequence, optional): Optional center of rotation, (x, y). Origin is the upper left corner. @@ -1422,14 +1380,6 @@ def __init__( super().__init__() _log_api_usage_once(self) - # Backward compatibility with integer value - if isinstance(interpolation, int): - warnings.warn( - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " - "Please use InterpolationMode enum." - ) - interpolation = _interpolation_modes_from_int(interpolation) - self.degrees = _setup_angle(degrees, name="degrees", req_sizes=(2,)) if translate is not None: