From dce3fd5c4f9f6b885ceaa029735845da79f40f1e Mon Sep 17 00:00:00 2001 From: osbm Date: Sat, 8 Mar 2025 20:01:45 +0300 Subject: [PATCH] python3Packages.ultralytics: init at 8.3.85 --- .../python-modules/ultralytics/default.nix | 109 ++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 111 insertions(+) create mode 100644 pkgs/development/python-modules/ultralytics/default.nix diff --git a/pkgs/development/python-modules/ultralytics/default.nix b/pkgs/development/python-modules/ultralytics/default.nix new file mode 100644 index 000000000000..ba94ae528ac3 --- /dev/null +++ b/pkgs/development/python-modules/ultralytics/default.nix @@ -0,0 +1,109 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + setuptools, + + # dependencies + scipy, + matplotlib, + opencv-python, + pillow, + pyyaml, + requests, + torch, + torchvision, + tqdm, + psutil, + py-cpuinfo, + pandas, + seaborn, + ultralytics-thop, + + # tests + pytestCheckHook, + onnx, + onnxruntime, +}: + +buildPythonPackage rec { + pname = "ultralytics"; + version = "8.3.85"; + pyproject = true; + + src = fetchFromGitHub { + owner = "ultralytics"; + repo = "ultralytics"; + tag = "v${version}"; + hash = "sha256-4EiTiy4SNinNwIUvqbckaA/5YRcv6io8ssTAhwDVgsM="; + }; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail "numpy>=1.23.0,<=2.1.1" "numpy" + ''; + + build-system = [ setuptools ]; + + dependencies = [ + scipy + matplotlib + opencv-python + pillow + pyyaml + requests + scipy + torch + torchvision + tqdm + psutil + py-cpuinfo + pandas + seaborn + ultralytics-thop + ]; + + pythonImportsCheck = [ "ultralytics" ]; + + nativeCheckInputs = [ + pytestCheckHook + onnx + onnxruntime + ]; + + # rest of the tests require internet access + pytestFlagsArray = [ "tests/test_python.py" ]; + + disabledTests = [ + # also remove the individual tests that require internet + "test_model_methods" + "test_predict_txt" + "test_predict_img" + "test_predict_visualize" + "test_predict_grey_and_4ch" + "test_val" + "test_train_scratch" + "test_train_pretrained" + "test_all_model_yamls" + "test_workflow" + "test_predict_callback_and_setup" + "test_results" + "test_labels_and_crops" + "test_data_annotator" + "test_model_embeddings" + "test_yolov10" + "test_utils_torchutils" + "test_yolo_world" + ]; + + meta = { + homepage = "https://github.com/ultralytics/ultralytics"; + changelog = "https://github.com/ultralytics/ultralytics/releases/tag/v${version}"; + description = "Train YOLO models for computer vision tasks"; + mainProgram = "yolo"; + license = lib.licenses.agpl3Only; + maintainers = with lib.maintainers; [ osbm ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 48be133d6db3..04bccb8ceec4 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -17934,6 +17934,8 @@ self: super: with self; { ultraheat-api = callPackage ../development/python-modules/ultraheat-api { }; + ultralytics = callPackage ../development/python-modules/ultralytics { }; + ultralytics-thop = callPackage ../development/python-modules/ultralytics-thop { }; umalqurra = callPackage ../development/python-modules/umalqurra { };