diff --git a/torchvision/models/_utils.py b/torchvision/models/_utils.py index 08c878a8a67..c565f611999 100644 --- a/torchvision/models/_utils.py +++ b/torchvision/models/_utils.py @@ -134,7 +134,8 @@ def wrapper(*args: Any, **kwargs: Any) -> D: keyword_only_kwargs = dict(zip(keyword_only_params, keyword_only_args)) warnings.warn( f"Using {sequence_to_str(tuple(keyword_only_kwargs.keys()), separate_last='and ')} as positional " - f"parameter(s) is deprecated. Please use keyword parameter(s) instead." + f"parameter(s) is deprecated since 0.13 and will be removed in 0.15. Please use keyword parameter(s) " + f"instead." ) kwargs.update(keyword_only_kwargs) @@ -205,11 +206,13 @@ def inner_wrapper(*args: Any, **kwargs: Any) -> M: if not pretrained_positional: warnings.warn( - f"The parameter '{pretrained_param}' is deprecated, please use '{weights_param}' instead." + f"The parameter '{pretrained_param}' is deprecated since 0.13 and will be removed in 0.15, " + f"please use '{weights_param}' instead." ) msg = ( - f"Arguments other than a weight enum or `None` for '{weights_param}' are deprecated. " + f"Arguments other than a weight enum or `None` for '{weights_param}' are deprecated since 0.13 and " + f"will be removed in 0.15. " f"The current behavior is equivalent to passing `{weights_param}={default_weights_arg}`." ) if pretrained_arg: @@ -242,3 +245,12 @@ def _ovewrite_value_param(param: Optional[V], new_value: V) -> V: if param != new_value: raise ValueError(f"The parameter '{param}' expected value {new_value} but got {param} instead.") return new_value + + +class _ModelURLs(dict): + def __getitem__(self, item): + warnings.warn( + "Accessing the model URLs via the internal dictionary of the module is deprecated since 0.13 and will " + "be removed in 0.15. Please access them via the appropriate Weights Enum instead." + ) + return super().__getitem__(item) diff --git a/torchvision/models/alexnet.py b/torchvision/models/alexnet.py index 97877c52060..6c9ae4932d7 100644 --- a/torchvision/models/alexnet.py +++ b/torchvision/models/alexnet.py @@ -111,3 +111,14 @@ 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 2fb60fc68cc..bf46b113691 100644 --- a/torchvision/models/densenet.py +++ b/torchvision/models/densenet.py @@ -430,3 +430,17 @@ 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 9a0ce20410e..afe66ead646 100644 --- a/torchvision/models/detection/faster_rcnn.py +++ b/torchvision/models/detection/faster_rcnn.py @@ -804,3 +804,16 @@ 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 54094d2fa22..684b52100db 100644 --- a/torchvision/models/detection/fcos.py +++ b/torchvision/models/detection/fcos.py @@ -758,3 +758,14 @@ 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 c551ba4b9ec..410c53d60b7 100644 --- a/torchvision/models/detection/keypoint_rcnn.py +++ b/torchvision/models/detection/keypoint_rcnn.py @@ -454,3 +454,16 @@ 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 1b8eaa4b168..6b1ba04a195 100644 --- a/torchvision/models/detection/mask_rcnn.py +++ b/torchvision/models/detection/mask_rcnn.py @@ -565,3 +565,14 @@ 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 4a5f9b78b4a..0cb4979d332 100644 --- a/torchvision/models/detection/retinanet.py +++ b/torchvision/models/detection/retinanet.py @@ -879,3 +879,14 @@ 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 d83147f81f5..7e5625329be 100644 --- a/torchvision/models/detection/ssd.py +++ b/torchvision/models/detection/ssd.py @@ -672,3 +672,25 @@ 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 b23490bc295..f94758cb166 100644 --- a/torchvision/models/detection/ssdlite.py +++ b/torchvision/models/detection/ssdlite.py @@ -321,3 +321,14 @@ 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 1e42e235a20..be166140209 100644 --- a/torchvision/models/efficientnet.py +++ b/torchvision/models/efficientnet.py @@ -1028,3 +1028,23 @@ 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( + { + # Weights ported from https://github.com/rwightman/pytorch-image-models/ + "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, + # Weights ported from https://github.com/lukemelas/EfficientNet-PyTorch/ + "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 a8a4c8bc3b9..37c20d72cdd 100644 --- a/torchvision/models/googlenet.py +++ b/torchvision/models/googlenet.py @@ -339,3 +339,15 @@ 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 e8eecca5db6..5b89a1e5c9a 100644 --- a/torchvision/models/inception.py +++ b/torchvision/models/inception.py @@ -471,3 +471,15 @@ 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 ab7b69ed005..d63ecb01f38 100644 --- a/torchvision/models/mobilenetv2.py +++ b/torchvision/models/mobilenetv2.py @@ -263,3 +263,14 @@ 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 910e8fbf04b..787526cc1b3 100644 --- a/torchvision/models/mobilenetv3.py +++ b/torchvision/models/mobilenetv3.py @@ -414,3 +414,15 @@ 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 4dbfa8065c3..36ec453a38f 100644 --- a/torchvision/models/quantization/googlenet.py +++ b/torchvision/models/quantization/googlenet.py @@ -200,3 +200,16 @@ 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 ed53d43e8af..e774f4ce155 100644 --- a/torchvision/models/quantization/inception.py +++ b/torchvision/models/quantization/inception.py @@ -251,3 +251,16 @@ 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 bb0bf0b79ed..2d73cc77008 100644 --- a/torchvision/models/quantization/mobilenetv2.py +++ b/torchvision/models/quantization/mobilenetv2.py @@ -131,3 +131,15 @@ 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 2d18446c13f..06e8228cdaf 100644 --- a/torchvision/models/quantization/mobilenetv3.py +++ b/torchvision/models/quantization/mobilenetv3.py @@ -211,3 +211,15 @@ 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 23df64c86c0..88d4f1871de 100644 --- a/torchvision/models/quantization/resnet.py +++ b/torchvision/models/quantization/resnet.py @@ -362,3 +362,17 @@ 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 cfbdc5b0c24..90a4f298ac9 100644 --- a/torchvision/models/quantization/shufflenetv2.py +++ b/torchvision/models/quantization/shufflenetv2.py @@ -298,3 +298,16 @@ 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 3e2370fd7b0..2376d13ffe8 100644 --- a/torchvision/models/regnet.py +++ b/torchvision/models/regnet.py @@ -1330,3 +1330,27 @@ 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 66d3b9d6370..f2910cdc281 100644 --- a/torchvision/models/resnet.py +++ b/torchvision/models/resnet.py @@ -853,3 +853,22 @@ 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 a961c4e0b2b..57ccc377c2d 100644 --- a/torchvision/models/segmentation/deeplabv3.py +++ b/torchvision/models/segmentation/deeplabv3.py @@ -365,3 +365,16 @@ 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 55b60f312d9..fe8c82d8d4d 100644 --- a/torchvision/models/segmentation/fcn.py +++ b/torchvision/models/segmentation/fcn.py @@ -212,3 +212,15 @@ 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 f6a0c662cda..bcbba7f14fe 100644 --- a/torchvision/models/segmentation/lraspp.py +++ b/torchvision/models/segmentation/lraspp.py @@ -165,3 +165,14 @@ 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 dc8efbc670d..ec7d59817ab 100644 --- a/torchvision/models/shufflenetv2.py +++ b/torchvision/models/shufflenetv2.py @@ -374,3 +374,17 @@ 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 c01b4d576d6..afe9c18887f 100644 --- a/torchvision/models/squeezenet.py +++ b/torchvision/models/squeezenet.py @@ -213,3 +213,15 @@ 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 68cbae7957d..6b82f90d58b 100644 --- a/torchvision/models/vgg.py +++ b/torchvision/models/vgg.py @@ -461,3 +461,21 @@ 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/video/resnet.py b/torchvision/models/video/resnet.py index 5b0d7d99bca..320df6576ac 100644 --- a/torchvision/models/video/resnet.py +++ b/torchvision/models/video/resnet.py @@ -463,3 +463,16 @@ def r2plus1d_18(*, weights: Optional[R2Plus1D_18_Weights] = None, progress: bool progress, **kwargs, ) + + +# The dictionary below is internal implementation detail and will be removed in v0.15 +from .._utils import _ModelURLs + + +model_urls = _ModelURLs( + { + "r3d_18": R3D_18_Weights.KINETICS400_V1.url, + "mc3_18": MC3_18_Weights.KINETICS400_V1.url, + "r2plus1d_18": R2Plus1D_18_Weights.KINETICS400_V1.url, + } +) diff --git a/torchvision/models/vision_transformer.py b/torchvision/models/vision_transformer.py index 60ad2d4924a..e672721be65 100644 --- a/torchvision/models/vision_transformer.py +++ b/torchvision/models/vision_transformer.py @@ -746,3 +746,17 @@ 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, + } +)