Commit 876da125 authored by unknown's avatar unknown
Browse files

Merge branch 'master' of github.com:AUTOMATIC1111/stable-diffusion-webui

parents d6fdfde9 c6f347b8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ Check the [custom scripts](https://github.com/AUTOMATIC1111/stable-diffusion-web
- Estimated completion time in progress bar
- API
- Support for dedicated [inpainting model](https://github.com/runwayml/stable-diffusion#inpainting-with-stable-diffusion) by RunwayML.
- via extension: [Aesthetic Gradients](https://github.com/AUTOMATIC1111/stable-diffusion-webui-aesthetic-gradients), a way to generate images with a specific aesthetic by using clip images embds (implementation of [https://github.com/vicgalle/stable-diffusion-aesthetic-gradients](https://github.com/vicgalle/stable-diffusion-aesthetic-gradients))
- via extension: [Aesthetic Gradients](https://github.com/AUTOMATIC1111/stable-diffusion-webui-aesthetic-gradients), a way to generate images with a specific aesthetic by using clip images embeds (implementation of [https://github.com/vicgalle/stable-diffusion-aesthetic-gradients](https://github.com/vicgalle/stable-diffusion-aesthetic-gradients))
- [Stable Diffusion 2.0](https://github.com/Stability-AI/stablediffusion) support - see [wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features#stable-diffusion-20) for instructions

## Installation and Running
+9 −3
Original line number Diff line number Diff line
import os
import gc
import time
import warnings
@@ -8,6 +9,7 @@ import torchvision
from PIL import Image
from einops import rearrange, repeat
from omegaconf import OmegaConf
import safetensors.torch

from ldm.models.diffusion.ddim import DDIMSampler
from ldm.util import instantiate_from_config, ismap
@@ -24,12 +26,16 @@ class LDSR:
        global cached_ldsr_model

        if shared.opts.ldsr_cached and cached_ldsr_model is not None:
            print(f"Loading model from cache")
            print("Loading model from cache")
            model: torch.nn.Module = cached_ldsr_model
        else:
            print(f"Loading model from {self.modelPath}")
            _, extension = os.path.splitext(self.modelPath)
            if extension.lower() == ".safetensors":
                pl_sd = safetensors.torch.load_file(self.modelPath, device="cpu")
            else:
                pl_sd = torch.load(self.modelPath, map_location="cpu")
            sd = pl_sd["state_dict"]
            sd = pl_sd["state_dict"] if "state_dict" in pl_sd else pl_sd
            config = OmegaConf.load(self.yamlPath)
            config.model.target = "ldm.models.diffusion.ddpm.LatentDiffusionV1"
            model: torch.nn.Module = instantiate_from_config(config.model)
+6 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ class UpscalerLDSR(Upscaler):
        yaml_path = os.path.join(self.model_path, "project.yaml")
        old_model_path = os.path.join(self.model_path, "model.pth")
        new_model_path = os.path.join(self.model_path, "model.ckpt")
        safetensors_model_path = os.path.join(self.model_path, "model.safetensors")
        if os.path.exists(yaml_path):
            statinfo = os.stat(yaml_path)
            if statinfo.st_size >= 10485760:
@@ -33,6 +34,9 @@ class UpscalerLDSR(Upscaler):
        if os.path.exists(old_model_path):
            print("Renaming model from model.pth to model.ckpt")
            os.rename(old_model_path, new_model_path)
        if os.path.exists(safetensors_model_path):
            model = safetensors_model_path
        else:
            model = load_file_from_url(url=self.model_url, model_dir=self.model_path,
                                       file_name="model.ckpt", progress=True)
        yaml = load_file_from_url(url=self.yaml_url, model_dir=self.model_path,
+12 −12
Original line number Diff line number Diff line
@@ -61,15 +61,15 @@ contextMenuInit = function(){

  }

  function appendContextMenuOption(targetEmementSelector,entryName,entryFunction){
  function appendContextMenuOption(targetElementSelector,entryName,entryFunction){

    currentItems = menuSpecs.get(targetEmementSelector)
    currentItems = menuSpecs.get(targetElementSelector)

    if(!currentItems){
      currentItems = []
      menuSpecs.set(targetEmementSelector,currentItems);
      menuSpecs.set(targetElementSelector,currentItems);
    }
    let newItem = {'id':targetEmementSelector+'_'+uid(), 
    let newItem = {'id':targetElementSelector+'_'+uid(),
                   'name':entryName,
                   'func':entryFunction,
                   'isNew':true}
+6 −2
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ titles = {
	"GFPGAN": "Restore low quality faces using GFPGAN neural network",
	"Euler a": "Euler Ancestral - very creative, each can get a completely different picture depending on step count, setting steps to higher than 30-40 does not help",
	"DDIM": "Denoising Diffusion Implicit Models - best at inpainting",
	"DPM adaptive": "Ignores step count - uses a number of steps determined by the CFG and resolution", 

	"Batch count": "How many batches of images to create",
	"Batch size": "How many image to create in a single batch",
@@ -17,7 +18,7 @@ titles = {
    "\u2199\ufe0f": "Read generation parameters from prompt or last generation if prompt is empty into user interface.",
    "\u{1f4c2}": "Open images output directory",
    "\u{1f4be}": "Save style",
    "\U0001F5D1": "Clear prompt"
    "\U0001F5D1": "Clear prompt",
    "\u{1f4cb}": "Apply selected styles to current prompt",

    "Inpaint a part of image": "Draw a mask over an image, and the script will regenerate the masked area with content according to prompt",
@@ -96,7 +97,10 @@ titles = {

    "Learning rate": "how fast should the training go. Low values will take longer to train, high values may fail to converge (not generate accurate results) and/or may break the embedding (This has happened if you see Loss: nan in the training info textbox. If this happens, you need to manually restore your embedding from an older not-broken backup).\n\nYou can set a single numeric value, or multiple learning rates using the syntax:\n\n   rate_1:max_steps_1, rate_2:max_steps_2, ...\n\nEG:   0.005:100, 1e-3:1000, 1e-5\n\nWill train with rate of 0.005 for first 100 steps, then 1e-3 until 1000 steps, then 1e-5 for all remaining steps.",

    "Clip skip": "Early stopping parameter for CLIP model; 1 is stop at last layer as usual, 2 is stop at penultimate layer, etc."
    "Clip skip": "Early stopping parameter for CLIP model; 1 is stop at last layer as usual, 2 is stop at penultimate layer, etc.",

    "Approx NN": "Cheap neural network approximation. Very fast compared to VAE, but produces pictures with 4 times smaller horizontal/vertical resoluton and lower quality.",
    "Approx cheap": "Very cheap approximation. Very fast compared to VAE, but produces pictures with 8 times smaller horizontal/vertical resoluton and extremely low quality."
}


Loading