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

lokr: resume by default training state if not found #1060

Merged
merged 2 commits into from
Oct 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions helpers/training/save_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,9 @@ def _load_lycoris(self, models, input_dir):
raise ValueError("No model found to load LyCORIS weights into.")

logger.info("LyCORIS weights have been loaded from disk")
# disable LyCORIS spam logging
lycoris_logger = logging.getLogger("LyCORIS")
lycoris_logger.setLevel(logging.ERROR)

def _load_full_model(self, models, input_dir):
if self.args.use_ema:
Expand Down Expand Up @@ -492,6 +495,14 @@ def _load_full_model(self, models, input_dir):
def load_model_hook(self, models, input_dir):
# Check the checkpoint dir for a "training_state.json" file to load
training_state_path = os.path.join(input_dir, self.training_state_path)
if (
not os.path.exists(training_state_path)
and self.training_state_path != "training_state.json"
):
logger.warning(
f"Could not find {training_state_path} in checkpoint dir {input_dir}. Trying the default path."
)
training_state_path = os.path.join(input_dir, "training_state.json")
if os.path.exists(training_state_path):
StateTracker.load_training_state(training_state_path)
else:
Expand Down
Loading