Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit81ea7a4

Browse files
vfdev-5pytorchmergebot
authored andcommitted
Replaced deprecated pkg_resources.packaging with packaging module (#113023)
Usage of `from pkg_resources import packaging` leads to a deprecation warning:```DeprecationWarning: pkg_resources is deprecated as an API. Seehttps://setuptools.pypa.io/en/latest/pkg_resources.html```and in strict tests where warnings are errors, this leads to CI breaks, e.g.:pytorch/vision#8092Replacing `pkg_resources.package` with `package` as it is now a pytorch dependency:https://github.com/pytorch/pytorch/blob/fa9045a8725214c05ae4dcec5a855820b861155e/requirements.txt#L19Pull Requestresolved:#113023Approved by:https://github.com/Skylion007
1 parent67256d5 commit81ea7a4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

‎tools/dynamo/verify_dynamo.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
importtraceback
66
importwarnings
77

8-
frompkg_resourcesimportpackaging
8+
importpackaging.version
99

1010
MIN_CUDA_VERSION=packaging.version.parse("11.6")
1111
MIN_ROCM_VERSION=packaging.version.parse("5.4")

‎torch/utils/cpp_extension.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
fromtorch.torch_versionimportTorchVersion
2626

2727
fromsetuptools.command.build_extimportbuild_ext
28-
frompkg_resourcesimportpackaging# type: ignore[attr-defined]
28+
importpackaging.version
2929

3030
IS_WINDOWS=sys.platform=='win32'
3131
IS_MACOS=sys.platform.startswith('darwin')
@@ -404,6 +404,9 @@ def _check_cuda_version(compiler_name: str, compiler_version: TorchVersion) -> N
404404

405405
cuda_str_version=cuda_version.group(1)
406406
cuda_ver=packaging.version.parse(cuda_str_version)
407+
iftorch.version.cudaisNone:
408+
return
409+
407410
torch_cuda_version=packaging.version.parse(torch.version.cuda)
408411
ifcuda_ver!=torch_cuda_version:
409412
# major/minor attributes are only available in setuptools>=49.4.0
@@ -2345,8 +2348,7 @@ def sanitize_flags(flags):
23452348
# Compilation will work on earlier CUDA versions but header file
23462349
# dependencies are not correctly computed.
23472350
required_cuda_version=packaging.version.parse('11.0')
2348-
has_cuda_version=torch.version.cudaisnotNone
2349-
ifhas_cuda_versionandpackaging.version.parse(torch.version.cuda)>=required_cuda_version:
2351+
iftorch.version.cudaisnotNoneandpackaging.version.parse(torch.version.cuda)>=required_cuda_version:
23502352
cuda_compile_rule.append(' depfile = $out.d')
23512353
cuda_compile_rule.append(' deps = gcc')
23522354
# Note: non-system deps with nvcc are only supported

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp