Added a functional ultralytics-thop

This commit is contained in:
didier committed 2024-10-14 14:15:40 -04:00
1 parent 543d975c9a
commit 72156eb50a
1 file changed
+72 -23
+72 -23
View File
@@ -10,36 +10,82 @@
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
pythonPackages = pkgs.python312Packages; pythonPackages = pkgs.python312Packages;
python-path = pkgs.python3Packages.buildPythonPackage rec { ultralytics-thop = pkgs.python3Packages.buildPythonPackage rec {
# pname = "opencv-python"; version = "2.0.9";
# version = "4.10.0.84"; pname = "ultralytics-htop";
version = "16.14.0";
pname = "path";
pyproject = true; pyproject = true;
src = pkgs.fetchFromGitHub {
# disabled = pythonOlder "3.7"; owner = "ultralytics";
repo = "thop";
src = pkgs.python3Packages.fetchPypi { rev = "d304cebcc81f65a7b0d4304290f2abb100407ec0";
inherit pname version; hash = "sha256-FzjxEk6yiG+IWwQEzsHcEAB4iVQT1QsyoGlG4I9lSwU=";
hash = "sha256-26qn79RgL9a6jYKJDceCPWnl3nQKboQtmRmw+q8rao4="; fetchSubmodules = true;
# hash = "";
}; };
propagatedBuildInputs = [ pythonPackages.numpy pythonPackages.torch ];
nativeBuildInputs = nativeBuildInputs =
[ pythonPackages.setuptools pythonPackages.setuptools-scm ]; [ pythonPackages.setuptools pythonPackages.setuptools-scm ];
meta = with pkgs.lib; {
description = ''
THOP offers an intuitive API to profile PyTorch models
by calculating the number of MACs and parameters. This
functionality is crucial for assessing the computational
efficiency and memory footprint of deep learning models.
'';
homepage = "https://github.com/ultralytics/thop";
license = pkgs.lib.licenses.mit;
maintainers = with maintainers; [ ];
};
};
python-path = pkgs.python3Packages.buildPythonPackage rec {
# pname = "opencv-python";
# version = "4.10.0.84";
version = "8.3.13";
pname = "ultralytics";
pyproject = true;
src = pkgs.fetchFromGitHub {
owner = "ultralytics";
repo = "ultralytics";
rev = "15e6133534d82ec6845308f1e258d77c1b9bab36";
hash = "sha256-Wq2pCD0l0AbdQ2IPfEfxPffSxgv/5qFadB4BHAExEbU=";
fetchSubmodules = true;
};
propagatedBuildInputs = [
pythonPackages.requests
pythonPackages.pyyaml
pythonPackages.torch
pythonPackages.tqdm
pythonPackages.psutil
pythonPackages.torchvision
pythonPackages.pandas
pythonPackages.matplotlib
];
nativeBuildInputs = [
pythonPackages.setuptools
pythonPackages.setuptools-scm
pythonPackages.pip
# pythonPackages.scikit-build
# pythonPackages.numpy_2
# pythonPackages.cmake
];
nativeCheckInputs = nativeCheckInputs =
[ pythonPackages.more-itertools pythonPackages.pytestCheckHook ]; [ pythonPackages.more-itertools pythonPackages.pytestCheckHook ];
disabledTests = [ # disabledTests = [
# creates a file, checks when it was last accessed/modified # # creates a file, checks when it was last accessed/modified
# AssertionError: assert 1650036414.0 == 1650036414.960688 # # AssertionError: assert 1650036414.0 == 1650036414.960688
"test_utime" # # "test_utime"
]; # ];
pythonImportsCheck = [ "path" ]; # pythonImportsCheck = [ "cv2" ];
meta = with pkgs.lib; { meta = with pkgs.lib; {
description = "Object-oriented file system path manipulation"; description = "Object-oriented file system path manipulation";
@@ -51,10 +97,13 @@
}; };
}; };
env = pkgs.python312.withPackages (ps: [ python-path ]); env = pkgs.python312.withPackages (ps: [ ultralytics-thop ]);
in { in {
packages = { default = pkgs.python312Packages.path; }; packages = {
devShells.default = pkgs.mkShell { buildInputs = with pkgs; [ env ]; }; default = pkgs.python312Packages.path;
env = env;
};
devShells.default = pkgs.mkShell { buildInputs = [ env ]; };
}); });
} }