Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow sampling and saving on demand using signals #1850

Open
wants to merge 2 commits into
base: sd3
Choose a base branch
from

Conversation

fabbarix
Copy link

This patch registers a signal handler that will sample the model or save it on demand when a signal is received.

  • SIGUSR1: this signal will sample the model with the given prompts on the next step
  • SIGUSR2: this signal will save model - and state, if configured - on the next step

@fabbarix fabbarix changed the base branch from main to sd3 December 21, 2024 15:33
@rockerBOO
Copy link
Contributor

The library/signal_handler.py is missing

@fabbarix
Copy link
Author

Fixed. Don't know how I missed that one! Thanks for pointing it out.

@rockerBOO
Copy link
Contributor

How would a user trigger the signals? Would it be programmatically made?

@fabio-at-kumandgo
Copy link

The PID of the process is printed if training from the command line; you can then ‘kill -SIGUSR1 ’ to send the signal. GUIs can instead map UI buttons to signal sending.

Currently this works on Mac and Linux, looking on how to implement similar functionality in Windows.

@rockerBOO
Copy link
Contributor

Maybe it would be possible to listen for some key command to trigger the similar behavior as well? Like ctrl+c has a similar behavior. Not sure of Kohya's impression of this to PR but that would be something I would like to be able to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants