juancopi81 commited on
Commit
e560ba7
1 Parent(s): 0bbc2c9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +52 -0
README.md CHANGED
@@ -28,6 +28,58 @@ Guidance: 15
28
 
29
  <img src="https://huggingface.co/juancopi81/dreambooth_riffusion_model_currulao_v1/resolve/main/A_currulao%20song_lo-fi_nostalgic_100_15.png">
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  ## Intended uses & limitations
33
 
 
28
 
29
  <img src="https://huggingface.co/juancopi81/dreambooth_riffusion_model_currulao_v1/resolve/main/A_currulao%20song_lo-fi_nostalgic_100_15.png">
30
 
31
+ ## How to use it
32
+
33
+ You need to load the Riffusion weights to use this model.
34
+ Example for Colab:
35
+
36
+ ```python
37
+ !git lfs install
38
+ !git clone https://huggingface.co/juancopi81/dreambooth_riffusion_model_currulao_v1
39
+
40
+ !pip install git+https://github.com/costiash/stable-diffusion-tensorflow --upgrade --quiet
41
+ !pip install tensorflow tensorflow_addons ftfy --upgrade --quiet
42
+ !pip install pytorch-lightning
43
+ !pip install pydub
44
+ !pip install huggingface-hub
45
+
46
+ !pip install -q -U keras_cv
47
+ !pip install -q -U tensorflow
48
+
49
+ import tensorflow as tf
50
+
51
+ from keras_cv.models.stable_diffusion.clip_tokenizer import SimpleTokenizer
52
+ from keras_cv.models.stable_diffusion.diffusion_model import DiffusionModel
53
+ from keras_cv.models.stable_diffusion.stable_diffusion import StableDiffusion as StableDiffusionKeras
54
+ from keras_cv.models.stable_diffusion.image_encoder import ImageEncoder
55
+ from keras_cv.models.stable_diffusion.noise_scheduler import NoiseScheduler
56
+ from keras_cv.models.stable_diffusion.text_encoder import TextEncoder
57
+ import keras
58
+
59
+ from stable_diffusion_tf.stable_diffusion import StableDiffusion as StableDiffusionPy
60
+
61
+ resolution=512
62
+ sd_dreambooth_model_1=StableDiffusionPy(resolution, resolution, download_weights=False, jit_compile=True)
63
+
64
+ diffusion_model_pytorch_weights = keras.utils.get_file(
65
+ origin="https://huggingface.co/riffusion/riffusion-model-v1/resolve/main/riffusion-model-v1.ckpt",
66
+ file_hash="99a6eb51c18e16a6121180f3daa69344e571618b195533f67ae94be4eb135a57",
67
+ )
68
+
69
+ sd_dreambooth_model_1.load_weights_from_pytorch_ckpt(diffusion_model_pytorch_weights)
70
+
71
+ sd_dreambooth_model_1.diffusion_model.load_weights("/content/dreambooth_riffusion_model_currulao_v1")
72
+
73
+ img = sd_dreambooth_model_1.generate(
74
+ "A $currulao song, EDM",
75
+ num_steps=100,
76
+ unconditional_guidance_scale=12,
77
+ temperature=1.2,
78
+ batch_size=1,
79
+ )
80
+ pil_img = Image.fromarray(img[0])
81
+ ```
82
+
83
 
84
  ## Intended uses & limitations
85