mrhan1993 / Fooocus-API

FastAPI powered API for Fooocus
GNU General Public License v3.0
511 stars 137 forks source link

Inpaint is slow because of preparation time and model switching #214

Closed CyrusVorwald closed 4 days ago

CyrusVorwald commented 4 months ago

Inpaint switches and loads models at initialization and again halfway through the steps. It takes about 4x as long as regular image generation between that and the preparation time. I tried setting inpaint_disable_initial_latent to true but it didn't impact timing very much.

konieshadow commented 4 months ago

To reduce cold start time, it only download base model files of the preset when startup. And when using adavance functions such as upscale, inpaint or outpaint, downloading on demand will happend. The interface provided by replicate cannot achieve very flexible use purposes.

CyrusVorwald commented 4 months ago

This occurs every time inpaint is run, even if done repeatedly within a short time period.

konieshadow commented 4 months ago

This occurs every time inpaint is run, even if done repeatedly within a short time period.

I don't have much time to run much tests now. Can you compare it to local deployment (python main.py) and origin Fooocus?

jareddr commented 4 months ago

Sorry to ask a semi-unrelated question in this thread but how does one get inpainting to work?

What format should the image mask be? I've tried both transparent + white pixels for my mask and transparent+black pixels for my mask. Every time I try I just get a new image generation back taking up the whole canvas.

Here is how I have it set up on replicate inpaint image image

inpaint mask (I've tried both black and white masks) image

additional in paint prompt image

Then this is the output I get

image

jareddr commented 4 months ago

Sorry I answered my own question by looking at the code. Mask is working great with black = no change and white = in paint.

homer-simpson-bush-gif