Instructions to use keras/stable_diffusion_3.5_large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasHub
How to use keras/stable_diffusion_3.5_large 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_large", 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_large")import keras_hub # Create a Inpaint model task = keras_hub.models.Inpaint.from_preset("hf://keras/stable_diffusion_3.5_large")import keras_hub # Create a Backbone model unspecialized for any task backbone = keras_hub.models.Backbone.from_preset("hf://keras/stable_diffusion_3.5_large") - Keras
How to use keras/stable_diffusion_3.5_large 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_large") - Notebooks
- Google Colab
- Kaggle
File size: 4,296 Bytes
0275605 d3a2de1 0275605 d3a2de1 0275605 d3a2de1 0275605 d3a2de1 0275605 d3a2de1 0275605 cb52f1a 0275605 d3a2de1 0275605 cb52f1a 0275605 | 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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | {
"module": "keras_hub.src.models.stable_diffusion_3.stable_diffusion_3_backbone",
"class_name": "StableDiffusion3Backbone",
"config": {
"name": "stable_diffusion_3.5_large_backbone",
"trainable": true,
"dtype": {
"module": "keras",
"class_name": "DTypePolicy",
"config": {
"name": "bfloat16"
},
"registered_name": null
},
"mmdit_patch_size": 2,
"mmdit_hidden_dim": 2432,
"mmdit_num_layers": 38,
"mmdit_num_heads": 38,
"mmdit_position_size": 192,
"mmdit_qk_norm": "rms_norm",
"mmdit_dual_attention_indices": null,
"vae": {
"module": "keras_hub.src.models.vae.vae_backbone",
"class_name": "VAEBackbone",
"config": {
"name": "vae",
"trainable": true,
"dtype": {
"module": "keras",
"class_name": "DTypePolicy",
"config": {
"name": "bfloat16"
},
"registered_name": null
},
"encoder_num_filters": [
128,
256,
512,
512
],
"encoder_num_blocks": [
2,
2,
2,
2
],
"decoder_num_filters": [
512,
512,
256,
128
],
"decoder_num_blocks": [
3,
3,
3,
3
],
"sampler_method": "sample",
"input_channels": 3,
"sample_channels": 32,
"output_channels": 3,
"scale": 1.5305,
"shift": 0.0609
},
"registered_name": "VAEBackbone"
},
"clip_l": {
"module": "keras_hub.src.models.clip.clip_text_encoder",
"class_name": "CLIPTextEncoder",
"config": {
"name": "clip_l",
"trainable": true,
"dtype": {
"module": "keras",
"class_name": "DTypePolicy",
"config": {
"name": "float16"
},
"registered_name": null
},
"vocabulary_size": 49408,
"embedding_dim": 768,
"hidden_dim": 768,
"num_layers": 12,
"num_heads": 12,
"intermediate_dim": 3072,
"intermediate_activation": "quick_gelu",
"intermediate_output_index": 10,
"max_sequence_length": 77
},
"registered_name": "keras_hub>CLIPTextEncoder"
},
"clip_g": {
"module": "keras_hub.src.models.clip.clip_text_encoder",
"class_name": "CLIPTextEncoder",
"config": {
"name": "clip_g",
"trainable": true,
"dtype": {
"module": "keras",
"class_name": "DTypePolicy",
"config": {
"name": "float16"
},
"registered_name": null
},
"vocabulary_size": 49408,
"embedding_dim": 1280,
"hidden_dim": 1280,
"num_layers": 32,
"num_heads": 20,
"intermediate_dim": 5120,
"intermediate_activation": "gelu",
"intermediate_output_index": 30,
"max_sequence_length": 77
},
"registered_name": "keras_hub>CLIPTextEncoder"
},
"t5": null,
"latent_channels": 16,
"output_channels": 3,
"num_train_timesteps": 1000,
"shift": 3.0,
"image_shape": [
1024,
1024,
3
]
},
"registered_name": "keras_hub>StableDiffusion3Backbone"
} |