Instructions to use keras/stable_diffusion_3.5_medium with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasHub
How to use keras/stable_diffusion_3.5_medium with KerasHub:
import keras_hub # Load TextToImage model (optional: use half precision for inference) text_to_image = keras_hub.models.TextToImage.from_preset("hf://keras/stable_diffusion_3.5_medium", dtype="bfloat16") # Generate images with a TextToImage model. text_to_image.generate("Astronaut in a jungle")import keras_hub # Create a ImageToImage model task = keras_hub.models.ImageToImage.from_preset("hf://keras/stable_diffusion_3.5_medium")import keras_hub # Create a Inpaint model task = keras_hub.models.Inpaint.from_preset("hf://keras/stable_diffusion_3.5_medium")import keras_hub # Create a Backbone model unspecialized for any task backbone = keras_hub.models.Backbone.from_preset("hf://keras/stable_diffusion_3.5_medium") - Keras
How to use keras/stable_diffusion_3.5_medium with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://keras/stable_diffusion_3.5_medium") - Notebooks
- Google Colab
- Kaggle
File size: 4,184 Bytes
b35dc7a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | {
"module": "keras_hub.src.models.stable_diffusion_3.stable_diffusion_3_text_to_image_preprocessor",
"class_name": "StableDiffusion3TextToImagePreprocessor",
"config": {
"name": "stable_diffusion_3_text_to_image_preprocessor",
"trainable": true,
"dtype": {
"module": "keras",
"class_name": "DTypePolicy",
"config": {
"name": "bfloat16"
},
"registered_name": null
},
"config_file": "preprocessor.json",
"clip_l_preprocessor": {
"module": "keras_hub.src.models.clip.clip_preprocessor",
"class_name": "CLIPPreprocessor",
"config": {
"name": "clip_l_preprocessor",
"trainable": true,
"dtype": {
"module": "keras",
"class_name": "DTypePolicy",
"config": {
"name": "bfloat16"
},
"registered_name": null
},
"tokenizer": {
"module": "keras_hub.src.models.clip.clip_tokenizer",
"class_name": "CLIPTokenizer",
"config": {
"name": "clip_l_tokenizer",
"trainable": true,
"dtype": {
"module": "keras",
"class_name": "DTypePolicy",
"config": {
"name": "int32"
},
"registered_name": null
},
"config_file": "clip_l_tokenizer.json",
"sequence_length": null,
"add_prefix_space": false,
"pad_with_end_token": true
},
"registered_name": "keras_hub>CLIPTokenizer"
},
"config_file": "clip_l_preprocessor.json",
"sequence_length": 77,
"add_start_token": true,
"add_end_token": true,
"to_lower": true
},
"registered_name": "keras_hub>CLIPPreprocessor"
},
"clip_g_preprocessor": {
"module": "keras_hub.src.models.clip.clip_preprocessor",
"class_name": "CLIPPreprocessor",
"config": {
"name": "clip_g_preprocessor",
"trainable": true,
"dtype": {
"module": "keras",
"class_name": "DTypePolicy",
"config": {
"name": "bfloat16"
},
"registered_name": null
},
"tokenizer": {
"module": "keras_hub.src.models.clip.clip_tokenizer",
"class_name": "CLIPTokenizer",
"config": {
"name": "clip_g_tokenizer",
"trainable": true,
"dtype": {
"module": "keras",
"class_name": "DTypePolicy",
"config": {
"name": "int32"
},
"registered_name": null
},
"config_file": "clip_g_tokenizer.json",
"sequence_length": null,
"add_prefix_space": false,
"pad_with_end_token": false
},
"registered_name": "keras_hub>CLIPTokenizer"
},
"config_file": "clip_g_preprocessor.json",
"sequence_length": 77,
"add_start_token": true,
"add_end_token": true,
"to_lower": true
},
"registered_name": "keras_hub>CLIPPreprocessor"
},
"t5_preprocessor": null
},
"registered_name": "keras_hub>StableDiffusion3TextToImagePreprocessor"
} |