diff --git a/pyproject.toml b/pyproject.toml index 774cd08fa5..e295328dea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -187,7 +187,12 @@ pin_tensorflow_gpu = [ pin_pytorch_cpu = [ # https://github.com/pytorch/pytorch/issues/114602 # macos x86 has been deprecated - "torch==2.11.0; platform_machine!='x86_64' or platform_system != 'Darwin'", + # Keep the established Python 3.10 pin; use 2.13 for newer CPU tests. + # torch 2.13 includes the AOTInductor int_array cache fix for bound methods: + # https://github.com/pytorch/pytorch/pull/178147 + # vesin-torch 0.6.2 requires torch<2.15. + "torch==2.11.0; python_version<'3.11' and (platform_machine!='x86_64' or platform_system != 'Darwin')", + "torch==2.13.0; python_version>='3.11' and (platform_machine!='x86_64' or platform_system != 'Darwin')", "torch; platform_machine=='x86_64' and platform_system == 'Darwin'", ] pin_pytorch_gpu = [ diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 4ccc18542c..f28545c309 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -404,8 +404,10 @@ if(ENABLE_PYTORCH AND NOT DEEPMD_C_ROOT) else() set(DEEPMD_TORCH_HAS_CUDA FALSE) endif() - # PyTorch 2.14 raised the minimum C++ standard from C++17 to C++20. - if(NOT Torch_VERSION VERSION_LESS "2.14.0") + # PyTorch 2.14 requires C++20. MSVC also needs it for the designated + # initializers and bit-field defaults already present in PyTorch 2.13 headers. + if(NOT Torch_VERSION VERSION_LESS "2.14.0" + OR (MSVC AND NOT Torch_VERSION VERSION_LESS "2.13.0")) set_if_higher(CMAKE_CXX_STANDARD 20) elseif(NOT Torch_VERSION VERSION_LESS "2.1.0") set_if_higher(CMAKE_CXX_STANDARD 17)