Skip to content

Commit

Permalink
python3.pkgs.mmcv: init at 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benxiao committed Mar 6, 2023
1 parent 6dca2bd commit 15d1af5
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
67 changes: 67 additions & 0 deletions pkgs/development/python-modules/mmcv/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, python3
, pythonOlder
, requests
, cudaSupport ? false
, cudatoolkit
, torch-cuda-arch-list ? "Kepler"
, torch
, torchvision
, torch-bin
, torchvision-bin
, opencv4
, yapf
, packaging
, pillow
, addict
, ninja
, which
}:

buildPythonPackage rec {
pname = "mmcv";
version = "1.7.0";
format = "setuptools";

disabled = pythonOlder "3.6";

src = fetchFromGitHub {
owner = "open-mmlab";
repo = pname;
rev = "v1.7.0";
hash = "sha256-EVu6D6rTeebTKFCMNIbgQpvBS52TKk3vy2ReReJ9VQE=";
};

torch-deps = if cudaSupport then [ torch-bin torchvision-bin ] else [ torch torchvision ];
nativeBuildInputs = [ ninja which ]
++ lib.lists.optionals cudaSupport [ cudatoolkit.lib cudatoolkit.out cudatoolkit.cc ] ++ torch-deps;

propagatedBuildInputs = [
opencv4
yapf
packaging
pillow
addict
] ++ torch-deps;

doCheck = false;

pythonImportsCheck = [
"mmcv"
];

MMCV_WITH_OPS = 1;
FORCE_CUDA = cudaSupport;
TORCH_CUDA_ARCH_LIST = torch-cuda-arch-list;
LDFLAGS = if cudaSupport then "-L${cudatoolkit.lib}/lib" else "";


meta = with lib; {
description = "MMCV is a foundational library for computer vision research";
homepage = "https://github.com/open-mmlab/mmcv";
license = with licenses; [ asl20 ];
maintainers = with maintainers; [ rxiao ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6031,6 +6031,8 @@ self: super: with self; {
enablePython = true;
});

mmcv = callPackage ../development/python-modules/mmcv { };

mmh3 = callPackage ../development/python-modules/mmh3 { };

mmpython = callPackage ../development/python-modules/mmpython { };
Expand Down

0 comments on commit 15d1af5

Please sign in to comment.