Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvokeAI 2.3.5 #23

Merged
merged 5 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 57 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
flake = false;
};
invokeai-repo = {
url = "github:invoke-ai/InvokeAI?ref=v2.3.1.post2";
url = "github:invoke-ai/InvokeAI?ref=v2.3.5.post2";
flake = false;
};
webui-repo = {
Expand Down Expand Up @@ -51,6 +51,7 @@
realesrgan
pillow
safetensors
fastapi
]
++ nixlib.optional (nvidia) [ xformers ] #probably won't fully work
++ nixlib.optional (!webui) [
Expand All @@ -71,6 +72,11 @@
clipseg
getpass-asterisk
picklescan
peft
packaging
python-multipart
fastapi-socketio
fastapi-events
]
++ nixlib.optional webui [
pip
Expand All @@ -83,7 +89,6 @@
yapf
gdown
lpips
fastapi
lark
analytics-python
ffmpy
Expand Down Expand Up @@ -118,6 +123,35 @@
};
});
};
overlay_invoke = nixpkgs: pythonPackages:
let
ifNotMinVersion = pkg: ver: overlay: if (
gbtb marked this conversation as resolved.
Show resolved Hide resolved
nixlib.versionOlder pkg.version ver
) then pkg.overrideAttrs overlay else pkg;
in {
huggingface-hub = ifNotMinVersion pythonPackages.huggingface-hub
"0.13.2" (
old: rec {
version = "0.14.1";
src = nixpkgs.fetchFromGitHub {
owner = "huggingface";
repo = "huggingface_hub";
rev = "refs/tags/v${version}";
hash = "sha256-+BtXi+O+Ef4p4b+8FJCrZFsxX22ZYOPXylexFtsldnA=";
};
propagatedBuildInputs = old.propagatedBuildInputs ++ [pythonPackages.fsspec];
});
transformers = ifNotMinVersion pythonPackages.transformers
"4.26" (
old: rec {
version = "4.28.1";
src = nixpkgs.fetchFromGitHub {
inherit (old.src) owner repo;
rev = "refs/tags/v${version}";
hash = "sha256-FmiuWfoFZjZf1/GbE6PmSkeshWWh+6nDj2u2PMSeDk0=";
};
});
};
overlay_pynixify = self:
let
rm = d: d.overrideAttrs (old: {
Expand Down Expand Up @@ -162,6 +196,9 @@
"xformers"
"pyre-extensions"
# "triton" TODO: nixpkgs is missing required llvm parts - mlir. https://github.com/NixOS/nixpkgs/pull/163878
"peft"
"fastapi-events"
"fastapi-socketio"
];
in
{
Expand Down Expand Up @@ -243,6 +280,7 @@
optional amd (overlay_amd prev python-super) //
optional nvidia (overlay_nvidia prev python-super) //
optional webui (overlay_webui prev python-super) //
optional (!webui) (overlay_invoke prev python-super) //
(overlay_pynixify python-self);
};
})
Expand All @@ -256,14 +294,29 @@
nixpkgsNvidia = (nixpkgs_ { nvidia = true; });
invokeaiF = nixpkgs: nixpkgs.python3.pkgs.buildPythonApplication {
pname = "invokeai";
version = "2.3.1";
version = "2.3.5";
src = invokeai-repo;
format = "pyproject";
meta.mainProgram = "invokeai";
propagatedBuildInputs = requirementsFor { pkgs = nixpkgs; nvidia = nixpkgs.nvidia; };
nativeBuildInputs = [ nixpkgs.pkgs.pythonRelaxDepsHook ];
pythonRelaxDeps = [ "torch" "pytorch-lightning" "flask-socketio" "flask" "dnspython" ];
pythonRelaxDeps = [ "torch" "pytorch-lightning" "flask-socketio" "flask" "dnspython" "fastapi" ];
pythonRemoveDeps = [ "opencv-python" "flaskwebgui" "pyreadline3" ];
postPatch = ''
# Add subprocess to the imports
substituteInPlace ./ldm/invoke/config/invokeai_configure.py --replace \
'import shutil' \
'
import shutil
import subprocess
'
# shutil.copytree will inherit the permissions of files in the /nix/store
# which are read only, so we subprocess.call cp instead and tell it not to
# preserve the mode
substituteInPlace ./ldm/invoke/config/invokeai_configure.py --replace \
"shutil.copytree(configs_src, configs_dest, dirs_exist_ok=True)" \
"subprocess.call(f'cp -r --no-preserve=mode {configs_src}/* {configs_dest}', shell=True)"
'';
};
webuiF = nixpkgs:
let
Expand Down
9 changes: 3 additions & 6 deletions packages/compel/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@

