ceyda commited on
Commit
30ccb17
1 Parent(s): 00179fc

add usage code

Browse files
Files changed (1) hide show
  1. README.md +13 -2
README.md CHANGED
@@ -15,14 +15,25 @@ should probably proofread and complete it, then remove this comment. -->
15
  ## Model description
16
 
17
  This diffusion model is trained with the [🤗 Diffusers](https://github.com/huggingface/diffusers) library
18
- on the `huggan/smithsonian_butterflies_subset` dataset.
19
 
20
  ## Intended uses & limitations
21
 
22
  #### How to use
23
 
24
  ```python
25
- # TODO: add an example code snippet for running this diffusion pipeline
 
 
 
 
 
 
 
 
 
 
 
26
  ```
27
 
28
  #### Limitations and bias
 
15
  ## Model description
16
 
17
  This diffusion model is trained with the [🤗 Diffusers](https://github.com/huggingface/diffusers) library
18
+ on the `huggan/smithsonian_butterflies_subset` dataset. Using this [script](https://github.com/huggingface/diffusers/blob/cde0ed162a127b17f1b4d4b16ff7f736cf04e690/examples/train_unconditional.py)
19
 
20
  ## Intended uses & limitations
21
 
22
  #### How to use
23
 
24
  ```python
25
+ from diffusers import DDPMPipeline
26
+
27
+ model_id = "ceyda/ddpm-ema-butterflies-64"
28
+
29
+ # load model and scheduler
30
+ ddpm = DDPMPipeline.from_pretrained(model_id) # you can replace DDPMPipeline with DDIMPipeline or PNDMPipeline for faster inference
31
+
32
+ # run pipeline in inference (sample random noise and denoise)
33
+ image = ddpm()["sample"]
34
+
35
+ # save image
36
+ image[0].save("ddpm_generated_image.png")
37
  ```
38
 
39
  #### Limitations and bias