Commit 65b802a6 authored by Ihar Hrachyshka's avatar Ihar Hrachyshka
Browse files

python312Packages.torch: build torch.distributed on darwin

It's disabled on MacOS by default:
https://pytorch.org/docs/stable/distributed.html#torch.distributed.is_available



When distributed module build is enabled, a compilation error happens on
fresh clang.

Upstream repo (which is a submodule in pytorch) is archived so it's
impossible to contribute the fix there. Instead, an inline patch is
included that is enough to fix the error.

Signed-off-by: default avatarIhar Hrachyshka <ihar.hrachyshka@gmail.com>
parent 89624d61
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -74,10 +74,5 @@ buildPythonPackage rec {
    maintainers = with lib.maintainers; [
      bachp
    ];
    badPlatforms = [
      # `import torch.distributed.tensor` fails on darwin:
      # ModuleNotFoundError: No module named 'torch._C._distributed_c10d'; 'torch._C' is not a packag
      lib.systems.inspect.patterns.isDarwin
    ];
  };
}
+9 −15
Original line number Diff line number Diff line
@@ -43,8 +43,7 @@ buildPythonPackage rec {
    pytestCheckHook
  ];

  disabledTests =
    [
  disabledTests = [
    # these try to download models from HF Hub
    "test_get_observer_token_count"
    "test_kv_cache_quantization"
@@ -52,11 +51,6 @@ buildPythonPackage rec {
    "test_load_compressed_sharded"
    "test_save_compressed_model"
    "test_apply_tinyllama_dynamic_activations"
    ]
    ++ lib.optionals stdenv.hostPlatform.isDarwin [
      # No module named 'torch._C._distributed_c10d'; 'torch._C' is not a package
      "test_composability"
      "test_missing_and_unexpected_keys_on_compression"
  ];

  disabledTestPaths = [
+0 −6
Original line number Diff line number Diff line
@@ -83,12 +83,6 @@ buildPythonPackage rec {
    "test_tf_predictor"
  ];

  disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
    # No module named 'torch._C._distributed_c10d'; 'torch._C' is not a package
    "tests/test_code_formula_predictor.py"
    "tests/test_layout_predictor.py"
  ];

  meta = {
    changelog = "https://github.com/DS4SD/docling-ibm-models/blob/${src.tag}/CHANGELOG.md";
    description = "Docling IBM models";
+0 −20
Original line number Diff line number Diff line
@@ -164,26 +164,6 @@ buildPythonPackage rec {
    "test_e2e_valid_csv_conversions"
  ];

  disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
    # No module named 'torch._C._distributed_c10d'; 'torch._C' is not a package
    "tests/test_backend_csv.py"
    "tests/test_backend_html.py"
    "tests/test_backend_jats.py"
    "tests/test_backend_msexcel.py"
    "tests/test_backend_msword.py"
    "tests/test_backend_pptx.py"
    "tests/test_cli.py"
    "tests/test_code_formula.py"
    "tests/test_document_picture_classifier.py"
    "tests/test_e2e_conversion.py"
    "tests/test_e2e_ocr_conversion.py"
    "tests/test_input_doc.py"
    "tests/test_interfaces.py"
    "tests/test_invalid_input.py"
    "tests/test_legacy_format_transform.py"
    "tests/test_options.py"
  ];

  meta = {
    description = "Get your documents ready for gen AI";
    homepage = "https://github.com/DS4SD/docling";
+0 −4
Original line number Diff line number Diff line
@@ -71,9 +71,5 @@ buildPythonPackage rec {
    changelog = "https://github.com/speediedan/finetuning-scheduler/blob/v${version}/CHANGELOG.md";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ bcdarwin ];
    badPlatforms = [
      # "No module named 'torch._C._distributed_c10d'; 'torch._C' is not a package" at import time:
      lib.systems.inspect.patterns.isDarwin
    ];
  };
}
Loading