kohya-ss/sd-scripts

Is there a way to set the maximum number of save-state saves created?

Opened this issue · 4 comments

Lets say I have the settings set to save a copy of the flux model per every 50 epochs, and also to create a save-state each time that happens. Is there anyway to be able to set the number of save-state folders so that there is a max limit I can have? I want to have max 1, so that each time a save-state folder is made the older folder is automatically deleted.

Screenshot 2024-10-16 234118

Screenshot 2024-10-16 234031

You can automatically remove older states with --save_last_n_epochs_state. This option save last N checkpoints of state. I think there is a checkbox for it in the GUI.

@kohya-ss @bmaltais So one of these options? Do you know which it might be? I actually tried the last option, thinking it would work for the amount of save-states but it didn't do anything. I still get a saved-state folder with each saved model, which is set for 25 epochs. This is what I wanted, but I thought I correctly selected the option to have the max saved-states to 1. That way I don't end up with a saved-state folder for each epoch, but a single up-to-date saved-state folder.

Screenshot 2024-10-17 100820

Could one of these options be overriding the above option for max save-state folders?

Screenshot 2024-10-17 101254

Screenshot 2024-10-17 101840

Basically, what I would like to do is save an actual model every 25 epochs, along with its saved state, with subsequent save states overwriting the previous.

Hmm... --save_last_n_epochs_state doesn't seem to be there in those images, so it may be somewhere else. Setting --save_last_n_epochs_state to 1 should get you what you want.

@kohya-ss @bmaltais Thanks for the confirmation. I don't think this setting was included in the gui.