multimodalart HF staff commited on
Commit
e7aa175
1 Parent(s): 0d83943

Update with the new API change

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -1,23 +1,23 @@
1
  import torch
2
  from diffusers import DDIMPipeline, DDPMPipeline, PNDMPipeline
3
  from diffusers import DDIMScheduler, DDPMScheduler, PNDMScheduler
4
- from diffusers import UNetUnconditionalModel
5
  import gradio as gr
6
  import PIL.Image
7
  import numpy as np
8
  import random
9
 
10
  model_id = "google/ddpm-celebahq-256"
11
- model = UNetUnconditionalModel.from_pretrained(model_id, subfolder="unet")
12
 
13
  # load model and scheduler
14
- ddpm_scheduler = DDPMScheduler.from_config(model_id, subfolder="scheduler")
15
  ddpm_pipeline = DDPMPipeline(unet=model, scheduler=ddpm_scheduler)
16
 
17
- ddim_scheduler = DDIMScheduler.from_config(model_id, subfolder="scheduler")
18
  ddim_pipeline = DDIMPipeline(unet=model, scheduler=ddim_scheduler)
19
 
20
- pndm_scheduler = PNDMScheduler.from_config(model_id, subfolder="scheduler")
21
  pndm_pipeline = PNDMPipeline(unet=model, scheduler=pndm_scheduler)
22
 
23
  # run pipeline in inference (sample random noise and denoise)
 
1
  import torch
2
  from diffusers import DDIMPipeline, DDPMPipeline, PNDMPipeline
3
  from diffusers import DDIMScheduler, DDPMScheduler, PNDMScheduler
4
+ from diffusers import UNet2DModel
5
  import gradio as gr
6
  import PIL.Image
7
  import numpy as np
8
  import random
9
 
10
  model_id = "google/ddpm-celebahq-256"
11
+ model = UNet2DModel.from_pretrained(model_id)
12
 
13
  # load model and scheduler
14
+ ddpm_scheduler = DDPMScheduler.from_config(model_id)
15
  ddpm_pipeline = DDPMPipeline(unet=model, scheduler=ddpm_scheduler)
16
 
17
+ ddim_scheduler = DDIMScheduler.from_config(model_id)
18
  ddim_pipeline = DDIMPipeline(unet=model, scheduler=ddim_scheduler)
19
 
20
+ pndm_scheduler = PNDMScheduler.from_config(model_id)
21
  pndm_pipeline = PNDMPipeline(unet=model, scheduler=pndm_scheduler)
22
 
23
  # run pipeline in inference (sample random noise and denoise)