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

Save restore latent #89

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

Conversation

wolfgangmeyers
Copy link

A slight update to the latents functionality added by @LoudMurmur. This adds the arguments to the CLI, supports saving latents without also needing save_progress=True, and supports resetting the optimizer when resuming from a previous backup file. This allows you to develop an image, switch the text prompt, then continue from the starting point achieved by the first run. If the optimizer isn't reset, it will be just like resuming using the old text prompt.

GpuLover and others added 2 commits April 27, 2021 11:28
it works by dumping/restoring the whole EMA and ADAM optimiser objects

exemple of how to restore :

model = Imagine(
    text = TEXT,
    save_every = SAVE_EVERY,
    lr = LEARNING_RATE,
    iterations = ITERATIONS,
    save_progress = SAVE_PROGRESS,
    out_folder = out_folder,
    save_latents = True,
    saved_latents_filepath = r"F:\my\path\magic_man.35.backup",
)
@wolfgangmeyers
Copy link
Author

Supersedes #86

@wolfgangmeyers
Copy link
Author

Results of prompting with "A glowing blue jellyfish", and then reprompting with "An alien spaceship" after resetting the optimizer:

jellyfish

An_alien_spaceship_wout_blurry--distorted--pixelated

@Oros42
Copy link

Oros42 commented Aug 6, 2021

Wonderful ! It works fine :-D

@redthing1
Copy link

This looks really cool!

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.

4 participants