buildPythonPackage rec {
pname = "compel";
version = "0.1.7";
version = "1.1.5";

src = fetchFromGitHub {
src = fetchPypi {
inherit pname version;
owner = "damian0815";
repo = pname;
rev = "085d657356714fbc972f12273ec7803242d602a0";
sha256 = "sha256-v6tkyOH0cBQWPPmi9AY9nvYwaT8QxNpJneB/YWSdlYc=";
sha256 = "932a4448553983db33f4893516239ed5001b384cc211e32841e80b1f94dcd0f6";
};

propagatedBuildInputs = [ pyparsing torch transformers diffusers ];
Expand Down
4 changes: 2 additions & 2 deletions packages/diffusers/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

buildPythonPackage rec {
pname = "diffusers";
version = "0.13.1";
version = "0.16.1";

src = fetchPypi {
inherit pname version;
sha256 = "0k4f9zya92jv4msdm66jaab29avxd6ba9c7aqc2mp7sdycg7mdi9";
sha256 = "4cd7400382c86d85e08425550de1b1a81d4ed03623fbd4bcd8377864d9c46efe";
};

propagatedBuildInputs =
Expand Down
25 changes: 25 additions & 0 deletions packages/fastapi-events/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{ lib
, buildPythonPackage
, fetchPypi
, pythonOlder
, starlette
}:

buildPythonPackage rec {
pname = "fastapi-events";
version = "0.6.0";

disabled = pythonOlder "3.7";

src = fetchPypi {
inherit pname version;
sha256 = "2380cdc3e30dc898d6b721d623c575c6f5b05ee35a3ee05adf0b90b12b9ed1f9";
};

propagatedBuildInputs = [
starlette
];

# TODO FIXME
doCheck = false;
}
24 changes: 24 additions & 0 deletions packages/fastapi-socketio/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{ lib
, buildPythonPackage
, fetchPypi
, fastapi
, python-socketio
}:

buildPythonPackage rec {
pname = "fastapi-socketio";
version = "0.0.9";

src = fetchPypi {
inherit pname version;
sha256 = "8c73aa94fe1bf1c9964ff89233a6ba52eeeec3ac8b9de0024d9d82b11e46bde5";
};

propagatedBuildInputs = [
fastapi
python-socketio
];

# TODO FIXME
doCheck = false;
}
30 changes: 30 additions & 0 deletions packages/peft/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{ buildPythonPackage, fetchPypi, lib
, numpy
, packaging
, psutil
, pyyaml
, torch
, transformers
, accelerate
}:
buildPythonPackage rec {
pname = "peft";
version = "0.3.0";

src = fetchPypi {
inherit pname version;
sha256 = "bbdeee4de3653ee43cb6bbe7505816e6e9b4cf8275471be1707d9c253dfe8e0b";
};

propagatedBuildInputs = [
numpy
packaging
psutil
pyyaml
torch
transformers
accelerate
];
format = "pyproject";
doCheck = false;
}
6 changes: 3 additions & 3 deletions packages/safetensors/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

buildPythonPackage rec {
pname = "safetensors";
version = "0.2.8";
version = "0.3.1";

src = fetchPypi {
inherit pname version;
sha256 = "sha256-JyCyCmo4x5ncp5vXbK7qwvffWFqdT31Z+n4o7/nMsn8=";
sha256 = "571da56ff8d0bec8ae54923b621cda98d36dcef10feb36fd492c4d0c2cd0e869";
};

pythonRemoveDeps = [ "setuptools-rust" ];
Expand All @@ -24,7 +24,7 @@ buildPythonPackage rec {
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src sourceRoot;
name = sourceRoot;
hash = "sha256-ylpf82NXlpo4+u5HZVYeJI8I6VBFAukzC7Er6BZk1Ik=";
hash = "sha256-IsePAiBsA/YjO1rhae49+4q67WdN5ieBMmjpzxRxxNE=";
patches = [ ./cargo-lock.patch ];
};

Expand Down