Skip to content

Commit

Permalink
Use image_shape for SD3 (#1979)
Browse files Browse the repository at this point in the history
  • Loading branch information
james77777778 authored Oct 26, 2024
1 parent b3dfa08 commit 17518e1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions guides/ipynb/keras_hub/stable_diffusion_3_in_keras_hub.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"\n",
"**Author:** [Hongyu Chiu](https://github.com/james77777778), [fchollet](https://twitter.com/fchollet), [lukewood](https://twitter.com/luke_wood_ml), [divamgupta](https://github.com/divamgupta)<br>\n",
"**Date created:** 2024/10/09<br>\n",
"**Last modified:** 2024/10/09<br>\n",
"**Last modified:** 2024/10/24<br>\n",
"**Description:** Image generation using KerasHub's Stable Diffusion 3 model."
]
},
Expand Down Expand Up @@ -96,7 +96,7 @@
"That will automatically load and configure trained `backbone` and `preprocessor`\n",
"for you.\n",
"\n",
"Note that in this guide, we'll use `height=512` and `width=512` for faster\n",
"Note that in this guide, we'll use `image_shape=(512, 512, 3)` for faster\n",
"image generation. For higher-quality output, it's recommended to use the default\n",
"size of `1024`. Since the entire backbone has about 3 billion parameters, which\n",
"can be challenging to fit into a consumer-level GPU, we set `dtype=\"float16\"` to\n",
Expand Down Expand Up @@ -148,7 +148,7 @@
"\n",
"\n",
"backbone = keras_hub.models.StableDiffusion3Backbone.from_preset(\n",
" \"stable_diffusion_3_medium\", height=512, width=512, dtype=\"float16\"\n",
" \"stable_diffusion_3_medium\", image_shape=(512, 512, 3), dtype=\"float16\"\n",
")\n",
"preprocessor = keras_hub.models.StableDiffusion3TextToImagePreprocessor.from_preset(\n",
" \"stable_diffusion_3_medium\"\n",
Expand Down
6 changes: 3 additions & 3 deletions guides/keras_hub/stable_diffusion_3_in_keras_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Title: Stable Diffusion 3 in KerasHub!
Author: [Hongyu Chiu](https://github.com/james77777778), [fchollet](https://twitter.com/fchollet), [lukewood](https://twitter.com/luke_wood_ml), [divamgupta](https://github.com/divamgupta)
Date created: 2024/10/09
Last modified: 2024/10/09
Last modified: 2024/10/24
Description: Image generation using KerasHub's Stable Diffusion 3 model.
Accelerator: GPU
"""
Expand Down Expand Up @@ -63,7 +63,7 @@
That will automatically load and configure trained `backbone` and `preprocessor`
for you.
Note that in this guide, we'll use `height=512` and `width=512` for faster
Note that in this guide, we'll use `image_shape=(512, 512, 3)` for faster
image generation. For higher-quality output, it's recommended to use the default
size of `1024`. Since the entire backbone has about 3 billion parameters, which
can be challenging to fit into a consumer-level GPU, we set `dtype="float16"` to
Expand Down Expand Up @@ -107,7 +107,7 @@ def display_generated_images(images):


backbone = keras_hub.models.StableDiffusion3Backbone.from_preset(
"stable_diffusion_3_medium", height=512, width=512, dtype="float16"
"stable_diffusion_3_medium", image_shape=(512, 512, 3), dtype="float16"
)
preprocessor = keras_hub.models.StableDiffusion3TextToImagePreprocessor.from_preset(
"stable_diffusion_3_medium"
Expand Down
6 changes: 3 additions & 3 deletions guides/md/keras_hub/stable_diffusion_3_in_keras_hub.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**Author:** [Hongyu Chiu](https://github.com/james77777778), [fchollet](https://twitter.com/fchollet), [lukewood](https://twitter.com/luke_wood_ml), [divamgupta](https://github.com/divamgupta)<br>
**Date created:** 2024/10/09<br>
**Last modified:** 2024/10/09<br>
**Last modified:** 2024/10/24<br>
**Description:** Image generation using KerasHub's Stable Diffusion 3 model.


Expand Down Expand Up @@ -71,7 +71,7 @@ text_to_image = keras_hub.models.StableDiffusion3TextToImage.from_preset(
That will automatically load and configure trained `backbone` and `preprocessor`
for you.

Note that in this guide, we'll use `height=512` and `width=512` for faster
Note that in this guide, we'll use `image_shape=(512, 512, 3)` for faster
image generation. For higher-quality output, it's recommended to use the default
size of `1024`. Since the entire backbone has about 3 billion parameters, which
can be challenging to fit into a consumer-level GPU, we set `dtype="float16"` to
Expand Down Expand Up @@ -116,7 +116,7 @@ def display_generated_images(images):


backbone = keras_hub.models.StableDiffusion3Backbone.from_preset(
"stable_diffusion_3_medium", height=512, width=512, dtype="float16"
"stable_diffusion_3_medium", image_shape=(512, 512, 3), dtype="float16"
)
preprocessor = keras_hub.models.StableDiffusion3TextToImagePreprocessor.from_preset(
"stable_diffusion_3_medium"
Expand Down

0 comments on commit 17518e1

Please sign in to comment.