Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComfyScript unexpected behaviour with Fooocus Text #59

Open
cihangoksu opened this issue Jul 3, 2024 · 6 comments
Open

ComfyScript unexpected behaviour with Fooocus Text #59

cihangoksu opened this issue Jul 3, 2024 · 6 comments
Labels
bug Something isn't working runtime transpiler

Comments

@cihangoksu
Copy link

Hi all,

I've been trying to use the following workflow with comfyscript but somehow generated script fails to run:
workflow:
https://openart.ai/workflows/datou/fooocus-text/sl9YxQ1umL1N9aRHtldI

Even the following simple script follows cannot run successfully, and fails at FooocusStyles.
######################SCRIPT FAILING ###################################
from comfy_script.runtime import *
load()
from comfy_script.runtime.nodes import *
with Workflow():
#_ = FooocusNegative('')
positive = FooocusPositive('a frozen brain is on fire, "LABEL"')
pipe = FooocusLoader('dreamshaperXL_lightningDPMSDE.safetensors', 'None', 0.5, 'joint', positive, '', '1024 x 1024', 1024, 1024, 1, None)
fooocus_styles = FooocusStyles('fooocus_styles')
###############################################################

image

@Chaoses-Ib Chaoses-Ib added bug Something isn't working runtime labels Jul 3, 2024
@Chaoses-Ib
Copy link
Owner

I'll fix this later. A workaround is to run ComfyUI in a separate process, and then load('http://127.0.0.1:8188/').

@cihangoksu
Copy link
Author

Tyu for quick reply :-) I basically opened a new terminal and run ComfyUI there, opened a browser with the workflow. Then in another terminal I ran the same script this time with load('http://127.0.0.1:8188/')

But I still get the same error. Did I somehow miss stg in the workaround you suggested actually?

@Chaoses-Ib
Copy link
Owner

Sorry, I misunderstood the problem. The real problem is FooocusStyles is an output type, and FooocusStyles_ is the actual node. So the fix should be changing FooocusStyles to FooocusStyles_ .

image

Looks like you got the code from the transpiler, which at the moment can't distinguish types/nodes with the same name (#30). I'll try to mitigate this problem in the future.

@cihangoksu
Copy link
Author

Thank you very much for your help! I finally got it running, but only with the following required changes:

  1. I had to force "run" function at
    Path/To/ComfyUI/custom_nodes/Fooocus_Nodes/py/prompt.py
    with the customized values (usually selected by UI) as
    try:
    values = []
    if my_unique_id in prompt:
    if prompt[my_unique_id]["inputs"]["select_styles"]:
    values = prompt[my_unique_id]["inputs"]["select_styles"].split(
    ",")
    except:
    values = ["Fooocus V2","Fooocus Enhance","Fooocus Sharp","SAI Enhance","SAI Texture","SAI Digital Art"]

  2. Somehow workflow ends up with an empty loras input for the "refresh_loras" function at
    Path/To/ComfyUI/custom_nodes/Fooocus_Nodes/py/modules/default_pipeline.py
    There I added a single line to fix this issue just before refreshing:
    if loras is None: loras = [] #cgoksu

Then it all worked fine, hurray! :-)

@Chaoses-Ib
Copy link
Owner

The first issue can be solved without the change by explicitly specifying the missing select_styles input:

FooocusStyles('fooocus_styles', select_styles='Fooocus V2,Fooocus Enhance,Fooocus Sharp,SAI Enhance,SAI Texture,SAI Digital Art')
# or: FooocusStyles('fooocus_styles', select_styles=','.join(["Fooocus V2","Fooocus Enhance","Fooocus Sharp","SAI Enhance","SAI Texture","SAI Digital Art"]))

The second one is a bug and now fixed. Thanks for your report.

@cihangoksu
Copy link
Author

Tyuuu sounds much better indeed to add those as you suggested... Great to hear its now fixed! Keep up with the great work :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working runtime transpiler
Projects
None yet
Development

No branches or pull requests

2 participants