|
1 | | -# 🔥OpenVINO Node for ComfyUI🔥 |
| 1 | +<div align="center"> |
2 | 2 |
|
3 | | -This node is designed for optimizing the performance of model inference in ComfyUI by leveraging [Intel OpenVINO toolkits](https://github.com/openvinotoolkit/openvino). |
| 3 | +# 🔥 OpenVINO Node for ComfyUI 🔥 |
| 4 | + |
| 5 | +**Optimize model inference in ComfyUI with [Intel OpenVINO toolkits](https://github.com/openvinotoolkit/openvino)** |
4 | 6 |
|
5 | 7 |  |
6 | 8 |
|
| 9 | +--- |
7 | 10 |
|
8 | | ---- |
| 11 | +[Supported Hardware](#-supported-hardware) • [Install](#-install) • [Instruction](#-instruction) • [Q&A](#-qa) |
9 | 12 |
|
10 | | -- [OpenVINO Node for ComfyUI](#openvino-node-for-comfyui) |
11 | | - - [Supported Hardware](#supported-hardware) |
12 | | - - [Install](#install) |
13 | | - - [Comfy Registry](#comfy-registry) |
14 | | - - [ComfyUI-Manager](#comfyui-manager) |
15 | | - - [Manual](#manual) |
16 | | - - [Instruction](#instruction) |
17 | | - - [Q&A](#qa) |
| 13 | +</div> |
18 | 14 |
|
19 | | -## 💻Supported Hardware |
| 15 | +<br/> |
20 | 16 |
|
21 | | -This node can support running model on Intel CPU, GPU and NPU device.You can find more detailed informantion in [OpenVINO System Requirements](https://docs.openvino.ai/2025/about-openvino/release-notes-openvino/system-requirements.html). |
| 17 | +## 💻 Supported Hardware |
22 | 18 |
|
| 19 | +This node can support running model on Intel CPU, GPU and NPU device. You can find more detailed informantion in [OpenVINO System Requirements](https://docs.openvino.ai/2025/about-openvino/release-notes-openvino/system-requirements.html). |
23 | 20 |
|
24 | | -## 🚗Install |
| 21 | +<br/> |
25 | 22 |
|
26 | | -**Prererquisites** |
| 23 | +## 🚗 Install |
27 | 24 |
|
28 | | -- Install [comfy-cli](https://docs.comfy.org/comfy-cli/getting-started) |
| 25 | +> **Prererquisites** — Install [comfy-cli](https://docs.comfy.org/comfy-cli/getting-started) |
29 | 26 |
|
30 | 27 | The recommended installation method is to use the Comfy Registry. |
31 | 28 |
|
32 | 29 | ### Comfy Registry |
33 | 30 |
|
34 | 31 | These nodes can be installed via the [Comfy Registry](https://registry.comfy.org/nodes/comfyui-openvino). |
35 | 32 |
|
36 | | -``` |
| 33 | +```bash |
37 | 34 | comfy node registry-install comfyui-openvino |
38 | 35 | ``` |
39 | 36 |
|
40 | 37 | ### ComfyUI-Manager |
41 | 38 |
|
42 | 39 | This node can be installed via ComfyUI-Manager in the UI or via the CLI: |
43 | 40 |
|
44 | | -``` |
| 41 | +```bash |
45 | 42 | comfy node install comfyui-openvino |
46 | 43 | ``` |
47 | 44 |
|
48 | 45 | ### Manual |
49 | 46 |
|
50 | 47 | This node can also be installed manually by copying them into your `custom_nodes` folder and then installing dependencies: |
51 | 48 |
|
52 | | -``` |
| 49 | +```bash |
53 | 50 | cd ComfyUI/custom_nodes |
54 | | -git clone https://github.com/openvino-dev-samples/comfyui_openvino |
| 51 | +git clone https://github.com/openvino-dev-samples/comfyui_openvino |
55 | 52 | cd comfyui_openvino |
56 | 53 | pip install -r requirements.txt |
57 | 54 | ``` |
58 | 55 |
|
59 | | -## 🚀Instruction |
| 56 | +<br/> |
| 57 | + |
| 58 | +## 🚀 Instruction |
| 59 | + |
60 | 60 | To trigger OpenVINO Node for ComfyUI, you can follow the example as reference: |
61 | | -1. Start a ComfyUI server. |
| 61 | + |
| 62 | +**1. Start a ComfyUI server.** |
62 | 63 |
|
63 | 64 | - lanuch from source: |
64 | | - ``` |
65 | | - cd ComfyUI |
66 | | - python3 main.py --cpu --use-pytorch-cross-attention |
67 | | - ``` |
| 65 | + ```bash |
| 66 | + cd ComfyUI |
| 67 | + python3 main.py --cpu --use-pytorch-cross-attention |
| 68 | + ``` |
68 | 69 |
|
69 | 70 | - lanuch from comfy-cli: |
70 | | - ``` |
71 | | - comfy launch -- --cpu --use-pytorch-cross-attention |
72 | | - ``` |
73 | | - |
74 | | -3. Prepare a standard workflow in ComfyUI. |
75 | | - |
76 | | -  |
77 | | -
|
78 | | -4. Add OpenVINO Node. |
79 | | - |
80 | | -  |
81 | | - |
82 | | -5. Connect `TorchCompileDiffusionOpenVINO` with Diffusion model and `TorchCompileVAEOpenVINO` with VAE model |
83 | | - |
84 | | -  |
85 | | -
|
86 | | -6. Run workflow. Please notice it may need an additional warm-up inference after switching new model. |
87 | | - |
88 | | -  |
89 | | -
|
90 | | -## 🤔Q&A |
91 | | -
|
92 | | -1. **Does it support LoRA loader ?** |
93 | | - |
94 | | - Yes, and you can refer the following picture to add it into a workflow of OpenVINO node. |
95 | | -
|
96 | | - <img width="2000" height="805" alt="image" src="https://github.com/user-attachments/assets/ea1f7c6b-bbbc-4ee9-b5fd-62675d6aaa4e" /> |
97 | | -
|
98 | | -2. **How to install ComfyUI-OpenVINO via ComfyUI-Manager in the Portable version of ComfyUI?** |
99 | | -
|
100 | | - ComfyUI-Manager is **not enabled by default** in the Portable version. Follow the [official guide](https://docs.comfy.org/manager/install#portable-users) to enable it first. |
101 | | -
|
102 | | - Portable ComfyUI builds may not include Git, which is required for ComfyUI-Manager to work. It is recommended to download [Portable Git](https://git-scm.com/downloads/win) and explicitly set its path in your `.bat` launcher before starting ComfyUI: |
103 | | - ```bat |
104 | | - set GIT_PYTHON_GIT_EXECUTABLE=C:\path\to\portable-git\bin\git.exe |
105 | | - ``` |
106 | | - |
107 | | - After installing the extension via the Manager, make sure that the installed dependencies match the versions specified in: |
108 | | - ``` |
109 | | - ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-openvino\requirements.txt |
110 | | - ``` |
111 | | - If newer versions were installed automatically, downgrade them to match. Note that the extension currently requires **torch <=2.6.0 and torchaudio <=2.6.0** specifically; if newer versions are already installed, downgrade them. |
112 | | - |
113 | | -3. **`RuntimeError: Compiler: 'cl' is not found` at higher resolutions — how to fix?** |
114 | | - |
115 | | - At low resolutions (e.g. 512×512) the extension works fine. At higher resolutions, PyTorch's inductor triggers a JIT C++ compilation step that requires MSVC (`cl.exe`). |
116 | | - |
117 | | - **Fix:** Install [Visual Studio](https://visualstudio.microsoft.com/) (Community edition is sufficient) or the standalone [MSVC Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/). During installation, make sure to select the **"Desktop development with C++"** workload — this is what actually installs `cl.exe` and the required C++ components. |
118 | | - Then activate the MSVC environment in your `.bat` launcher **before** starting ComfyUI: |
119 | | - ```bat |
120 | | - call "C:\Program Files\Microsoft Visual Studio\18\Community\VC\Auxiliary\Build\vcvars64.bat" |
121 | | - ``` |
122 | | - Adjust the path to match your Visual Studio version and edition. |
123 | | - |
124 | | -5. **C++ compile error due to a space in the `torchinductor` cache folder name — how to fix?** |
125 | | - |
126 | | - If your Windows display name (Full Name) contains a space (e.g. `John Doe`), PyTorch will create a temp folder like: |
127 | | - ``` |
128 | | - C:\Users\John\AppData\Local\Temp\torchinductor_John Doe |
129 | | - ``` |
130 | | - The space in the path breaks the MSVC compiler. |
131 | | - |
132 | | - **Fix:** Override `USERNAME` in your `.bat` launcher before starting ComfyUI: |
133 | | - ```bat |
134 | | - set USERNAME=User |
135 | | - ``` |
136 | | - This only affects the current session and does not change your Windows account. After this, PyTorch will create the temp folder as: |
137 | | - ``` |
138 | | - C:\Users\John\AppData\Local\Temp\torchinductor_User |
139 | | - ``` |
140 | | - |
141 | | - If your **Windows account folder name** (e.g. `C:\Users\John Doe\`) also contains a space, overriding `USERNAME` alone is not enough — the temp path will still be broken. In that case, redirect the temp directory to a path without spaces: |
142 | | - ```bat |
143 | | - set TEMP=C:\tmp |
144 | | - set TMP=C:\tmp |
145 | | - ``` |
146 | | - Make sure the folder `C:\tmp` exists before launching ComfyUI. |
147 | | - |
148 | | -6. **`python_embeded` is missing Python headers/libraries for C++ compilation — how to fix?** |
149 | | - |
150 | | - Portable ComfyUI uses a stripped-down embedded Python that is missing the `include` and `libs` directories required for C++ compilation. |
151 | | - |
152 | | - **Fix:** |
153 | | - 1. Download the full Python installer for the **same version** as your `python_embeded`. |
154 | | - 2. Copy the `include` and `libs` folders from the full Python installation into your `ComfyUI_windows_portable\python_embeded\` directory. |
155 | | - |
156 | | - After this, `cl.exe` will be able to compile successfully. |
157 | | - |
158 | | - <details> |
159 | | - <summary>📄 Example <code>run_cpu.bat</code> with all fixes applied</summary> |
160 | | - |
161 | | - ```bat |
162 | | - call "C:\Program Files\Microsoft Visual Studio\18\Community\VC\Auxiliary\Build\vcvars64.bat" |
163 | | - set USERNAME=User |
164 | | - set GIT_PYTHON_GIT_EXECUTABLE=C:\Users\John\ComfyUI_windows_portable\git\bin\git.exe |
165 | | - .\python_embeded\python.exe -s ComfyUI\main.py --cpu --windows-standalone-build --enable-manager --use-pytorch-cross-attention |
166 | | - pause |
167 | | - ``` |
168 | | - </details> |
| 71 | + ```bash |
| 72 | + comfy launch -- --cpu --use-pytorch-cross-attention |
| 73 | + ``` |
| 74 | + |
| 75 | +**2. Prepare a standard workflow in ComfyUI.** |
| 76 | + |
| 77 | +  |
| 78 | + |
| 79 | +**3. Add OpenVINO Node.** |
| 80 | + |
| 81 | +  |
| 82 | + |
| 83 | +**4. Connect `TorchCompileDiffusionOpenVINO` with Diffusion model and `TorchCompileVAEOpenVINO` with VAE model** |
| 84 | + |
| 85 | +  |
| 86 | + |
| 87 | +**5. Run workflow.** Please notice it may need an additional warm-up inference after switching new model. |
| 88 | + |
| 89 | +  |
| 90 | + |
| 91 | +<br/> |
| 92 | + |
| 93 | +## 🤔 Q&A |
| 94 | + |
| 95 | +<details open> |
| 96 | +<summary><b>1. Does it support LoRA loader ?</b></summary> |
| 97 | + |
| 98 | +<br/> |
| 99 | + |
| 100 | +Yes, and you can refer the following picture to add it into a workflow of OpenVINO node. |
| 101 | + |
| 102 | +<img width="2000" height="805" alt="image" src="https://github.com/user-attachments/assets/ea1f7c6b-bbbc-4ee9-b5fd-62675d6aaa4e" /> |
| 103 | + |
| 104 | +</details> |
| 105 | + |
| 106 | +--- |
| 107 | + |
| 108 | +<details> |
| 109 | +<summary><b>2. How to install ComfyUI-OpenVINO via ComfyUI-Manager in the Portable version of ComfyUI?</b></summary> |
| 110 | + |
| 111 | +<br/> |
| 112 | + |
| 113 | +ComfyUI-Manager is **not enabled by default** in the Portable version. Follow the [official guide](https://docs.comfy.org/manager/install#portable-users) to enable it first. |
| 114 | + |
| 115 | +Portable ComfyUI builds may not include Git, which is required for ComfyUI-Manager to work. It is recommended to download [Portable Git](https://git-scm.com/downloads/win) and explicitly set its path in your `.bat` launcher before starting ComfyUI: |
| 116 | +```bat |
| 117 | +set GIT_PYTHON_GIT_EXECUTABLE=C:\path\to\portable-git\bin\git.exe |
| 118 | +``` |
| 119 | + |
| 120 | +After installing the extension via the Manager, make sure that the installed dependencies match the versions specified in: |
| 121 | +``` |
| 122 | +ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-openvino\requirements.txt |
| 123 | +``` |
| 124 | +If newer versions were installed automatically, downgrade them to match. Note that the extension currently requires **torch <=2.6.0 and torchaudio <=2.6.0** specifically; if newer versions are already installed, downgrade them. |
| 125 | + |
| 126 | +</details> |
| 127 | + |
| 128 | +--- |
| 129 | + |
| 130 | +<details> |
| 131 | +<summary><b>3. <code>RuntimeError: Compiler: 'cl' is not found</code> at higher resolutions — how to fix?</b></summary> |
| 132 | + |
| 133 | +<br/> |
| 134 | + |
| 135 | +At low resolutions (e.g. 512x512) the extension works fine. At higher resolutions, PyTorch's inductor triggers a JIT C++ compilation step that requires MSVC (`cl.exe`). |
| 136 | +
|
| 137 | +**Fix:** Install [Visual Studio](https://visualstudio.microsoft.com/) (Community edition is sufficient) or the standalone [MSVC Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/). During installation, make sure to select the **"Desktop development with C++"** workload — this is what actually installs `cl.exe` and the required C++ components. |
| 138 | +Then activate the MSVC environment in your `.bat` launcher **before** starting ComfyUI: |
| 139 | +```bat |
| 140 | +call "C:\Program Files\Microsoft Visual Studio\18\Community\VC\Auxiliary\Build\vcvars64.bat" |
| 141 | +``` |
| 142 | +Adjust the path to match your Visual Studio version and edition. |
| 143 | +
|
| 144 | +</details> |
| 145 | +
|
| 146 | +--- |
| 147 | +
|
| 148 | +<details> |
| 149 | +<summary><b>4. C++ compile error due to a space in the <code>torchinductor</code> cache folder name — how to fix?</b></summary> |
| 150 | +
|
| 151 | +<br/> |
| 152 | +
|
| 153 | +If your Windows display name (Full Name) contains a space (e.g. `John Doe`), PyTorch will create a temp folder like: |
| 154 | +``` |
| 155 | +C:\Users\John\AppData\Local\Temp\torchinductor_John Doe |
| 156 | +``` |
| 157 | +The space in the path breaks the MSVC compiler. |
| 158 | +
|
| 159 | +**Fix:** Override `USERNAME` in your `.bat` launcher before starting ComfyUI: |
| 160 | +```bat |
| 161 | +set USERNAME=User |
| 162 | +``` |
| 163 | +This only affects the current session and does not change your Windows account. After this, PyTorch will create the temp folder as: |
| 164 | +``` |
| 165 | +C:\Users\John\AppData\Local\Temp\torchinductor_User |
| 166 | +``` |
| 167 | +
|
| 168 | +If your **Windows account folder name** (e.g. `C:\Users\John Doe\`) also contains a space, overriding `USERNAME` alone is not enough — the temp path will still be broken. In that case, redirect the temp directory to a path without spaces: |
| 169 | +```bat |
| 170 | +set TEMP=C:\tmp |
| 171 | +set TMP=C:\tmp |
| 172 | +``` |
| 173 | +Make sure the folder `C:\tmp` exists before launching ComfyUI. |
| 174 | +
|
| 175 | +</details> |
| 176 | +
|
| 177 | +--- |
| 178 | +
|
| 179 | +<details> |
| 180 | +<summary><b>5. <code>python_embeded</code> is missing Python headers/libraries for C++ compilation — how to fix?</b></summary> |
| 181 | +
|
| 182 | +<br/> |
| 183 | +
|
| 184 | +Portable ComfyUI uses a stripped-down embedded Python that is missing the `include` and `libs` directories required for C++ compilation. |
| 185 | +
|
| 186 | +**Fix:** |
| 187 | +1. Download the full Python installer for the **same version** as your `python_embeded`. |
| 188 | +2. Copy the `include` and `libs` folders from the full Python installation into your `ComfyUI_windows_portable\python_embeded\` directory. |
| 189 | +
|
| 190 | +After this, `cl.exe` will be able to compile successfully. |
| 191 | +
|
| 192 | +<details> |
| 193 | +<summary>📄 Example <code>run_cpu.bat</code> with all fixes applied</summary> |
| 194 | +
|
| 195 | +```bat |
| 196 | +call "C:\Program Files\Microsoft Visual Studio\18\Community\VC\Auxiliary\Build\vcvars64.bat" |
| 197 | +set USERNAME=User |
| 198 | +set GIT_PYTHON_GIT_EXECUTABLE=C:\Users\John\ComfyUI_windows_portable\git\bin\git.exe |
| 199 | +.\python_embeded\python.exe -s ComfyUI\main.py --cpu --windows-standalone-build --enable-manager --use-pytorch-cross-attention |
| 200 | +pause |
| 201 | +``` |
| 202 | +</details> |
169 | 203 |
|
| 204 | +</details> |
0 commit comments