From ea26ab21cd714ced5cc58b87b36544c1a7037eb0 Mon Sep 17 00:00:00 2001 From: drbh Date: Thu, 6 Nov 2025 16:16:06 -0500 Subject: [PATCH] fix: enable torch use_distributed flag for macos --- pkgs/python-modules/torch/source/2_8/default.nix | 4 ++++ pkgs/python-modules/torch/source/2_9/default.nix | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pkgs/python-modules/torch/source/2_8/default.nix b/pkgs/python-modules/torch/source/2_8/default.nix index 5f41181..2c03b6c 100644 --- a/pkgs/python-modules/torch/source/2_8/default.nix +++ b/pkgs/python-modules/torch/source/2_8/default.nix @@ -439,6 +439,10 @@ buildPythonPackage rec { USE_MKLDNN = setBool mklDnnSupport; USE_MKLDNN_CBLAS = setBool mklDnnSupport; + # Enable distributed support (c10d, gloo, etc.) + # Required for torch.distributed and dependencies like transformers + USE_DISTRIBUTED = setBool true; + # Avoid using pybind11 from git submodule # Also avoids pytorch exporting the headers of pybind11 USE_SYSTEM_PYBIND11 = true; diff --git a/pkgs/python-modules/torch/source/2_9/default.nix b/pkgs/python-modules/torch/source/2_9/default.nix index 25b18a9..f435320 100644 --- a/pkgs/python-modules/torch/source/2_9/default.nix +++ b/pkgs/python-modules/torch/source/2_9/default.nix @@ -422,6 +422,10 @@ buildPythonPackage rec { USE_MKLDNN = setBool mklDnnSupport; USE_MKLDNN_CBLAS = setBool mklDnnSupport; + # Enable distributed support (c10d, gloo, etc.) + # Required for torch.distributed and dependencies like transformers + USE_DISTRIBUTED = setBool true; + # Avoid using pybind11 from git submodule # Also avoids pytorch exporting the headers of pybind11 USE_SYSTEM_PYBIND11 = true;