Skip to content

Commit

Permalink
feat: add button to free memory
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelass committed May 9, 2024
1 parent 55fce04 commit 96f6f60
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ personalization in your ComfyUI environment.
* [Colored Nodes](#colored-nodes)
+ [Positive/Negative](#positivenegative)
+ [Dynamic Colors](#dynamic-colors)
- [Main Menu](#main-menu)
* [Unload Models](#unload-models)
- [Context Menu](#context-menu)
* [Nodes](#nodes)
+ [Custom Color Option (only available in "default" Color Mode)](#custom-color-option-only-available-in-default-color-mode)
Expand Down Expand Up @@ -109,7 +111,6 @@ Different customization options available with their default settings and descri
| Connections Width | `3` | Sets the width of connector lines |
| Font Size | `10` | Sets the font size of textareas |
| Colored Nodes | `default` | Applies dynamic coloring to nodes |
| Batch Resize | `false` | Resizes multiple selected nodes to the same size synchronously |

### Colored Nodes

Expand Down Expand Up @@ -141,6 +142,23 @@ Several dynamic coloring modes are available:
<p>Dynamic Colors Modes: plain, by type, rainbow</p>
</div>

## Main Menu

### Unload Models

Free up GPU memory by unloading the models

<div align="center">
<img src="https://github.com/blib-la/blibla-comfyui-extensions/assets/1148334/a81f3689-0291-4f2d-8ce5-3a9b4a8a2e76" alt="Unload Models Button" width="400px">
<p>A new Button is available</p>
</div>

<div align="center">
<img src="https://github.com/blib-la/blibla-comfyui-extensions/assets/1148334/e8d848d5-c157-4574-8fac-7d30052451d0" alt="GPU freed" width="400px">
<p>GPU Memory was freed</p>
</div>


## Context Menu

The context menu offers additional options for nodes, groups, colors, and the canvas:
Expand All @@ -161,6 +179,7 @@ The context menu offers additional options for nodes, groups, colors, and the ca
<p>Reroute show/hide Title</p>
</div>


#### Render Reroute as Dot

<div align="center">
Expand Down
27 changes: 27 additions & 0 deletions extensions/unloadModelsButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { app } from "/scripts/app.js";
import { $el } from "/scripts/ui.js";

const nodeName = "Failfast.unloadModels";

const button = $el(
"button",
{
onclick() {
fetch("/free", {
method: "POST",
body: JSON.stringify({ unload_models: true }),
headers: { "Content-Type": "application/json" },
}).catch((error) => {
console.error(error);
});
},
},
["Unload Models"]
);

app.registerExtension({
name: nodeName,
async init(app) {
app.ui.menuContainer.append(button);
},
});

0 comments on commit 96f6f60

Please sign in to comment.