Ihar Hrachyshka 65b802a6fd 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: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
2025-04-01 21:23:51 -04:00

69 lines
1.5 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
setuptools,
pydantic,
torch,
transformers,
nbconvert,
nbformat,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "compressed-tensors";
version = "0.9.2";
pyproject = true;
# Release on PyPI is missing the `utils` directory, which `setup.py` wants to import
src = fetchFromGitHub {
owner = "neuralmagic";
repo = "compressed-tensors";
tag = version;
hash = "sha256-PxW8zseDUF0EOh7E/N8swwgFTfvkoTpp+d3ngAUpFNU=";
};
build-system = [ setuptools ];
dependencies = [
pydantic
torch
transformers
];
doCheck = true;
pythonImportsCheck = [ "compressed_tensors" ];
nativeCheckInputs = [
nbconvert
nbformat
pytestCheckHook
];
disabledTests = [
# these try to download models from HF Hub
"test_get_observer_token_count"
"test_kv_cache_quantization"
"test_target_prioritization"
"test_load_compressed_sharded"
"test_save_compressed_model"
"test_apply_tinyllama_dynamic_activations"
];
disabledTestPaths = [
# these try to download models from HF Hub
"tests/test_quantization/lifecycle/test_apply.py"
];
meta = {
description = "A safetensors extension to efficiently store sparse quantized tensors on disk";
homepage = "https://github.com/neuralmagic/compressed-tensors";
changelog = "https://github.com/neuralmagic/compressed-tensors/releases/tag/${version}";
license = lib.licenses.asl20;
maintainers = [ ];
};
}