invoke-ai / InvokeAI

InvokeAI is a leading creative engine for Stable Diffusion models, empowering professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry leading WebUI, supports terminal use through a CLI, and serves as the foundation for multiple commercial products.
https://invoke-ai.github.io/InvokeAI/
Apache License 2.0
22.27k stars 2.32k forks source link

[bug]: Canvas state not saving and presets going to default every time I close Invoke #6554

Open smk-e opened 4 days ago

smk-e commented 4 days ago

Is there an existing issue for this problem?

Operating system

macOS

GPU vendor

Apple Silicon (MPS)

GPU model

M1 Max

GPU VRAM

32

Version number

4.2.5

Browser

Safari 17.5

Python dependencies

3.11.8, but problem does not occur during image generation.

What happened

I’m having an issue where my current canvas work is not being saved when I leave the app, and all the models and parameters go back to the default selection. I tried to start from fresh (it didn’t help, same error happened) to all this Patchmatch stoped working. Reinstalled opencv and saving worked yesterday, but today when I opened invoke it was all back to defaults again. Checked the console and it seems it’s getting confused with the location of some files. However, I've discussed this on discord and @psychedelicious pointed that this is not related. There were no generations being performed whilst closing the app, and this has been a persistent problem since installing 4.2. I've also tried opening through different browsers (Firefox, Edge) and still no saved canvas.

What you expected to happen

State of canvas is saved, masks and painted areas remaining as they were back when I open the app. Also models and parameters being used to stay as I left them.

How to reproduce the problem

If any details are needed, please contact.

Additional context

Any help appreciated, thank you very much!

Discord username

smoke0456

psychedelicious commented 4 days ago

This was reported by another user at some point but I can't remember who. I believe the issue is related to how persisting to the browser is debounced by 300ms. If you are generating and state is continually changing, it won't have time to persist the state.

However, in this case, the persistence isn't happening despite there being no visually apparent state changes. There still could be state changes happening internally.

Could be related to a browser extension or setting. Invoke uses IndexedDB to persist state. This browser API is the standard way to persist data - we aren't doing anything out of the ordinary with it. An aggressive extension, or extremely aggressive browser configuration might interfere.

Troubleshooting:

Does the prompt restore itself?


The debounce was put in for performance reasons some time ago, there was some lag with canvas state persistence. I've tested changing this to a throttle strategy in my pending canvas v2 branch and it seems to be working just fine, so we can probably revert back to throttling. Maybe that will fix this issue.

smk-e commented 2 days ago

Hi, thanks for getting back, so I tried your recommendations. I used Firefox (127.0.2) and disabled extensions. When refreshing the page, the state is saved, along with all the parameters. However, if I close the browser window, everything goes blank again, even if the application is still running. I tried the same steps with my default setup (Safari, no private window, no extensions) and the same thing happened. Funnily enough, when I loaded the application through Safari, the prompt and setup when I first raised the issue loaded up, however, the canvas had a grey "failed to load" background, instead of the resulting image. I cleared the canvas history and intermediates before trying the troubleshooting steps.

smk-e commented 1 day ago

Ok, one thing to add: I realised a mistake I was making, hence the previous "failed" state coming back. I had a conda environment loaded as default on my terminal, when I deactivated it, the canvas with loaded presets came back. However, the problem persists. I tried again to refresh the page and data was still there, but when I closed the browser window, canvas was cleared and back to preset defaults. Closing the app through the terminal and re-opening didn't bring anything back.