Solve unexpected keyword argument 'predict_epsilon' #37

#38
by Jasson9 - opened
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,4 +1,5 @@
1
  from diffusers import AutoencoderKL, UNet2DConditionModel, StableDiffusionPipeline, StableDiffusionImg2ImgPipeline, DPMSolverMultistepScheduler
 
2
  import gradio as gr
3
  import torch
4
  from PIL import Image
@@ -6,6 +7,7 @@ import utils
6
  import datetime
7
  import time
8
  import psutil
 
9
 
10
  start_time = time.time()
11
  is_colab = utils.is_google_colab()
@@ -35,7 +37,6 @@ scheduler = DPMSolverMultistepScheduler(
35
  beta_schedule="scaled_linear",
36
  num_train_timesteps=1000,
37
  trained_betas=None,
38
- predict_epsilon=True,
39
  thresholding=False,
40
  algorithm_type="dpmsolver++",
41
  solver_type="midpoint",
@@ -52,7 +53,7 @@ current_model = models[1] if is_colab else models[0]
52
  current_model_path = current_model.path
53
 
54
  if is_colab:
55
- pipe = StableDiffusionPipeline.from_pretrained(current_model.path, torch_dtype=torch.float16, scheduler=scheduler, safety_checker=lambda images, clip_input: (images, False))
56
 
57
  else: # download all models
58
  print(f"{datetime.datetime.now()} Downloading vae...")
 
1
  from diffusers import AutoencoderKL, UNet2DConditionModel, StableDiffusionPipeline, StableDiffusionImg2ImgPipeline, DPMSolverMultistepScheduler
2
+ from diffusers.pipelines.stable_diffusion import StableDiffusionSafetyChecker
3
  import gradio as gr
4
  import torch
5
  from PIL import Image
 
7
  import datetime
8
  import time
9
  import psutil
10
+ from transformers import CLIPFeatureExtractor
11
 
12
  start_time = time.time()
13
  is_colab = utils.is_google_colab()
 
37
  beta_schedule="scaled_linear",
38
  num_train_timesteps=1000,
39
  trained_betas=None,
 
40
  thresholding=False,
41
  algorithm_type="dpmsolver++",
42
  solver_type="midpoint",
 
53
  current_model_path = current_model.path
54
 
55
  if is_colab:
56
+ pipe = StableDiffusionPipeline.from_pretrained(current_model.path, torch_dtype=torch.float16, scheduler=scheduler, safety_checker=StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker", torch_dtype=torch.float16),feature_extractor=CLIPFeatureExtractor.from_pretrained("openai/clip-vit-base-patch32"))
57
 
58
  else: # download all models
59
  print(f"{datetime.datetime.now()} Downloading vae...")