Skip to content

Commit

Permalink
ComfyUI gguf support
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludvig Böklin committed Aug 21, 2024
1 parent ffd83ed commit abb556f
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 4 deletions.
38 changes: 38 additions & 0 deletions packages/gguf/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
lib,
buildPythonPackage,
fetchPypi,
numpy,
poetry-core,
tqdm,
sentencepiece,
pythonOlder,
}:
buildPythonPackage rec {
pname = "gguf";
version = "0.9.1";
format = "pyproject";

disabled = pythonOlder "3.7";

src = fetchPypi {
inherit pname version;
hash = "sha256-9ecJh+FbGcVF9qn3UztAM/swYzDrHzxclf0osUw/0zs=";
};

dependencies = [
numpy
poetry-core
tqdm
sentencepiece
];

doCheck = false;

meta = with lib; {
description = "Module for writing binary files in the GGUF format";
homepage = "https://ggml.ai/";
license = licenses.mit;
maintainers = with maintainers; [mitchmindtree];
};
}
18 changes: 18 additions & 0 deletions projects/comfyui/custom-nodes/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,24 @@ in {
};
};

# https://github.com/city96/ComfyUI-GGUF
# GGUF Quantization support for native ComfyUI models
# Use the GGUF Unet loader found under the bootleg category. Install the .gguf models into diffusion_models/
comfyui-gguf = mkComfyUICustomNodes {
pname = "comfyui-gguf";
version = "unstable-2024-08-21";
pyproject = false;
passthru.dependencies.pkgs = with python3Packages; [
gguf
];
src = fetchFromGitHub {
owner = "city96";
repo = "ComfyUI-GGUF";
rev = "8d1fbbc456d50fe340bbbd775cefea79a5ed8835";
hash = "sha256-a6Ip11/96dHcyP881EzeSEi503pNDcz+WiZpdLuBvO4=";
};
};

# Generates masks for inpainting based on text prompts..
# https://github.com/biegert/ComfyUI-CLIPSeg
clipseg = mkComfyUICustomNodes {
Expand Down
1 change: 1 addition & 0 deletions projects/comfyui/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ in {
})
(l.overlays.callManyPackages [
../../packages/mediapipe
../../packages/gguf
../../packages/spandrel
../../packages/colour-science
../../packages/rembg
Expand Down
77 changes: 73 additions & 4 deletions projects/comfyui/models/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ in {
};

# https://huggingface.co/city96/FLUX.1-schnell-gguf/resolve/main/flux1-schnell-Q4_K_S.gguf?download=true
flux1-schnell-gguf-q4_k_s = {
installPath = "unet/flux1-schnell-Q4_K_S.gguf";
flux1-schnell-q4_k_s-gguf = {
installPath = "diffusion_models/flux1-schnell-Q4_K_S.gguf";
src = fetchFromHuggingFace {
owner = "city96";
repo = "FLUX.1-schnell-gguf";
Expand All @@ -27,17 +27,64 @@ in {
type = checkpoint;
base = flux1s;
};
# https://huggingface.co/city96/FLUX.1-schnell-gguf/resolve/main/flux1-schnell-Q4_0.gguf?download=true
flux1-schnell-q4_0-gguf = {
installPath = "diffusion_models/flux1-schnell-Q4_0.gguf";
src = fetchFromHuggingFace {
owner = "city96";
repo = "FLUX.1-schnell-gguf";
resource = "flux1-schnell-Q4_0.gguf";
sha256 = "sha256-kKOT06RL7GkccHAD9DT93gYGS4cLs8IG63pPEJsl/04=";
};
type = checkpoint;
base = flux1s;
};
# https://huggingface.co/city96/FLUX.1-dev-gguf/resolve/main/flux1-dev-Q4_0.gguf?download=true
flux1-dev-Q4_0 = {
installPath = "diffusion_models/flux1-dev-Q4_0.gguf";
src = fetchFromHuggingFace {
owner = "city96";
repo = "FLUX.1-dev-gguf";
resource = "flux1-dev-Q4_0.gguf";
sha256 = "sha256-KGfpV1ZA2AzLy/ZQEGWaTQnmdqA0Y3vDfqx/JTHEbpA=";
};
type = checkpoint;
base = flux1d;
};

flux-clip_l = {
installPath = "clip/flux-clip_l.safetensors";
installPath = "clip/clip_l.safetensors";
src = fetchFromHuggingFace {
owner = "comfyanonymous";
repo = "flux_text_encoders";
resource = "clip_l.safetensors";
sha256 = "sha256-ZgxvWxq66dxJisLSHhNH0qvbDPbAwMhXbNeWSR2abN0=";
};
type = clip;
base = flux1d;
};

# https://huggingface.co/city96/t5-v1_1-xxl-encoder-gguf/resolve/main/t5-v1_1-xxl-encoder-Q4_K_S.gguf?download=true
t5-v1_1-xxl-encoder-Q4_K_S = {
installPath = "clip/t5-v1_1-xxl-encoder-Q4_K_S.gguf";
src = fetchFromHuggingFace {
owner = "city96";
repo = "t5-v1_1-xxl-encoder-gguf";
resource = "t5-v1_1-xxl-encoder-Q4_K_S.gguf";
sha256 = "sha256-iLaWz64JjwO7B4zFlE7wOuwekewCCmsBa3I6DwUyVYw=";
};
type = checkpoint;
};

# https://huggingface.co/city96/t5-v1_1-xxl-encoder-gguf/resolve/main/t5-v1_1-xxl-encoder-Q5_K_M.gguf?download=true
t5-v1_1-xxl-encoder-Q5_K_M = {
installPath = "clip/t5-v1_1-xxl-encoder-Q5_K_M.gguf";
src = fetchFromHuggingFace {
owner = "city96";
repo = "t5-v1_1-xxl-encoder-gguf";
resource = "t5-v1_1-xxl-encoder-Q5_K_M.gguf";
sha256 = "sha256-tRy7ELGnqsbdHDti8O2Qi/0G4LQtLzV31D4GE2H1Ha4=";
};
type = checkpoint;
};

t5xxl_fp8_e4m3fn = {
Expand All @@ -49,6 +96,28 @@ in {
sha256 = "sha256-fTMNpIFhV1QNa7eDi/Y6DwL1c/xIyk2N40uwy/1RTwk=";
};
type = text_encoder;
};

t5xxl_fp16 = {
installPath = "clip/t5xxl_fp16.safetensors";
src = fetchFromHuggingFace {
owner = "comfyanonymous";
repo = "flux_text_encoders";
resource = "t5xxl_fp16.safetensors";
sha256 = "";
};
type = text_encoder;
};

flux1d-vae = {
installPath = "vae/flux1d-vae.safetensors";
src = fetchFromHuggingFace {
owner = "black-forest-labs";
repo = "FLUX.1-dev";
resource = "vae/diffusion_pytorch_model.safetensors";
sha256 = "";
};
type = vae;
base = flux1d;
};

Expand Down

0 comments on commit abb556f

Please sign in to comment.