Skip to content

Commit

Permalink
Fix overrides not affecting comfyui's environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludvig Böklin committed Apr 26, 2024
1 parent cf14668 commit 70e5aab
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 53 deletions.
9 changes: 3 additions & 6 deletions overlays/python/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ lib: {

pythonFinal = final: prev: {
python = prev.python.override {
packageOverrides = _: _: {
torch = final.torch;
};
# gives us a `python` where `python3Packages.python.pkgs` is the same package set as our `python3Packages`
# with overrides applied
packageOverrides = _: _: final;
};
};

Expand All @@ -59,9 +59,6 @@ lib: {
cudaSupport = false;
rocmSupport = true;
};
torchvision = prev.torchvision.overridePythonAttrs (old: {
patches = (old.patches or []) ++ [ ./torchvision/fix-rocm-build.patch ];
});
};

torchCuda = final: prev: {
Expand Down
30 changes: 0 additions & 30 deletions overlays/python/torchvision/fix-rocm-build.patch

This file was deleted.

30 changes: 13 additions & 17 deletions projects/comfyui/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,26 @@ in
# TODO: identify what we actually need
(l.overlays.callManyPackages [
../../packages/mediapipe
../../packages/accelerate
])
# what gives us a python with the cuda/rocm torch package override
# what gives us a python with the overrides actually applied
overlays.python-pythonFinal
];

python3Variants = {
amd = l.overlays.applyOverlays pkgs.python3Packages (commonOverlays ++ [
overlays.python-torchRocm
]);
# temp; see below
# nvidia = l.overlays.applyOverlays pkgs.python3Packages (commonOverlays ++ [
# overlays.python-torchCuda
# ]);
nvidia = l.overlays.applyOverlays pkgs.python3Packages (commonOverlays ++ [
# FIXME: temporary standin for practical purposes.
# They're prebuilt and come with cuda support.
(final: prev: {
torch = prev.torch-bin;
torchvision = prev.torchvision-bin;
})
# use this when things stabilise and we feel ready to build the whole thing
# overlays.python-torchCuda
]);
};

mkComfyUIVariant = args:
Expand All @@ -44,19 +51,8 @@ in
python3 = python3Variants.amd.python;
};
comfyui-nvidia = mkComfyUIVariant {
# FIXME: temporary standin for practical purposes.
python3 = pkgs.python3Packages.python.override {
packageOverrides = final: prev: {
torch = prev.torch-bin;
torchvision = prev.torchvision-bin;
};
};
# use this instead if you want to spend a day compiling. (please cachix the result)
# python3 = python3Variants.nvidia.python;
python3 = python3Variants.nvidia.python;
};

# comfyui-krita-amd = _;
# comfyui-krita-nvidia = _;
};
};

Expand Down

0 comments on commit 70e5aab

Please sign in to comment.