2020-05-29 06:06:01 +00:00
|
|
|
{ lib
|
2023-05-24 13:37:59 +00:00
|
|
|
, stdenv
|
2020-05-29 06:06:01 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
2023-10-09 19:29:22 +00:00
|
|
|
, pythonOlder
|
2020-05-29 06:06:01 +00:00
|
|
|
, numpy
|
2021-05-20 23:08:51 +00:00
|
|
|
, scikit-learn
|
2020-05-29 06:06:01 +00:00
|
|
|
, scipy
|
|
|
|
, tabulate
|
2023-10-09 19:29:22 +00:00
|
|
|
, torch
|
2020-05-29 06:06:01 +00:00
|
|
|
, tqdm
|
2023-10-09 19:29:22 +00:00
|
|
|
, flaky
|
|
|
|
, pandas
|
|
|
|
, pytestCheckHook
|
|
|
|
, safetensors
|
|
|
|
, pythonAtLeast
|
2020-05-29 06:06:01 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "skorch";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "0.15.0";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2020-05-29 06:06:01 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-39XVBlCmbg162z9uL84GZrU+v+M8waXbGdVV72ZYf84=";
|
2020-05-29 06:06:01 +00:00
|
|
|
};
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
scikit-learn
|
|
|
|
scipy
|
|
|
|
tabulate
|
|
|
|
torch
|
|
|
|
tqdm
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
flaky
|
|
|
|
pandas
|
|
|
|
pytestCheckHook
|
|
|
|
safetensors
|
|
|
|
];
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
# patch out pytest-cov dep/invocation
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.cfg \
|
|
|
|
--replace "--cov=skorch" "" \
|
|
|
|
--replace "--cov-report=term-missing" "" \
|
|
|
|
--replace "--cov-config .coveragerc" ""
|
|
|
|
'';
|
2020-05-29 06:06:01 +00:00
|
|
|
|
|
|
|
disabledTests = [
|
2021-02-17 17:02:09 +00:00
|
|
|
# on CPU, these expect artifacts from previous GPU run
|
2020-05-29 06:06:01 +00:00
|
|
|
"test_load_cuda_params_to_cpu"
|
2021-02-17 17:02:09 +00:00
|
|
|
# failing tests
|
2020-05-29 06:06:01 +00:00
|
|
|
"test_pickle_load"
|
2023-05-24 13:37:59 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
# there is a problem with the compiler selection
|
|
|
|
"test_fit_and_predict_with_compile"
|
2023-10-09 19:29:22 +00:00
|
|
|
] ++ lib.optionals (pythonAtLeast "3.11") [
|
|
|
|
# Python 3.11+ not yet supported for torch.compile
|
|
|
|
# https://github.com/pytorch/pytorch/blob/v2.0.1/torch/_dynamo/eval_frame.py#L376-L377
|
|
|
|
"test_fit_and_predict_with_compile"
|
2020-05-29 06:06:01 +00:00
|
|
|
];
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
disabledTestPaths = [
|
|
|
|
# tries to import `transformers` and download HuggingFace data
|
|
|
|
"skorch/tests/test_hf.py"
|
|
|
|
] ++ lib.optionals (stdenv.hostPlatform.system != "x86_64-linux") [
|
|
|
|
# torch.distributed is disabled by default in darwin
|
|
|
|
# aarch64-linux also failed these tests
|
|
|
|
"skorch/tests/test_history.py"
|
|
|
|
];
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
pythonImportsCheck = [ "skorch" ];
|
|
|
|
|
2020-05-29 06:06:01 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Scikit-learn compatible neural net library using Pytorch";
|
|
|
|
homepage = "https://skorch.readthedocs.io";
|
|
|
|
changelog = "https://github.com/skorch-dev/skorch/blob/master/CHANGES.md";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ bcdarwin ];
|
|
|
|
};
|
|
|
|
}
|