mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[GH-ISSUE #4328] ComfyUI Integration #52235
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @pkeffect on GitHub (Aug 3, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/4328
Bug Report
Description
The integration of ComfyUI into Open-WebUI seems to have been broken with the latest
Fluxinclusion. No matter what model, including a flux model but not limited to them alone, chosen will give this error:Bug Summary:
Something went wrong :/ 1 validation error for ImageGenerationPayload flux_fp8_clip Input should be a valid boolean, unable to interpret input [type=bool_parsing, input_value='', input_type=str] For further information visit https://errors.pydantic.dev/2.8/v/bool_parsingSteps to Reproduce:
Make sure your ComfyUI endpoint is set correctly. Choose any model and try to generate an image.
Expected Behavior:
Should be generating an image whether a
Fluxmodel is used or not.Actual Behavior:
Tossing the same error no matter what model is chosen as listed above.
Environment
Open WebUI Version: [e.g., 0.1.120]
v0.3.11
Ollama (if applicable): [e.g., 0.1.30, 0.1.32-rc1]
v0.3.3
Operating System: [e.g., Windows 10, macOS Big Sur, Ubuntu 20.04]
Browser (if applicable): [e.g., Chrome 100.0, Firefox 98.0]
Reproduction Details
Confirmation:
Logs and Screenshots
Browser Console Logs:
[Include relevant browser console logs, if applicable]
Docker Container Logs:
[Include relevant Docker container logs, if applicable]
INFO: 172.30.0.1:58950 - "POST /images/api/v1/generations HTTP/1.1" 400 Bad RequestScreenshots (if applicable):
[Attach any relevant screenshots to help illustrate the issue]
Installation Method
[Describe the method you used to install the project, e.g., manual installation, Docker, package manager, etc.]
Additional Information
[Include any additional details that may help in understanding and reproducing the issue. This could include specific configurations, error messages, or anything else relevant to the bug.]
Note
If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!
@neotherack commented on GitHub (Aug 3, 2024):
Having the same thing, just updated.
I'm running non-docker version with CUDA enabled.
It was running on the previouses versions.
@silentoplayz commented on GitHub (Aug 3, 2024):
I also get the
Something went wrong :/ 1 validation error for ImageGenerationPayload flux_fp8_clip Input should be a valid boolean, unable to interpret input [type=bool_parsing, input_value='', input_type=str] For further information visit https://errors.pydantic.dev/2.8/v/bool_parsingerror, even when the safetensors file selected within Open WebUI v0.3.11 is a SD model.ComfyUI integration has been tested in Open WebUI v0.3.10 as well and it works great with a Stable Diffusion safetensors file selected.
@tjbck commented on GitHub (Aug 3, 2024):
@JohnTheNerd
@JohnTheNerd commented on GitHub (Aug 3, 2024):
interesting - I personally use flux (and I'm running the same code from my PR right now). I'll take a look when I get to my computer.
@JohnTheNerd commented on GitHub (Aug 3, 2024):
I see the issue that causes what's happening to OP. I accidentally defined
COMFYUI_FLUX_FP8_CLIPas a string instead of a boolean in config.py - which upsets Pydantic when it's not set and therefore is an empty string. I'll create a PR to fix it, but a potential workaround until the real fix arrives is to simply setCOMFYUI_FLUX_FP8_CLIPto "true" or "false", regardless of whether you use Flux. I am unable to test fp16 Flux as I lack the hardware - I can however make sure other models are not affected and make sure the request is at least sent with or without the lower precision environment variable set.I however have no idea why Flux itself isn't working - it works just fine on my setup. I tested with this environment:
@silentoplayz commented on GitHub (Aug 3, 2024):
Thank you very much for sharing your environment variables utilized for your Open WebUI instance @JohnTheNerd.
I have set
COMFYUI_SD3tofalseand added these 3 environment variables to my .env file.I have also updated the
COMFYUI_SAMPLERenvironment variable within my .env file fromdpmpp_2mtoeuleras well, because that's what the example workflows use for the new Flux model.After having done this and restarted my Open WebUI instance, and ensuring my ComfyUI connection works within Open WebUI, I now get this error within Open WebUI upon trying to generate an image with this setup:
I get this error within the running ComfyUI terminal console as well:
@JohnTheNerd commented on GitHub (Aug 3, 2024):
I'm very confused - where did you get the safetensors file for Flux? The only way I know of running it involves putting the sft file in the unet folder of ComfyUI, and that's what the example workflow seems to use.
I looked at the official HF repo when it first released, and I only saw the sft file. it does seem that they have added safetensors files a short while my PR was merged, but I have no idea how to use that. @silentoplayz can you link to the workflow you used with the safetensors?
BTW I have a fix pushed at ghcr.io/johnthenerd/open-webui:comfyui-fix - but it's the x86 version without any CUDA or ollama (there are some GitHub Actions issues I'm having, it seems to not like pushing the package anymore, so I just built and pushed from my laptop). Could you test it and let me know? If you're uncomfortable running the image I built, you can clone my fork and checkout the
comfyui-fixbranch - which has the fix. It's a very small change.@silentoplayz commented on GitHub (Aug 3, 2024):
.
sft= .safetensors, but abbreviated. I've simply renamed the model format to the original.safetensorsthat I'm used to seeing. The model works fine this way inside of the latest version of ComfyUI, along with the example workflows provided. I have tested.sftformat just now for the model file and it does not work and throws the same error within Open WebUI as well.@JohnTheNerd commented on GitHub (Aug 3, 2024):
The fixed Docker image should only fix the case where the environment variable is not set.
The example workflow I linked seems to expect the model file to be in the
unetdirectory (I'm really unsure why, and it's quite annoying to work with, so I'd love to fix that). The VAE is also expected to be calledae.sftin the vae directory, alongside the text encoders as mentioned in the same page.@silentoplayz commented on GitHub (Aug 3, 2024):
Admittedly, while trying to get this all figured out on your Docker build, I decided to switch everything back to the .sft extension. This includes the model itself in both the
checkpointsandunetfolders, and the VAE. Generating an image works successfully now within Open WebUI via ComfyUI integration with the Flux model!@JohnTheNerd commented on GitHub (Aug 3, 2024):
Great! In that case, I will first create a PR that closes this issue, then create a PR in the documentation indicating the exact filenames that must be used.
Do you know if I can somehow get it to load from the checkpoints directory instead of unet? It's otherwise annoying as it cannot be found through the UI anymore, and must be loaded in manually via the environment.
@silentoplayz commented on GitHub (Aug 3, 2024):
Instructions for creating a symbolic link:
In the given example:
X:\ComfyUI-Zluda\ComfyUI-Zluda\models\unet\flux1-schnell-fp8.sftX:\ComfyUI-Zluda\ComfyUI-Zluda\models\checkpoints\flux1-schnell-fp8.sftCommand to create the symbolic link:
Note:
Or you could just have a copy of the model in the checkpoints directory like I have done.
@JohnTheNerd commented on GitHub (Aug 3, 2024):
Sounds good - I will document it accordingly.
@pkeffect commented on GitHub (Aug 3, 2024):
Thank you both.
@JohnTheNerd commented on GitHub (Aug 3, 2024):
Documentation changes are at https://github.com/open-webui/docs/pull/170 - do you have any other suggestions? @silentoplayz
@silentoplayz commented on GitHub (Aug 3, 2024):
LGTM!
@ther3zz commented on GitHub (Aug 4, 2024):
@JohnTheNerd Do the files specifically have to be directly in the unet and vae directories?
For example, will it still work if theyre in models/checkpoints/FLUX1/flux1-schnell.sft?
I seem to be getting the same error that @silentoplayz was receiving but I've implemented your change from here and also ran
ln -s ComfyUI/models/unet/FLUX1/flux1-schnell.sft ComfyUI/models/checkpoints/FLUX1/flux1-schnell.sftI think the only thing different is I have the models in their own FLUX1 directory within checkpoints/unet/vae dirs
Error from comfyui side:
@JohnTheNerd commented on GitHub (Aug 4, 2024):
@ther3zz yes, the exact paths given in the config PR above is exactly where the files must reside. otherwise you will get errors.
@ther3zz commented on GitHub (Aug 4, 2024):
thanks for confirming, did softlinks there and it works now!!
@tjbck commented on GitHub (Aug 4, 2024):
Fix merged to dev, testing wanted here!
@spammenotinoz commented on GitHub (Aug 4, 2024):
THANK-YOU this was the missing step. I had FLUX working in Comfy but Open-WebUI could not find the models. The Symbolic Link fixed that.
Without swearing, shikes this model is better than Midjourney!!
@brunocerq commented on GitHub (Aug 6, 2024):
Using ComfyUi with SD3 and I get the same error in OpenwebUi ver v0.3.11
@donghyeon commented on GitHub (Aug 8, 2024):
I believe the PR related to this issue should align with the official ComfyUI guidelines.
I followed the official examples provided by ComfyUI: https://comfyanonymous.github.io/ComfyUI_examples/flux/. According to their guide, the files should be organized as follows:
However, the current version of Open WebUI requires the following structure:
In the
models/unetdirectory, the same checkpoint files frommodels/checkpointsmust be included, and the.safetensorsextension needs to be changed to.sftin themodels/vaedirectory. This inconsistency can be confusing for users.Currently, I was able to generate high-quality images by rearranging the files as shown above and starting Open WebUI with the environment variable
COMFYUI_FLUX=True. If you are using Docker to start the Open WebUI server, the command should be:docker run -d -p 3000:8080 -e COMFYUI_FLUX=True --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main@brunocerq commented on GitHub (Aug 8, 2024):
Agree with @donghyeon , I too managed to get it working by changing file extensions from .safetensors to .sft and editing the .env file.
I think the way it is now, although working it's not optimal since users must change some file extensions and it's just confusing, just use the standard structure and extensions given by Flux.
@tjbck commented on GitHub (Aug 8, 2024):
PR welcome!
@Taluen79 commented on GitHub (Aug 8, 2024):
Why not just let the open-webui admin input a Comfyui workflow JSON instead of all these env variables all over the place? Comfyui workflow can be saved in an API format, which can then be loaded and reused when making call to a remote Comfyui end-point.
This will enable anyone hosting open-webui to have different workflows that they have developed, instead of everyone just using the exact same vanilla workflow.
@JohnTheNerd commented on GitHub (Aug 9, 2024):
completely agree with @Taluen79 and I would like to implement that. however, I do not know anything about the front-end side of open-webui and would prefer not to learn at this time. this is why all of my image generation related changes have only been configurable via the environment. this would notably also enable the use of LoRA's which is not possible in the current implementation.
any ideas on how I could do this without touching the front-end code, or would anyone be able to implement the front-end if I wrote the back-end piece?
another notable point of consideration is that the custom workflows, unless we keep and maintain the existing implementation, is a breaking change to all current users. not sure how to handle this.
@JohnTheNerd commented on GitHub (Aug 9, 2024):
one thing that comes to mind is yet another environment variable that allows the user to point at a local JSON file with the workflow. however, due to the uniqueness of each workflow, all other environment variables and configuration options related to image generation would need to be ignored whenever a custom workflow is provided.
@Gee1111 commented on GitHub (Sep 3, 2024):
im using the gguf version and got this error: "Something went wrong :/ Expecting value: line 1 column 1 (char 0)"
@cinprens commented on GitHub (Oct 8, 2024):
I don't understand why it gives me such an error, comfyui works properly, there is no problem, but when I want to integrate openwebui, it doesn't work.