python310Packages.detectron2: cleanup
This commit is contained in:
parent
083a9cb41f
commit
5dd736dff7
1 changed files with 85 additions and 13 deletions
|
@ -1,8 +1,10 @@
|
||||||
{ lib
|
{ stdenv
|
||||||
|
, lib
|
||||||
, buildPythonPackage
|
, buildPythonPackage
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, pythonRelaxDepsHook
|
, pythonRelaxDepsHook
|
||||||
, ninja
|
, ninja
|
||||||
|
, which
|
||||||
# build inputs
|
# build inputs
|
||||||
, pillow
|
, pillow
|
||||||
, matplotlib
|
, matplotlib
|
||||||
|
@ -17,8 +19,10 @@
|
||||||
, iopath
|
, iopath
|
||||||
, omegaconf
|
, omegaconf
|
||||||
, hydra-core
|
, hydra-core
|
||||||
, black
|
|
||||||
, packaging
|
, packaging
|
||||||
|
, torch
|
||||||
|
, pydot
|
||||||
|
, black
|
||||||
# optional dependencies
|
# optional dependencies
|
||||||
, fairscale
|
, fairscale
|
||||||
, timm
|
, timm
|
||||||
|
@ -26,10 +30,16 @@
|
||||||
, shapely
|
, shapely
|
||||||
, pygments
|
, pygments
|
||||||
, psutil
|
, psutil
|
||||||
|
# check inputs
|
||||||
|
, pytestCheckHook
|
||||||
|
, torchvision
|
||||||
|
, av
|
||||||
|
, opencv4
|
||||||
|
, pytest-mock
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
name = "detectron2";
|
pname = "detectron2";
|
||||||
version = "0.6";
|
version = "0.6";
|
||||||
optional-dependencies = {
|
optional-dependencies = {
|
||||||
all = [
|
all = [
|
||||||
|
@ -43,11 +53,12 @@ let
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
buildPythonPackage {
|
buildPythonPackage {
|
||||||
inherit name version;
|
inherit pname version;
|
||||||
|
format = "setuptools";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "facebookresearch";
|
owner = "facebookresearch";
|
||||||
repo = name;
|
repo = "detectron2";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "1w6cgvc8r2lwr72yxicls650jr46nriv1csivp2va9k1km8jx2sf";
|
sha256 = "1w6cgvc8r2lwr72yxicls650jr46nriv1csivp2va9k1km8jx2sf";
|
||||||
};
|
};
|
||||||
|
@ -55,12 +66,9 @@ buildPythonPackage {
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
pythonRelaxDepsHook
|
pythonRelaxDepsHook
|
||||||
ninja
|
ninja
|
||||||
|
which
|
||||||
];
|
];
|
||||||
|
|
||||||
dontUseNinjaBuild = true;
|
|
||||||
dontUseNinjaInstall = true;
|
|
||||||
dontUseNinjaCheck = true;
|
|
||||||
|
|
||||||
pythonRelaxDeps = [
|
pythonRelaxDeps = [
|
||||||
"black"
|
"black"
|
||||||
];
|
];
|
||||||
|
@ -79,14 +87,78 @@ buildPythonPackage {
|
||||||
iopath
|
iopath
|
||||||
omegaconf
|
omegaconf
|
||||||
hydra-core
|
hydra-core
|
||||||
black
|
|
||||||
packaging
|
packaging
|
||||||
] ++ optional-dependencies.all;
|
black
|
||||||
|
torch # not explicitly declared in setup.py because they expect you to install it yourself
|
||||||
|
pydot # no idea why this is not in their setup.py
|
||||||
|
];
|
||||||
|
|
||||||
passthru.optional-dependencies = optional-dependencies;
|
passthru.optional-dependencies = optional-dependencies;
|
||||||
|
|
||||||
# disable the tests for now until someone can check on a linux machine.
|
nativeCheckInputs = [
|
||||||
# doCheck = false;
|
av
|
||||||
|
opencv4
|
||||||
|
pytest-mock
|
||||||
|
pytestCheckHook
|
||||||
|
torchvision
|
||||||
|
];
|
||||||
|
|
||||||
|
preCheck = ''
|
||||||
|
# prevent import errors for C extension modules
|
||||||
|
rm -r detectron2
|
||||||
|
'';
|
||||||
|
|
||||||
|
pytestFlagsArray = [
|
||||||
|
# prevent include $sourceRoot/projects/*/tests
|
||||||
|
"tests"
|
||||||
|
];
|
||||||
|
|
||||||
|
disabledTestPaths = [
|
||||||
|
# try import caffe2
|
||||||
|
"tests/test_export_torchscript.py"
|
||||||
|
"tests/test_model_analysis.py"
|
||||||
|
"tests/modeling/test_backbone.py"
|
||||||
|
"tests/modeling/test_roi_heads.py"
|
||||||
|
"tests/modeling/test_rpn.py"
|
||||||
|
"tests/structures/test_instances.py"
|
||||||
|
# hangs for some reason
|
||||||
|
"tests/modeling/test_model_e2e.py"
|
||||||
|
];
|
||||||
|
|
||||||
|
disabledTests = [
|
||||||
|
# fails for some reason
|
||||||
|
"test_checkpoint_resume"
|
||||||
|
"test_map_style"
|
||||||
|
# requires shapely
|
||||||
|
"test_resize_and_crop"
|
||||||
|
# require caffe2
|
||||||
|
"test_predict_boxes_tracing"
|
||||||
|
"test_predict_probs_tracing"
|
||||||
|
"testMaskRCNN"
|
||||||
|
"testRetinaNet"
|
||||||
|
# require coco dataset
|
||||||
|
"test_default_trainer"
|
||||||
|
"test_unknown_category"
|
||||||
|
"test_build_dataloader_train"
|
||||||
|
"test_build_iterable_dataloader_train"
|
||||||
|
# require network access
|
||||||
|
"test_opencv_exif_orientation"
|
||||||
|
"test_read_exif_orientation"
|
||||||
|
# use deprecated api, numpy.bool
|
||||||
|
"test_BWmode_nomask"
|
||||||
|
"test_draw_binary_mask"
|
||||||
|
"test_draw_empty_mask_predictions"
|
||||||
|
"test_draw_instance_predictions"
|
||||||
|
"test_draw_no_metadata"
|
||||||
|
"test_overlay_instances"
|
||||||
|
"test_overlay_instances_no_boxes"
|
||||||
|
"test_get_bounding_box"
|
||||||
|
] ++ lib.optionals (stdenv.isLinux && stdenv.isAarch64) [
|
||||||
|
"test_build_batch_dataloader_inference"
|
||||||
|
"test_build_dataloader_inference"
|
||||||
|
"test_build_iterable_dataloader_inference"
|
||||||
|
"test_to_iterable"
|
||||||
|
];
|
||||||
|
|
||||||
pythonImportsCheck = [ "detectron2" ];
|
pythonImportsCheck = [ "detectron2" ];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue