Skip to content

handle_legacy_interface raises warning when passing weights=SomeString #5058

@NicolasHug

Description

@NicolasHug

handle_legacy_interface raises a warning when passing weights as strings. This leads to warnings in the training references which all rely on strings rather than weight instances.

from torchvision.prototype.models import resnet18, ResNet18_Weights
resnet18(weights="ResNet18_Weights.ImageNet1K_V1")  # warning
resnet18(weights=ResNet18_Weights.ImageNet1K_V1)  # no warning, all good

The warning is

 other than a weight enum or `None` for 'weights' are deprecated. The current behavior is equivalent to passing `weights=ResNet18_Weights.ImageNet1K_V1`. You can also use `weights=ResNet18_Weights.default` to get the most up-to-date weights.

CC @pmeier @datumbox

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions