thop is a horrible bastard of a package without sources for last version
This commit is contained in:
parent
0d5f1fdbcd
commit
6ec2c837e7
3 changed files with 121 additions and 100 deletions
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
lib,
|
||||
# fetchPypi,
|
||||
hatchling,
|
||||
poetry-core,
|
||||
|
||||
|
|
@ -61,11 +62,14 @@
|
|||
py-cpuinfo,
|
||||
seaborn,
|
||||
albumentations,
|
||||
|
||||
distutils,
|
||||
ninja,
|
||||
}:
|
||||
|
||||
self:
|
||||
let
|
||||
inherit (self)
|
||||
inherit (self) # locally defined packages
|
||||
lightrag-hku
|
||||
mineru
|
||||
nano-vectordb
|
||||
|
|
@ -90,8 +94,7 @@ in
|
|||
mineru
|
||||
tqdm
|
||||
]
|
||||
# ++ mineru.optional-dependencies.core
|
||||
;
|
||||
++ mineru.passthru.optional-dependencies.core;
|
||||
pythonImportsCheck = [ "raganything" ];
|
||||
meta = {
|
||||
description = "RAGAnything: All-in-One RAG System";
|
||||
|
|
@ -189,22 +192,24 @@ in
|
|||
mineru-vl-utils
|
||||
qwen-vl-utils
|
||||
];
|
||||
# optional-dependencies = {
|
||||
# core = [ doclayout-yolo ]
|
||||
# # ++ (with mineru.optional-dependencies; [
|
||||
# # vlm
|
||||
# # pipeline
|
||||
# # api
|
||||
# # gradio
|
||||
# # ])
|
||||
# ;
|
||||
# vlm = [ ];
|
||||
# pipeline = [
|
||||
# doclayout-yolo
|
||||
# ];
|
||||
# api = [ ];
|
||||
# gradio = [ ];
|
||||
# };
|
||||
optional-dependencies = {
|
||||
core = with self; [
|
||||
doclayout-yolo
|
||||
]
|
||||
# ++ (with mineru.optional-dependencies; [
|
||||
# vlm
|
||||
# pipeline
|
||||
# api
|
||||
# gradio
|
||||
# ])
|
||||
;
|
||||
# vlm = [ ];
|
||||
# pipeline = [
|
||||
# doclayout-yolo
|
||||
# ];
|
||||
# api = [ ];
|
||||
# gradio = [ ];
|
||||
};
|
||||
pythonRelaxDeps = [
|
||||
"fast-langdetect"
|
||||
];
|
||||
|
|
@ -214,10 +219,8 @@ in
|
|||
};
|
||||
};
|
||||
doclayout-yolo = {
|
||||
# reason for creating fetcher construct
|
||||
url = "https://pypi.org/project/doclayout-yolo/0.0.4/"; # master is 10 months old and last version was set in Oct 18, 2024
|
||||
hash = "sha256-wLCmJuWyw7Gqou7awsHtxqVyr4AN+yJSkF0q3GUSQh8=";
|
||||
# force.version = "0.0.4"; # NOT 0.0.4 on github but fuck it we ball
|
||||
url = "https://pypi.org/project/doclayout-yolo/0.0.4/";
|
||||
hash = "sha256-gDEdEL7QPPiExb/MYkv+D9z/bnhLp2eZNHsCkNedy00=";
|
||||
propagatedBuildDeps = [
|
||||
matplotlib
|
||||
opencv-python
|
||||
|
|
@ -242,8 +245,19 @@ in
|
|||
};
|
||||
thop = {
|
||||
url = "https://pypi.org/project/thop/0.1.1.post2209072238/";
|
||||
hash = "";
|
||||
force.version = "0.1.1";
|
||||
force = {
|
||||
format = "wheel";
|
||||
python = "py3";
|
||||
dist = "py3";
|
||||
};
|
||||
hash = "sha256-AUc8IlIxkn0q1xg1H3jr98/+avO+1GTE8boe8PfN2ic=";
|
||||
nativeBuildDeps = [
|
||||
ninja
|
||||
];
|
||||
propagatedBuildDeps = [
|
||||
distutils
|
||||
torch
|
||||
];
|
||||
meta = {
|
||||
description = "Count the MACs / FLOPs of your PyTorch model.";
|
||||
license = lib.licenses.mit;
|
||||
|
|
|
|||
|
|
@ -1,40 +1,40 @@
|
|||
{ lib }:
|
||||
# { lib }:
|
||||
|
||||
url:
|
||||
let
|
||||
u0 = builtins.head (builtins.split "[?#]" url);
|
||||
u = lib.strings.removeSuffix "/" u0;
|
||||
# url:
|
||||
# let
|
||||
# u0 = builtins.head (builtins.split "[?#]" url);
|
||||
# u = lib.strings.removeSuffix "/" u0;
|
||||
|
||||
m = builtins.match "https://github.com/([^/]+)/([^/]+)(/(tree|tag|commit)/([^/]+)(/(.*))?)?" u;
|
||||
in
|
||||
assert m != null;
|
||||
let
|
||||
owner = builtins.elemAt m 0;
|
||||
repo = builtins.elemAt m 1;
|
||||
# m = builtins.match "https://github.com/([^/]+)/([^/]+)(/(tree|tag|commit)/([^/]+)(/(.*))?)?" u;
|
||||
# in
|
||||
# assert m != null;
|
||||
# let
|
||||
# owner = builtins.elemAt m 0;
|
||||
# repo = builtins.elemAt m 1;
|
||||
|
||||
kind = builtins.elemAt m 3;
|
||||
rev = builtins.elemAt m 4;
|
||||
# kind = builtins.elemAt m 3;
|
||||
# rev = builtins.elemAt m 4;
|
||||
|
||||
subdir = builtins.elemAt m 6;
|
||||
in
|
||||
{
|
||||
inherit
|
||||
owner
|
||||
repo
|
||||
kind
|
||||
rev
|
||||
subdir
|
||||
;
|
||||
# subdir = builtins.elemAt m 6;
|
||||
# in
|
||||
# {
|
||||
# inherit
|
||||
# owner
|
||||
# repo
|
||||
# kind
|
||||
# rev
|
||||
# subdir
|
||||
# ;
|
||||
|
||||
version =
|
||||
if rev == null then
|
||||
null
|
||||
else
|
||||
let
|
||||
vm = builtins.match "^.*([0-9]+(\\.[0-9]+)+).*$" rev;
|
||||
in
|
||||
if vm == null then null else builtins.elemAt vm 0;
|
||||
# version =
|
||||
# if rev == null then
|
||||
# null
|
||||
# else
|
||||
# let
|
||||
# vm = builtins.match "^.*([0-9]+(\\.[0-9]+)+).*$" rev;
|
||||
# in
|
||||
# if vm == null then null else builtins.elemAt vm 0;
|
||||
|
||||
pname = repo;
|
||||
homepage = "https://github.com/${owner}/${repo}";
|
||||
}
|
||||
# pname = repo;
|
||||
# homepage = "https://github.com/${owner}/${repo}";
|
||||
# }
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ let
|
|||
mkPrefab =
|
||||
{
|
||||
url,
|
||||
hash,
|
||||
hash ? "",
|
||||
force ? { },
|
||||
meta ? { },
|
||||
passthru ? { },
|
||||
|
|
@ -33,11 +33,9 @@ let
|
|||
|
||||
pname = force.pname or ref.pname;
|
||||
|
||||
version0 = force.version or ref.version or null;
|
||||
version = if version0 != null then version0 else "unstable";
|
||||
version = force.version or ref.version or "unstable";
|
||||
|
||||
rawSubdir = force.subdir or ref.subdir or null;
|
||||
subdir = if rawSubdir == null then null else lib.removeSuffix "/" (lib.removePrefix "/" rawSubdir);
|
||||
isWheel = (force.format or null) == "wheel";
|
||||
|
||||
rev = force.rev or ref.rev or null;
|
||||
|
||||
|
|
@ -56,16 +54,21 @@ let
|
|||
else if ref.type == "pypi" then
|
||||
(
|
||||
assert (force.version or ref.version or null) != null;
|
||||
fetchPypi {
|
||||
inherit pname version hash;
|
||||
}
|
||||
fetchPypi (
|
||||
lib.filterAttrs (_: v: v != null) {
|
||||
pname = lib.replaceStrings [ "-" ] [ "_" ] pname;
|
||||
inherit version hash;
|
||||
format = force.format or null;
|
||||
dist = force.dist or null;
|
||||
python = force.python or null;
|
||||
abi = force.abi or null;
|
||||
platform = force.platform or null;
|
||||
}
|
||||
)
|
||||
)
|
||||
else
|
||||
throw "mkPrefab: unsupported ref.type=${ref.type}";
|
||||
|
||||
sourceRootBase =
|
||||
force.sourceRootBase or (if ref.type == "github" then src.name else "${pname}-${version}");
|
||||
|
||||
defaultImports = [ (lib.toLower (lib.replaceStrings [ "-" ] [ "_" ] pname)) ];
|
||||
imports = if pythonImportsCheck == null then defaultImports else pythonImportsCheck;
|
||||
|
||||
|
|
@ -77,40 +80,44 @@ let
|
|||
passthru.optional-dependencies = optional-dependencies;
|
||||
};
|
||||
in
|
||||
buildPythonPackage {
|
||||
inherit pname version src;
|
||||
pyproject = true;
|
||||
buildPythonPackage (
|
||||
{
|
||||
inherit pname version src;
|
||||
dependencies = propagatedBuildDeps;
|
||||
pythonRelaxDeps = pythonRelaxDeps;
|
||||
pythonImportsCheck = imports;
|
||||
|
||||
build-system = [
|
||||
setuptools
|
||||
wheel
|
||||
]
|
||||
++ nativeBuildDeps;
|
||||
dependencies = propagatedBuildDeps;
|
||||
pythonRelaxDeps = pythonRelaxDeps;
|
||||
installCheckPhase = ''
|
||||
runHook preInstallCheck
|
||||
${builtins.concatStringsSep "\n" (
|
||||
map (mod: ''
|
||||
${python.interpreter} -c "import ${mod}; print(getattr(${mod},'__version__','unknown'))"
|
||||
'') imports
|
||||
)}
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
pythonImportsCheck = imports;
|
||||
passthru = passthru';
|
||||
|
||||
installCheckPhase = ''
|
||||
runHook preInstallCheck
|
||||
${builtins.concatStringsSep "\n" (
|
||||
map (mod: ''
|
||||
${python.interpreter} -c "import ${mod}; print(getattr(${mod},'__version__','unknown'))"
|
||||
'') imports
|
||||
)}
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
passthru = passthru';
|
||||
|
||||
meta = {
|
||||
inherit homepage;
|
||||
meta = {
|
||||
inherit homepage;
|
||||
}
|
||||
// meta;
|
||||
sourceRoot = if ref.subdir != null then "source/${ref.subdir}" else null;
|
||||
}
|
||||
// meta;
|
||||
}
|
||||
// lib.optionalAttrs (subdir != null && subdir != "") {
|
||||
sourceRoot = "${sourceRootBase}/${subdir}";
|
||||
};
|
||||
// lib.optionalAttrs isWheel {
|
||||
format = "wheel";
|
||||
nativeBuildInputs = nativeBuildDeps;
|
||||
}
|
||||
// lib.optionalAttrs (!isWheel) {
|
||||
pyproject = true;
|
||||
build-system = [
|
||||
setuptools
|
||||
wheel
|
||||
]
|
||||
++ nativeBuildDeps;
|
||||
}
|
||||
);
|
||||
mkPrefabs = specs: lib.mapAttrs (_: spec: mkPrefab spec) specs;
|
||||
|
||||
mkPrefabsRec = specsFn: lib.fix (self: mkPrefabs (specsFn self));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue