From 1b7a757ed728f62a809258c94d680771cc6f3a83 Mon Sep 17 00:00:00 2001 From: Yosua Michael Maranatha Date: Tue, 27 Sep 2022 16:46:40 +0100 Subject: [PATCH 1/6] Update the expected removal date for several deprecated API --- torchvision/models/_utils.py | 2 +- torchvision/transforms/_functional_video.py | 2 +- torchvision/transforms/_transforms_video.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/torchvision/models/_utils.py b/torchvision/models/_utils.py index 7c67ea4ec91..b8e94f8ea83 100644 --- a/torchvision/models/_utils.py +++ b/torchvision/models/_utils.py @@ -206,7 +206,7 @@ def inner_wrapper(*args: Any, **kwargs: Any) -> M: if not pretrained_positional: warnings.warn( - f"The parameter '{pretrained_param}' is deprecated since 0.13 and will be removed in 0.15, " + f"The parameter '{pretrained_param}' is deprecated since 0.13 and will be removed in the future, " f"please use '{weights_param}' instead." ) diff --git a/torchvision/transforms/_functional_video.py b/torchvision/transforms/_functional_video.py index f969a2542d0..91df7d42cd7 100644 --- a/torchvision/transforms/_functional_video.py +++ b/torchvision/transforms/_functional_video.py @@ -4,7 +4,7 @@ warnings.warn( - "The 'torchvision.transforms._functional_video' module is deprecated since 0.12 and will be removed in 0.14. " + "The 'torchvision.transforms._functional_video' module is deprecated since 0.12 and will be removed in the future. " "Please use the 'torchvision.transforms.functional' module instead." ) diff --git a/torchvision/transforms/_transforms_video.py b/torchvision/transforms/_transforms_video.py index 1ed6de7612d..a67eca5ff4c 100644 --- a/torchvision/transforms/_transforms_video.py +++ b/torchvision/transforms/_transforms_video.py @@ -20,7 +20,7 @@ warnings.warn( - "The 'torchvision.transforms._transforms_video' module is deprecated since 0.12 and will be removed in 0.14. " + "The 'torchvision.transforms._transforms_video' module is deprecated since 0.12 and will be removed in the future. " "Please use the 'torchvision.transforms' module instead." ) From 04a1ff84fd9f2a32d09ce62f2fd7c2d609d964f2 Mon Sep 17 00:00:00 2001 From: Yosua Michael Maranatha Date: Wed, 28 Sep 2022 11:02:00 +0100 Subject: [PATCH 2/6] Revert the change in models/_utils.py --- torchvision/models/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchvision/models/_utils.py b/torchvision/models/_utils.py index b8e94f8ea83..7c67ea4ec91 100644 --- a/torchvision/models/_utils.py +++ b/torchvision/models/_utils.py @@ -206,7 +206,7 @@ def inner_wrapper(*args: Any, **kwargs: Any) -> M: if not pretrained_positional: warnings.warn( - f"The parameter '{pretrained_param}' is deprecated since 0.13 and will be removed in the future, " + f"The parameter '{pretrained_param}' is deprecated since 0.13 and will be removed in 0.15, " f"please use '{weights_param}' instead." ) From 4fc6f6ab636a1325876b770541fb5df69e818437 Mon Sep 17 00:00:00 2001 From: Yosua Michael Maranatha Date: Thu, 29 Sep 2022 11:44:02 +0100 Subject: [PATCH 3/6] Remove removal date on pretrained=True --- torchvision/models/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchvision/models/_utils.py b/torchvision/models/_utils.py index 7c67ea4ec91..7cf0ebc09ee 100644 --- a/torchvision/models/_utils.py +++ b/torchvision/models/_utils.py @@ -206,7 +206,7 @@ def inner_wrapper(*args: Any, **kwargs: Any) -> M: if not pretrained_positional: warnings.warn( - f"The parameter '{pretrained_param}' is deprecated since 0.13 and will be removed in 0.15, " + f"The parameter '{pretrained_param}' is deprecated since 0.13 and may be removed in the future, " f"please use '{weights_param}' instead." ) From 4d3a5dc37fd4b9126892e637a86a2ba3df5e5f11 Mon Sep 17 00:00:00 2001 From: Yosua Michael Maranatha Date: Thu, 29 Sep 2022 13:01:50 +0100 Subject: [PATCH 4/6] Update another message related to pretrained=True --- torchvision/models/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchvision/models/_utils.py b/torchvision/models/_utils.py index 7cf0ebc09ee..c851cf33525 100644 --- a/torchvision/models/_utils.py +++ b/torchvision/models/_utils.py @@ -212,7 +212,7 @@ def inner_wrapper(*args: Any, **kwargs: Any) -> M: msg = ( 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"may be removed in the future. " f"The current behavior is equivalent to passing `{weights_param}={default_weights_arg}`." ) if pretrained_arg: From bc012c67ed2744fb7a7c84caf3c1b96b03d9563d Mon Sep 17 00:00:00 2001 From: Yosua Michael Maranatha Date: Thu, 29 Sep 2022 13:59:24 +0100 Subject: [PATCH 5/6] Also update the warning in kwonly_to_pos_or_kw decorator --- torchvision/models/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchvision/models/_utils.py b/torchvision/models/_utils.py index c851cf33525..31ed991ddbf 100644 --- a/torchvision/models/_utils.py +++ b/torchvision/models/_utils.py @@ -134,7 +134,7 @@ 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 since 0.13 and will be removed in 0.15. Please use keyword parameter(s) " + f"parameter(s) is deprecated since 0.13 and may be removed in the future. Please use keyword parameter(s) " f"instead." ) kwargs.update(keyword_only_kwargs) From dc3ad75c09da97bcc9342aed364b4111801531d0 Mon Sep 17 00:00:00 2001 From: Yosua Michael Maranatha Date: Thu, 29 Sep 2022 14:33:45 +0100 Subject: [PATCH 6/6] Update remaining message in _utils.py --- torchvision/models/_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/torchvision/models/_utils.py b/torchvision/models/_utils.py index 31ed991ddbf..f73d193805e 100644 --- a/torchvision/models/_utils.py +++ b/torchvision/models/_utils.py @@ -250,7 +250,7 @@ def _ovewrite_value_param(param: str, actual: Optional[V], expected: V) -> V: 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." + "Accessing the model URLs via the internal dictionary of the module is deprecated since 0.13 and may " + "be removed in the future. Please access them via the appropriate Weights Enum instead." ) return super().__getitem__(item)