invoke-ai / InvokeAI

InvokeAI is a leading creative engine for Stable Diffusion models, empowering professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry leading WebUI, supports terminal use through a CLI, and serves as the foundation for multiple commercial products.
https://invoke-ai.github.io/InvokeAI/
Apache License 2.0
22.86k stars 2.37k forks source link

How to install the new Stable Diffusion 1.5 weights file #1195

Closed lstein closed 1 year ago

lstein commented 1 year ago

From main branch

  1. Download the file v1-5-pruned-emaonly.ckpt from https://huggingface.co/runwayml/stable-diffusion-v1-5
  2. Put the file into the InvokeAI directory under models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt
  3. With a text editor such as Notepad, edit the file configs/models.yaml to look like this:
    
    # This file describes the alternative machine learning models
    #  available to the dream script.
    #
    # To add a new model, follow the examples below. Each
    # model requires a model config file, a weights file,
    # and the width and height of the images it
    # was trained on.

stable-diffusion-1.5: config: configs/stable-diffusion/v1-inference.yaml weights: models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt description: Stable Diffusion inference model version 1.5 width: 512 height: 512 stable-diffusion-1.4: config: configs/stable-diffusion/v1-inference.yaml weights: models/ldm/stable-diffusion-v1/model.ckpt description: Stable Diffusion inference model version 1.4 width: 512 height: 512

5. Start the GUI with the command `python scripts/invoke.py --web --model stable-diffusion-1.5` (web) or  `python scripts/invoke.py --model stable-diffusion-1.5` (command-line interface)
6. In the command-line interface, you can switch rapidly back and forth between models using the `!switch` command. The `!models` command tells you what models are available and their load status:

invoke> !models stable-diffusion-1.5 not loaded Stable Diffusion v1.5 stable-diffusion-1.4 cached Stable Diffusion v1.4 waifu-1.3 active Waifu v1.3,

invoke> !switch stable-diffusion-1.5 loading "stable-diffusion-1.5"

invoke> !models stable-diffusion-1.5 active Stable Diffusion v1.5 stable-diffusion-1.4 cached Stable Diffusion v1.4 waifu-1.3 cached Waifu v1.3,


# From `development` branch

On the `development` branch, it is even easier:
1. From within the command line script `invoke.py` run the `!import_model` command. The script will ask you for a name, description, and whether to make this the startup default. You can accept the defaults for the rest of the questions:

invoke> !import_model models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt

Model import in process. Please enter the values needed to configure this model:

Short name for this model: stable-diffusion-1.5 Description of this model: New release of Stable Diffusion v1.5 Configuration file for this model: configs/stable-diffusion/v1-inference.yaml Default image width: 512 Default image height: 512 Make this the default model? [n] y

New configuration: stable-diffusion-1.5: config: configs/stable-diffusion/v1-inference.yaml default: true description: New release of Stable Diffusion v1.5 height: 512 weights: models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt width: 512

OK to import [n]? y

Verifying that new model loads... Caching model stable-diffusion-1.4 in system RAM Loading stable-diffusion-1.5 from models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt | LatentDiffusion: Running in eps-prediction mode | DiffusionWrapper has 859.52 M params. | Making attention of type 'vanilla' with 512 in_channels | Working with z of shape (1, 4, 32, 32) = 4096 dimensions. | Making attention of type 'vanilla' with 512 in_channels | Using faster float16 precision Model loaded in 15.72s Max VRAM used to load the model: 2.17G Current VRAM usage:2.17G Setting Sampler to k_lms making this default

ffd8 commented 1 year ago

Just followed instructions, but never got the option to make default.. Running the very latest development with last PR from 5 hours ago, but after confirming the Default image height: 512, it went right into OK to import [n]?, did so, but didn't offer to make default. Is there somewhere else to activate it as the default rather than needing to add the flag --model stable-diffusion-1.5? Didn't see any listing of a default within the configs/models.yaml... Also checked the docs about the !model command, but don't see anything about defaults, perhaps it's from another dev branch that isn't yet part of the main development yet?

19wolf commented 1 year ago

I was wondering why it kept telling me I was importing 1.4... I just replaced model.ckpt with the new model, so it's just telling me the wrong thing but using the new model

lstein commented 1 year ago

You have to change the name of the stanza! Just changing the weights file will keep the original name but use the new model.

lstein commented 1 year ago

Just followed instructions, but never got the option to make default.. Running the very latest development with last PR from 5 hours ago, but after confirming the Default image height: 512, it went right into OK to import [n]?, did so, but didn't offer to make default. Is there somewhere else to activate it as the default rather than needing to add the flag --model stable-diffusion-1.5? Didn't see any listing of a default within the configs/models.yaml... Also checked the docs about the !model command, but don't see anything about defaults, perhaps it's from another dev branch that isn't yet part of the main development yet?

You probably need a more recent commit. The default option is definitely in development now.

brunsonator3 commented 1 year ago

Hey I just replaced the ckpt file and renamed the 1.5 ckpt file in its place as model.ckpt. It's still the same thing right? I'm still using 1.5 right? Even though it says 1.4?

psychedelicious commented 1 year ago

@brunsonator3 It should work just the same, but it's easy enough to edit the models.yaml file to reflect the correct model - suggest you do this.