mirror of
https://github.com/gbtb/nix-stable-diffusion.git
synced 2024-11-05 04:55:20 +03:00
invokeai mostly done
This commit is contained in:
parent
ac340af56e
commit
0076a108fc
58
flake.nix
58
flake.nix
@ -1,5 +1,5 @@
|
||||
{
|
||||
description = "A very basic flake";
|
||||
description = "Nix Flake for runnig Stable Diffusion on NixOS";
|
||||
|
||||
inputs = {
|
||||
nixlib.url = "github:nix-community/nixpkgs.lib";
|
||||
@ -21,11 +21,9 @@
|
||||
system = "x86_64-linux";
|
||||
requirementsFor = { pkgs, webui ? false }: with pkgs; with pkgs.python3.pkgs; [
|
||||
python3
|
||||
|
||||
torch
|
||||
torchvision
|
||||
numpy
|
||||
|
||||
albumentations
|
||||
opencv4
|
||||
pudb
|
||||
@ -44,7 +42,6 @@
|
||||
kornia
|
||||
k-diffusion
|
||||
diffusers
|
||||
|
||||
# following packages not needed for vanilla SD but used by both UIs
|
||||
realesrgan
|
||||
pillow
|
||||
@ -57,14 +54,12 @@
|
||||
click
|
||||
pypatchmatch
|
||||
torchsde
|
||||
trampoline
|
||||
compel
|
||||
safetensors
|
||||
send2trash
|
||||
flask
|
||||
flask-socketio
|
||||
flask-cors
|
||||
dependency-injector
|
||||
gfpgan
|
||||
eventlet
|
||||
clipseg
|
||||
@ -101,10 +96,6 @@
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [ nixpkgs.python3Packages.pythonRelaxDepsHook ];
|
||||
pythonRelaxDeps = [ "protobuf" ];
|
||||
});
|
||||
wandb = pythonPackages.wandb.overrideAttrs (old: {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [ nixpkgs.python3Packages.pythonRelaxDepsHook ];
|
||||
pythonRelaxDeps = [ "protobuf" ];
|
||||
});
|
||||
scikit-image = pythonPackages.scikitimage;
|
||||
};
|
||||
overlay_webui = nixpkgs: pythonPackages:
|
||||
@ -244,12 +235,11 @@
|
||||
in
|
||||
{
|
||||
packages.${system} =
|
||||
let nixpkgs = (nixpkgs_ { amd = true; });
|
||||
in
|
||||
{
|
||||
invokeai = {
|
||||
amd =
|
||||
nixpkgs.python3.pkgs.buildPythonPackage {
|
||||
let
|
||||
nixpkgs = (nixpkgs_ { });
|
||||
nixpkgsAmd = (nixpkgs_ { amd = true; });
|
||||
nixpkgsNvidia = (nixpkgs_ { nvidia = true; });
|
||||
invokeaiF = nixpkgs: nixpkgs.python3.pkgs.buildPythonPackage {
|
||||
pname = "invokeai";
|
||||
version = "2.3.1";
|
||||
src = invokeai-repo;
|
||||
@ -258,40 +248,17 @@
|
||||
nativeBuildInputs = [ nixpkgs.pkgs.pythonRelaxDepsHook ];
|
||||
pythonRelaxDeps = [ "torch" "pytorch-lightning" "flask-socketio" "flask" "dnspython" ];
|
||||
pythonRemoveDeps = [ "opencv-python" "flaskwebgui" "pyreadline3" ];
|
||||
/* preBuild = '' */
|
||||
/* sed -i "/opencv-python\|flaskwebgui\|pytorch-lightning\|socketio\|flask==2.1.3\|torch>=1.13.1\|torchvision\|pyreadline3/d" pyproject.toml */
|
||||
/* ''; */
|
||||
};
|
||||
in
|
||||
{
|
||||
invokeai = {
|
||||
amd = invokeaiF nixpkgsAmd;
|
||||
nvidia = invokeaiF nixpkgsNvidia;
|
||||
default = invokeaiF nixpkgs;
|
||||
};
|
||||
};
|
||||
devShells.${system} =
|
||||
rec {
|
||||
invokeai =
|
||||
let
|
||||
shellHook = ''
|
||||
cd InvokeAI
|
||||
'';
|
||||
in
|
||||
{
|
||||
default = mkShell
|
||||
({
|
||||
inherit shellHook;
|
||||
name = "invokeai";
|
||||
propagatedBuildInputs = requirementsFor { pkgs = (nixpkgs_ { }); };
|
||||
});
|
||||
amd = mkShell
|
||||
({
|
||||
inherit shellHook;
|
||||
name = "invokeai.amd";
|
||||
propagatedBuildInputs = requirementsFor { pkgs = (nixpkgs_ { amd = true; }); };
|
||||
});
|
||||
nvidia = mkShell
|
||||
({
|
||||
inherit shellHook;
|
||||
name = "invokeai.nvidia";
|
||||
propagatedBuildInputs = requirementsFor { pkgs = (nixpkgs_ { nvidia = true; }); };
|
||||
});
|
||||
};
|
||||
webui =
|
||||
let
|
||||
shellHookFor = nixpkgs:
|
||||
@ -345,7 +312,6 @@
|
||||
}
|
||||
);
|
||||
};
|
||||
default = invokeai.amd;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -1,15 +1,30 @@
|
||||
{ buildPythonPackage, lib, numpy, fetchFromGitHub, pillow, tqdm, setuptools }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "pypatchmatch";
|
||||
version = "0.1.1";
|
||||
|
||||
{ buildPythonPackage, lib, numpy, fetchFromGitHub, pillow, tqdm, setuptools, stdenv, pkg-config, opencv4 }:
|
||||
let
|
||||
version = "1.0.0";
|
||||
src = fetchFromGitHub {
|
||||
owner = "invoke-ai";
|
||||
owner = "mauwii";
|
||||
repo = "PyPatchMatch";
|
||||
rev = version;
|
||||
sha256 = "sha256-PemWmujCMVzKF3/BL0jrL+z5KCKIertrYLAwf/+ZySs=";
|
||||
rev = "release/v${version}";
|
||||
sha256 = "sha256-icxRmmxWvztQvMsYBJatvGa2YzxX05+xxdg+UJuy1SQ=";
|
||||
};
|
||||
libpatchmatch = stdenv.mkDerivation {
|
||||
name = "libpatchmatch";
|
||||
sourceRoot = ["source/patchmatch"];
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
opencv4
|
||||
];
|
||||
inherit src version;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib
|
||||
cp libpatchmatch.so $out/lib/
|
||||
'';
|
||||
};
|
||||
in
|
||||
buildPythonPackage {
|
||||
pname = "pypatchmatch";
|
||||
inherit src version;
|
||||
|
||||
format = "pyproject";
|
||||
buildInputs = [ setuptools ];
|
||||
@ -18,6 +33,10 @@ buildPythonPackage rec {
|
||||
# TODO FIXME
|
||||
doCheck = false;
|
||||
|
||||
postInstall = ''
|
||||
cp ${libpatchmatch}/lib/libpatchmatch.so $out/lib/*/site-packages/patchmatch/
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "This library implements the PatchMatch based inpainting algorithm";
|
||||
homepage = "https://github.com/invoke-ai/PyPatchMatch";
|
||||
|
Loading…
Reference in New Issue
Block a user