|
| 1 | +# OneDiff ComfyUI Nodes |
| 2 | + |
| 3 | +- [Installation Guide](#installation-guide) |
| 4 | +- [Nodes Usage](#nodes-usage) |
| 5 | + - [Model Acceleration](#model-acceleration) |
| 6 | + - [Model Speedup](#model-speedup) |
| 7 | + - [Model Graph Saver](#model-graph-saver) |
| 8 | + - [Model Graph Loader](#model-graph-loader) |
| 9 | + - [Quantization](#quantization) |
| 10 | + - [VAE Acceleration](#vae-acceleration) |
| 11 | + - [Image Distinction Scanner](#image-distinction-scanner) |
| 12 | + |
| 13 | + |
| 14 | +## Installation Guide |
| 15 | + |
| 16 | +1. Install and set up [ComfyUI](https://github.com/comfyanonymous/ComfyUI) |
| 17 | + |
| 18 | + |
| 19 | +2. Install PyTorch and OneFlow |
| 20 | + |
| 21 | +Install PyTorch: |
| 22 | + |
| 23 | +```bash |
| 24 | +pip install torch torchvision torchaudio |
| 25 | +``` |
| 26 | + |
| 27 | +Install OneFlow Community(CUDA 11.x) |
| 28 | + |
| 29 | +```bash |
| 30 | +pip install --pre oneflow -f https://oneflow-pro.oss-cn-beijing.aliyuncs.com/branch/community/cu118 |
| 31 | +``` |
| 32 | + |
| 33 | +Install OneFlow Community(CUDA 12.x) |
| 34 | + |
| 35 | +```bash |
| 36 | +pip install --pre oneflow -f https://oneflow-pro.oss-cn-beijing.aliyuncs.com/branch/community/cu121 |
| 37 | +``` |
| 38 | + |
| 39 | +3. Intall onediff |
| 40 | + |
| 41 | +```bash |
| 42 | +https://github.com/Oneflow-Inc/onediff.git |
| 43 | +cd onediff && pip install -e . |
| 44 | +``` |
| 45 | + |
| 46 | +5. Install onediff_comfy_nodes for ComfyUI |
| 47 | + |
| 48 | +```bash |
| 49 | +cd onediff |
| 50 | +cp -r onediff_comfy_nodes path/to/ComfyUI/custom_nodes/ |
| 51 | +``` |
| 52 | + |
| 53 | +6. (Optional) Advanced features |
| 54 | + |
| 55 | +If you need **unrestricted multiple resolution**, **quantization** support or any other more advanced features, please send an email to caishenghang@oneflow.org . Tell us about your **use case, deployment scale and requirements**! |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +## Nodes Usage |
| 61 | + |
| 62 | +**Note** All the images in this section can be loaded directly into ComfyUI. |
| 63 | + |
| 64 | +### Model Acceleration |
| 65 | + |
| 66 | +#### Model Speedup |
| 67 | + |
| 68 | +The "Model Speedup" node takes a model as input and outputs an optimized model. |
| 69 | + |
| 70 | +If the `static_mode` is `enabled` (which is the default), it will take some time to compile before the first inference. |
| 71 | + |
| 72 | +If `static_model` is `disabled`, there is no need for additional compilation time before the first inference, but the inference speed will be slower compared to `enabled`, albeit slightly. |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +#### Model Graph Saver |
| 77 | + |
| 78 | +The optimized model from the "Model Speedup" node can be saved to "graph" by the "Model Graph Saver" node, allowing it to be used in other scenarios without the need for recompilation. |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | +You can set different file name prefixes for different types of models. |
| 83 | + |
| 84 | +#### Model Graph Loader |
| 85 | + |
| 86 | +The "Model Graph Loader" node is used to load graph files from the disk, thus saving the time required for the initial compilation. |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | +### Quantization |
| 91 | + |
| 92 | +The "UNet Loader Int8" node is used to load quantized models. Quantized models need to be used in conjunction with the "Model Speedup" node. |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | +The compilation result of the quantized model can also be saved as a graph and loaded when needed. |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | +### VAE Acceleration |
| 105 | + |
| 106 | +The VAE nodes used for accelerating, saving, and loading VAE graphs operate in a manner very similar to the usage of Model nodes. |
| 107 | + |
| 108 | +Omitting specific details here, the following workflow can be loaded and tested. |
| 109 | + |
| 110 | +**VAE Speedup and Graph Saver** |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +**VAE Speedup and Graph Loader** |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | +### Image Distinction Scanner |
| 119 | + |
| 120 | +The "Image Distinction Scanner" node is used to compare the differences between two images and visualize the resulting variances. |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
0 commit comments