Live data from Hacker News

Fooocus: OSS for image generation by ControlNet author

github.com

51–59 of 59 posts

Re: Fooocus: OSS for image generation by ControlNet author

#51

The sample image on the github page doesn't look great. Major problems with the eyes, something both SD and MJ have solved, for the most part.

Without something like Adetailer or the ComfyUI equivalent it’s kind of useless to do anything with relatively small faces.

For those that don’t know, the Adetailer extension for Auto1111 does a second pass on faces at a higher resolution and then inpaints them back in.

Re: Fooocus: OSS for image generation by ControlNet author

#52

"Native refiner swap inside one single k-sampler. The advantage is that now the refiner model can reuse the base model's momentum (or ODE's history parameters) collected from k-sampling to achieve more coherent sampling. In Automatic1111's high-res fix and ComfyUI's node system, the base model and refiner use two independent k-samplers, which means the momentum is largely wasted, and the sampling continuity is broken…

As a frontend developer, this reads to me as technobabble you'd find in entertainment media. In general, I learn about things not directly related to my sphere of interests by osmosis, but this is on another level. Reminds me of the time when I started my computing journey. I wonder if I'll be able to understand this eventually just by reading a relevant comment or blog here and there.

Here's my attempt at an explanation without jargon, you can just read the last paragraph, the first 4 are just context.

These image models are trained on 1000 steps of noise, where at 0 no noise is added to the training image and at 1000 the image is pure noise. The model's goal it to denoise the image, and it does this knowing how much noise the image has, this makes the model learn how much it should change the image, for example at high noise it changes a lot of pixels and starts building the overall "structure" of the image, and a low noise it changes less pixels and focuses on adding details.

To use the model you start with pure noise, then the model iteratively denoises that noise until a clean image shows up. A naive approach would take 1000 steps, this means you run the model 1000 times, each time feeding the previous result and telling the model that the noise decreased by 1 until it reaches 0 noise. This takes a long time, up to 15 minutes to generate an image on a mid-range consumer GPU.

Turns out when you give the model pure noise and tell it there's 1000 steps of noise, the result is not an image that has 999 steps of noise, but an image that looks like it has much less, this means that you can probably skip 50-100 steps of denoising per iteration and still get a very good picture, the issue is: what steps to pick? You could again take a naive approach and just skip every 50 steps for a total of 20 steps, but turns out there's better ways.

This is where samplers come in, essentially a sampler takes the number of steps you want to take to denoise an image (usually ~20 steps) and it will--among other things--pick which steps to choose each iteration. The most popular samplers are the samplers in the k-diffusion repo[1] or k-samplers for short. Do note that samplers do much more than just pick the steps, they are actually responsible for doing the denoising process itself, some of them even add a small noise after a denoising step among other things.

The newest open source model, SDXL, is actually 2 models. A base model that can generate images as normal, and a refiner model that is specialized on adding details to images. A typical workflow is to ask the base model for 25 steps of denoise, but only run the first 20, then use the refiner model to do the rest. According to the OP, this was being done without keeping the state of the sampler, that is they were running 2 samplers separately, one for the base model and then start one over for the refiner model. Since the samplers use historical data for optimization, the end result was not ideal.

[1] https://github.com/crowsonkb/k-diffusion

Re: Fooocus: OSS for image generation by ControlNet author

#53
post #21

Earlier quoted context omitted.

I appreciate advices, but I believe this one is not on point I expressed, as it only reiterates on a premise that I follow already but find mostly useless irl.

I’ve been writing software for 30 years, and have often worked on OS code bases with revision history that extends back to the 1970s. Your style of commit message is a crime against the future. It makes it impossible for a future developer to understand why you did something or what you were thinking.

[deleted]

Re: Fooocus: OSS for image generation by ControlNet author

#54
Just like I expected, I get this error when trying to run it on my AMD GPU...

"RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx"

Maybe it can get modified to use DirectML? Although it looks like it's using PyTorch 2.0, and I think torch-directml only supports 1.13. Why is ML and GPGPU such a dependency mess?

Re: Fooocus: OSS for image generation by ControlNet author

#56

definitely the smoothest install process and relatively snappy on my local windows machine that I've come across. I do hope to see some ControlNet integrations as that's become a key part of my workflow for exploring new images.

Would you be willing to share a bit how you use controlnet in your exploration workflow?

My biggest discovery so far is using shuffle to guide the output style (and curating a folder of great style guide images).

Re: Fooocus: OSS for image generation by ControlNet author

#57

Earlier quoted context omitted.

As a frontend developer, this reads to me as technobabble you'd find in entertainment media. In general, I learn about things not directly related to my sphere of interests by osmosis, but this is on another level. Reminds me of the time when I started my computing journey. I wonder if I'll be able to understand this eventually just by reading a relevant comment or blog here and there.

The image is produced by sampling the model, which is the most computationally intensive process in the pipeline. Stable Diffusion XL consists of several parts which have to be sampled separately, losing the context in the process. This samples both parts in a way that no context is lost, improving the result.

What means "sampling" here? Is it like sampling a probability distribution? Or like sampling a continuous image by taking the value of specific pixels?

Re: Fooocus: OSS for image generation by ControlNet author

#59

Earlier quoted context omitted.

The image is produced by sampling the model, which is the most computationally intensive process in the pipeline. Stable Diffusion XL consists of several parts which have to be sampled separately, losing the context in the process. This samples both parts in a way that no context is lost, improving the result.

What means "sampling" here? Is it like sampling a probability distribution? Or like sampling a continuous image by taking the value of specific pixels?

More the former.
Post reply on HN