mirror of
https://github.com/gbtb/nix-stable-diffusion.git
synced 2024-09-11 11:16:15 +03:00
codeformer - wip
This commit is contained in:
parent
a2d7490e2d
commit
6f96b9d189
@ -10,6 +10,10 @@
|
||||
url = "github:CompVis/stable-diffusion?rev=69ae4b35e0a0f6ee1af8bb9a5d0016ccb27e36dc";
|
||||
flake = false;
|
||||
};
|
||||
#codeformer-repo = {
|
||||
# url = "github:sczhou/CodeFormer?rev=c5b4593074ba6214284d6acd5f1719b6c5d739af";
|
||||
# flake = false;
|
||||
#};
|
||||
};
|
||||
outputs = { self, nixpkgs, nixlib, stable-diffusion-repo }@inputs:
|
||||
let
|
||||
@ -43,6 +47,7 @@
|
||||
font-roboto
|
||||
piexif
|
||||
websockets
|
||||
codeformer
|
||||
|
||||
albumentations
|
||||
opencv4
|
||||
@ -108,6 +113,7 @@
|
||||
basicsr = rmCallPackage ./packages/basicsr { opencv-python = self.opencv4; };
|
||||
facexlib = rmCallPackage ./packages/facexlib { opencv-python = self.opencv4; };
|
||||
realesrgan = rmCallPackage ./packages/realesrgan { opencv-python = self.opencv4; };
|
||||
codeformer = callPackage ./packages/codeformer { opencv-python = self.opencv4; };
|
||||
filterpy = callPackage ./packages/filterpy { };
|
||||
kornia = callPackage ./packages/kornia { };
|
||||
lpips = callPackage ./packages/lpips { };
|
||||
|
138
packages/codeformer/default.nix
Normal file
138
packages/codeformer/default.nix
Normal file
@ -0,0 +1,138 @@
|
||||
# WARNING: This file was automatically generated. You should avoid editing it.
|
||||
# If you run pynixify again, the file will be either overwritten or
|
||||
# deleted, and you will lose the changes you made to it.
|
||||
|
||||
{ addict
|
||||
, basicsr
|
||||
, stdenv
|
||||
, future
|
||||
, gdown
|
||||
, lib
|
||||
, lmdb
|
||||
, lpips
|
||||
, numpy
|
||||
, opencv-python
|
||||
, pillow
|
||||
, pyyaml
|
||||
, requests
|
||||
, scikit-image
|
||||
, scipy
|
||||
, fetchFromGitHub
|
||||
, buildPythonPackage
|
||||
, torch
|
||||
, cython
|
||||
, torchvision
|
||||
, tqdm
|
||||
, wget
|
||||
, yapf
|
||||
, pythonRelaxDepsHook
|
||||
}:
|
||||
|
||||
let
|
||||
nestedBasicsr = buildPythonPackage
|
||||
{
|
||||
pname = "basicsr";
|
||||
version = "0.1.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "sczhou";
|
||||
repo = "CodeFormer";
|
||||
rev = "c5b4593074ba6214284d6acd5f1719b6c5d739af";
|
||||
sha256 = "sha256-JyyJe+VBeNK5rRaPJ4jYdKZqLnRfayHWkTwFNrSfseY=";
|
||||
};
|
||||
|
||||
preBuild = ''
|
||||
ln -s basicsr/setup.py setup.py
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace requirements.txt \
|
||||
--replace opencv-python "" \
|
||||
--replace tb-nightly ""
|
||||
'';
|
||||
|
||||
|
||||
nativeBuildInputs = [ cython ];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
pillow
|
||||
pyyaml
|
||||
addict
|
||||
future
|
||||
gdown
|
||||
lmdb
|
||||
lpips
|
||||
numpy
|
||||
opencv-python
|
||||
requests
|
||||
scikit-image
|
||||
scipy
|
||||
torch
|
||||
torchvision
|
||||
tqdm
|
||||
wget
|
||||
yapf
|
||||
];
|
||||
|
||||
doCheck = false;
|
||||
|
||||
meta = with lib; {
|
||||
description =
|
||||
"Towards Robust Blind Face Restoration with Codebook Lookup Transformer (NeurIPS 2022)";
|
||||
homepage = "None";
|
||||
};
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "codeformer";
|
||||
version = "0.1.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "sczhou";
|
||||
repo = "CodeFormer";
|
||||
rev = "c5b4593074ba6214284d6acd5f1719b6c5d739af";
|
||||
sha256 = "sha256-JyyJe+VBeNK5rRaPJ4jYdKZqLnRfayHWkTwFNrSfseY=";
|
||||
};
|
||||
|
||||
|
||||
buildPhase = ''
|
||||
mkdir -p $out/lib/python3.10/site-packages
|
||||
cp -R ./ $out/lib/python3.10/site-packages/codeformer/
|
||||
cd $out/lib/python3.10/site-packages/codeformer/
|
||||
cp -R ${nestedBasicsr}/lib/python3.10/site-packages/basicsr ./basicsr/
|
||||
'';
|
||||
|
||||
dontInstall = true;
|
||||
|
||||
patches = [ ./root_dir.patch ];
|
||||
|
||||
|
||||
propagatedBuildInputs = [
|
||||
pillow
|
||||
pyyaml
|
||||
addict
|
||||
future
|
||||
gdown
|
||||
lmdb
|
||||
lpips
|
||||
numpy
|
||||
opencv-python
|
||||
requests
|
||||
scikit-image
|
||||
scipy
|
||||
torch
|
||||
torchvision
|
||||
tqdm
|
||||
wget
|
||||
yapf
|
||||
];
|
||||
|
||||
# TODO FIXME
|
||||
doCheck = false;
|
||||
|
||||
meta = with lib; {
|
||||
description =
|
||||
"Towards Robust Blind Face Restoration with Codebook Lookup Transformer (NeurIPS 2022)";
|
||||
homepage = "None";
|
||||
};
|
||||
}
|
13
packages/codeformer/root_dir.patch
Normal file
13
packages/codeformer/root_dir.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/facelib/utils/misc.py b/facelib/utils/misc.py
|
||||
index 0240187..0570161 100644
|
||||
--- a/facelib/utils/misc.py
|
||||
+++ b/facelib/utils/misc.py
|
||||
@@ -10,7 +10,7 @@ from urllib.parse import urlparse
|
||||
import gdown
|
||||
|
||||
|
||||
-ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
+ROOT_DIR = f'{os.getcwd()}/models/facelib'
|
||||
|
||||
|
||||
def download_pretrained_models(file_ids, save_path_root):
|
@ -1 +1 @@
|
||||
Subproject commit 7f8ab1ee8f304031b3404e25761dd0f4c7be7df8
|
||||
Subproject commit 956c3b15449096475e927d7bf07e3315a4b4eba5
|
Loading…
Reference in New Issue
Block a user