It's a great experimental project! how can I run the model on ComfyUI and get the best result?

#1
by wikeeyang - opened

Hello! First of all, thank you for sharing! It's a great experimental project. After I actually tested your model, I found that the quality of the image improved significantly, especially in terms of the detail of the images.
Since my GPU only 24GB, I can't complete the inference script of you provided, but I read your script carefully, and I found that it may be a reference to the code of the xlabs x-flux-comfyui project, and then refactored the inference script, so I also did the following experiment:

  1. Referring to the x-flux-comfyui project, design a workflow based on ComfyUI, load your model, to try some tests, the workflow is as belows, I first used the standard node to run, and found that it takes about 50 steps, or higher steps, to get better, better results than the dev model, here due to the limitations of my graphics card, I used FP8 quantization, to load the model and CLIP. My friend MZ also helped convert the quantization model of FP8(https://huggingface.co/MinusZoneAI/flux-dev-de-distill-fp8). Of course, I also know that based on your inference code, this workflow shouldn't be able to render the performance of the model perfectly.
    my firend MZ's workflow:

9a5d025b545cc2c259b74cf7ccc6416.png

my workflow:

Flux1-Dev-Dedistill-Workflow.png

  1. So, I made a second attempt, mapping your inference code to the corresponding module of the "x-flux-comfyui" project, and modifying the: layers.py, model_init.py, sampling.py, .\xflux\src\flux\math.py, and .\xflux\src\flux\modules\layers.py etc. The corresponding module in the script of the project "x-flux-comfyui" code according to your inference code.
    Then use the modified Node to reconfigure the workflow, the result is different from before, but not very big, and it also requires a lot of steps, such as 50-80 steps, to get the output closer to the Flux pro model.
    new workflow as below, remove the PAG node:

Flux1-dev-dedistill-test-workflow-0927-02.png

Here, I have a few questions ask for you, and I look forward to your guidance and help:

  1. Can your inference code use fp8 to load flux and T5-xxl models? In this case, my 24GB graphics card should be able to run inference scripts.
  2. Is it possible to use standard workflow nodes directly? What parameters do I need to adjust to reduce the number of steps and get a better output? With a standard node, it can plug in some Lora and it works, but controlnet cannot work fine.
  3. I attach the code I have modified the node, please help me review whether this method is correct, if I use the modified code to run the workflow, can I connect to the Lora and Controlnet nodes? My previous tests were not ideal, either the effect was not achieved, or the pictures were messy.

I can't upload the script package which I had modified, if you need, I can mail to you for check and modify. thanks a lot!

Where is the cfg at in the last image? This is needed for a de-distilled model.

After playing with this it is a step in the right direction, but can't be used to train on so I have no use for it. I tried everything imaginable to merges to get it to be usable as a base for training.

Hi can i get work flow plz?

@Zorgsd use X-Labs's "x-flux-comfyui" node sample workflow for test.

@wikeeyang Did you end up needing to keep the modifications to the x-labs nodes?

@nominalgeek Yes! I keep my modified script in the x-labs nodes(copy, modify and rename to save) too, for compare the result with the original script.

@nominalgeek you can try: https://civitai.com/models/843551, GGUF format transformer model and workflow, but very slow...

@wikeeyang Slow is an understatement. I've put maybe 12-15k steps in my attempts so far. The quality is good, but I can't get a non-fuzzy result.

@wikeeyang could you share your modification so can I compare to mine? Did you fork their github?

@nominalgeek Share me your mail address, I can send a email of the script to you, or you can try my another workflow as below, 30-50 step, cfg 1.0-4.0, will get good quality image also.
792ead17766615f3733b265e63b115d.png

It might be a good idea to open a pr on the x-labs repo, no?

You can get decent result in 8-16 steps, if you know how. Tho Im not sure how much of "original" dev-de-distilled is in that output. :D

I mix the Flux-Fusion V2 with this model by different ratio each block layers parameter, and tuned the model, now you can only 6-10 step to get better quality than Flux.1 Dev model step 20, if you intersting, you can visit my repo: https://huggingface.co/wikeeyang/Flux.1-Dedistilled-Mix-Tuned-fp8.

Sign up or log in to comment