Update README

This commit is contained in:
space-nuko
2023-05-15 16:22:05 -05:00
parent aebe566142
commit 4d56f2b29e
2 changed files with 19 additions and 4 deletions
+14 -2
View File
@@ -9,7 +9,19 @@ This repo holds a modularized version of [Disco Diffusion](https://github.com/al
1. Clone this repository into your `ComfyUI/custom_nodes` folder with `git clone --recursive https://github.com/space-nuko/ComfyUI-Disco-Diffusion`.
2. Activate the virtualenv you use with ComfyUI.
3. Navigate to the cloned folder and run `pip install -r requirements.txt`.
4. Start ComfyUI.
**NOTE:** You also have to make sure that inference mode is turned off within ComfyUI or you'll get errors.
In `ComfyUI/execution.py`, change:
``` python
with torch.inference_mode():
```
to:
``` python
with torch.inference_mode(False):
```
## Nodes included
@@ -22,7 +34,7 @@ This repo holds a modularized version of [Disco Diffusion](https://github.com/al
The simplest usage is to connect the Guided Diffusion Loader and OpenAI CLIP Loader nodes into a Disco Diffusion node, then hook the Disco Diffusion node up to a Save Image node.
Alternatively, you can substitude the OpenAI CLIP Loader for ComfyUI's CLIP Loader and CLIP Vision Loader, however in this case you need to copy the CLIP model you use into both the `clip` and `clip_vision` subfolders under your `ComfyUI/models` folder, because ComfyUI can't load both at once from the same model file.
Alternatively, you can substitute the OpenAI CLIP Loader for ComfyUI's CLIP Loader and CLIP Vision Loader, however in this case you need to copy the CLIP model you use into both the `clip` and `clip_vision` subfolders under your `ComfyUI/models` folder, because ComfyUI can't load both at once from the same model file.
The Disco Diffusion node uses a special syntax for writing prompts, which is shown below.
+5 -2
View File
@@ -23,6 +23,7 @@ from numpy import asarray
from . import py3d_tools as p3dT
from . import disco_xform_utils as dxf
from .CLIP import clip
import open_clip
import comfy.model_management
import comfy.utils
@@ -118,8 +119,11 @@ def get_input_resolution(clip_model):
if isinstance(clip_model, ClipVisionModel):
# ComfyUI (Transformers)
return clip_model.model.config.image_size
elif isinstance(clip_model, open_clip.CLIP):
# OpenClip
return clip_model.visual.image_size[0]
else:
# OpenAI/OpenClip
# OpenAI
return clip_model.visual.input_resolution
except Exception as err:
print("Couldn't find clip vision image size! " + str(err) + " " + str(type(clip_model)))
@@ -340,7 +344,6 @@ def run_one_frame(diffusion, model, clip_model, clip_vision, args, batchNum, fra
print(f'Frame {frame_num} Prompt: {frame_prompt}')
clip_models = [clip_model]
model_stats = []