stable-diffusion-webui-forge
stable-diffusion-webui-forge copied to clipboard
Generate Forever is broken for quite sometime
I know you have been busy fixing bugs in forge but can you please fix the generate forever button. Every time I click it UI starts to misbehave and I have to restart again. Thank you for Forge. It has been extremely helpful for my lowvram setup.
i just tested and works without any problems?
i just tested and works without any problems?
For some reason mine is broken. I will try again after updating.
Just updated Forge and generate forever is working again. Thank you very much. One thing I want to say is when I change prompt or image size it still generates old parameters and after cancelling generate forever and interrupting it keeps on going by itself with old parameters. Restarting again fixes it. I am using stability matrix and 2gb vram gpu maybe that's the reason. I will delete everything and try again. Again thank you very much because of you I can use sd 1.5 and SDXL on on my laptop.😁
@lllyasviel
i just tested and works without any problems?
Steps to reproduce:
- Start generate forever in the txt2img tab
- Switch to the img2img tab
- (possibly wait until one image completes)
- Switch back to txt2img
- Now the progress bar is broken
- Click "Cancel generate forever"
- Now the button will change from "Interrupt" to "Generate" and previews will stop showing, as if generation was paused
- But the generation will go on forever in the background, until the page is refreshed
(I'm using Firefox on Linux.)
Other issues reporting on the same problem:
- https://github.com/lllyasviel/stable-diffusion-webui-forge/issues/875
- https://github.com/lllyasviel/stable-diffusion-webui-forge/issues/929
- https://github.com/lllyasviel/stable-diffusion-webui-forge/issues/1004
- https://github.com/lllyasviel/stable-diffusion-webui-forge/issues/1190
I'm replying here because only this issue got an official reply so far, but all issues except 875 could be closed as duplicate, I think.
@akaGik-jit I'm also having the issue that you mentioned, where stopping generate forever doesn't stop it, and it continues using old parameters. I'm not sure what is happening, but one thought is that it is sending multiple commands to generate forever that somehow get queued up, and even though you stop it in the browser, these generate commands are still sent to the server?
I'm using Forge installed through StabilityMatrix and having the same issue. It's updated to the current latest version. After starting Generate Forever, the first bath will generate normally (progress bar, preview, grid image works normally). But after the first batch, previews stop working, grids will still process for a few batches but it also stops working eventually. The prompts are also locked in (changing the prompts won't affect the output). After clicking 'Cancel generate forever', the UI stops showing the progress/preview but it keeps generating in the background. Only restarting the whole UI stops it from generating.
I managed to partially fix this.
Some weird stuff is going with background tabs, causing the generate button to get spammed. I added some extra checks to prevent this. However, while switching browser tabs or minimizing the window is working, switching between UI tabs (txt2img, img2img etc) is still kinda broken.
Edit: Found another issue, if the tab is completely in the background it will stop generating after a while until it has focus again. But at least it won't break when you come back to it. Ymmv depending on your browser.
Check below for more info, but either way, here is the code:
File: javascript\contextMenus.js
Function: generateOnRepeat
let generateOnRepeat = function(genbuttonid, interruptbuttonid) {
let genbutton = gradioApp().querySelector(genbuttonid);
// I'm not familiar with gradio, perhaps there is a way to do this with the existing genbutton variable
let genbutton_ = document.getElementById(genbuttonid.slice(1));
let genbutton_state = genbutton_.getAttribute('data-state') === 'clicked';
let interruptbutton = gradioApp().querySelector(interruptbuttonid);
if (!interruptbutton.offsetParent) {
if (!genbutton_state) { // Might not be necessary to check this here, but shouldn't cause problems either
genbutton_.setAttribute('data-state', 'clicked');
genbutton.click();
}
}
clearInterval(window.generateOnRepeatInterval);
window.generateOnRepeatInterval = setInterval(function() {
genbutton_state = genbutton_.getAttribute('data-state') === 'clicked';
// If interrupt is not visible and generate has not been clicked
// then you click the button
if (!interruptbutton.offsetParent && !genbutton_state) {
genbutton_.setAttribute('data-state', 'clicked');
genbutton.click();
// If interrupt is visible and generate has been clicked
// That means generation has started, so we can set it back to not-clicked
// to allow it to trigger again once it finishes
} else if (interruptbutton.offsetParent && genbutton_state) {
genbutton_.setAttribute('data-state', 'not-clicked')
}
},
500);
};
Function: cancelGenerateForever
let cancelGenerateForever = function() {
clearInterval(window.generateOnRepeatInterval);
txt2img_gen_button = document.getElementById('txt2img_generate');
txt2img_gen_button.setAttribute('data-state', 'not-clicked')
img2img_gen_button = document.getElementById('img2img_generate');
img2img_gen_button.setAttribute('data-state', 'not-clicked')
};
If you switch to another UI tab and come back before the generation finishes, it might cause the generation button to be triggered again and will cause a similar issue, but so far I've been able to just cancel the generate forever and it does reflect prompt edits with some delay*, turning this into pretty much a visual glitch.
Waiting for the generation to finish and then coming back to the same tab won't cause this problem, but it will stop the current "generate forever", and you will need to hit "cancel generate forever" once and start it again.
At least it is still better than how it was before imo.
*By delay I mean it might take a couple generations for your prompt changes to show. This is probably caused by multiple generations being queued instead of one at a time, which was the original issue too, but now in a smaller scale.
I hope it helps a bit at least. I didn't make this into a fork/pull request since it still has issues, but feel free to use it.
I'll also mention that this is compounding with the issue where default settings aren't being saved (#1129, #1323), because having to reload the UI to stop infinite generation also means losing your modified settings.
I am reporting that this bug is still present in the latest version of the UI. None has changed. This is not "invalid" if a numerous people are reporting the same issue, you know...
I also have tried to reinstall everything just now, and started "Generate Forever" on a completely clean installation, not even changing any settings. I haven't been using Hires, the promt consisted of 3 tags. The bug appeared immediately when I switched tabs.
@Ryoidenshii this was initially marked as invalid due to a lack of steps to reproduce the issue, not because it was fixed, hence why no other related issues were marked as invalid.
Nothing has changed in the official version, what exists atm is the partial fix I provided above. You need to apply the fix manually, but it is literally copy pasting so should be pretty easy.
If the partial fix I provided above is not enough you can roll back to a previous version. I'm pretty sure this wasn't present before the gradio 4.4 update, so look for that commit.
Btw, I wouldn't expect an official fix anytime soon, there are probably more important things to develop right now.
I wish this would be fixed. Every time it happens, and sooner or later it does, to change the prompt you need to restart forge. For me the most common way it happens is when you change to another tab in the same browser window while generating, not sure how long it takes to break, maybe 1 full generation. Even if I keep it in a single window on another monitor this happens sooner or later though, and it seems once its close to bugging out the preview window is severely delayed.
The effects that I see:
- Generations doesnt respond to prompt changes
- If you cancel generate forever, the gui will show the generate button, but the CLI window will keep generating forever, once a new image is completely generated it will show up in the preview window, and stay there until the next image is completely generated, then the preview window will show that image, and so on.
- This goes on until forge is completely closed. Its very annoying since it wastes time to constantly have to restart.
This is literally the only problem I have with forge right now, hope it will be fixed. In all other aspects, I love forge.
I still have this issue as well. Wish I didn't update. I just wasted a whole day of no renders because I didn't leave the window/tab active. Before flux and all these ui changes non of these issues existed, forge seemed pretty stable.
Sorry to revive this thread but I have this issues.
If I am generating and I leave the tab or cover it with another separate window (lets say watching Netflix) the generation stops after that image. I have tried several "fixes" from the internet. Including window occlusion flags in chrome and extensions to keep the window active. Nothing works. Simply moving the other active window from covering the forge ui window solves the problem until its recovered by a window then generation stops after that image is done.
@max225719 it has been nearly a year since this issue was opened and it was never fixed. It probably will never be unless we get an overall update around UI or another Gradio update magically fixes this.
I don't mean to be rude, but asking for help isn't really gonna do much at this point.
For anyone coming across this, I'd suggest checking out reForge instead (unless you want to use it for Flux models). It is still receiving updates, but it never went through the UI update (which was made to support Flux after all), so this bug and some other things are not an issue, although it will be missing a couple UI features. Most plugins work fine as well.