Text-to-Image
ZeroModels
Keras
PyTorch
JAX
TensorFlow
English
stable-diffusion
stable-diffusion-3
sd3
mmdit
diffusion
rectified-flow
Instructions to use zeromodels/stable-diffusion-3-medium with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ZeroModels
How to use zeromodels/stable-diffusion-3-medium with ZeroModels:
# pip install -U zeromodels # ZeroModels is pure Keras 3, so pick a backend: "jax", "torch" or "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" from zeromodels import AutoZModel # AutoZModel reads the repo's model_type and loads the matching class. # For a task head use the matching loader, e.g. AutoZMImageClassify / AutoZMDetect / # AutoZMSemanticSegment / AutoZMTextGenerate (see zeromodels.auto). model = AutoZModel.from_weights("zeromodels/stable-diffusion-3-medium") - Keras
How to use zeromodels/stable-diffusion-3-medium with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://zeromodels/stable-diffusion-3-medium") - Notebooks
- Google Colab
- Kaggle
File size: 2,101 Bytes
a564344 d770b9d a564344 d770b9d | 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 | {
"library_name": "zeromodels",
"zeromodels_version": "1.3.3",
"model_module": "zeromodels.diffusers",
"model_class": "ZMDiffusion",
"variant": "stable-diffusion-3-medium",
"weights": "model.weights.json",
"schema_version": 2,
"weight_dtype": "float16",
"weight_dtype_overrides": {
"vae_encoder": "float32",
"vae_decoder": "float32"
},
"model_type": "stable_diffusion_3",
"transformer_config": {
"sample_size": 128,
"patch_size": 2,
"in_channels": 16,
"out_channels": 16,
"num_layers": 24,
"attention_head_dim": 64,
"num_attention_heads": 24,
"joint_attention_dim": 4096,
"caption_projection_dim": 1536,
"pooled_projection_dim": 2048,
"pos_embed_max_size": 192,
"qk_norm": null,
"dual_attention_layers": [],
"text_seq_len": 333
},
"vae_config": {
"in_channels": 3,
"out_channels": 3,
"latent_channels": 16,
"block_out_channels": [
128,
256,
512,
512
],
"layers_per_block": 2,
"norm_num_groups": 32,
"sample_size": 1024,
"scaling_factor": 1.5305,
"force_upcast": true,
"shift_factor": 0.0609,
"use_quant_conv": false,
"use_post_quant_conv": false
},
"text_config": {
"hidden_dim": 768,
"num_heads": 12,
"num_layers": 12,
"mlp_ratio": 4.0,
"vocab_size": 49408,
"max_seq_len": 77,
"projection_dim": 768,
"hidden_act": "quick_gelu"
},
"text_config_2": {
"hidden_dim": 1280,
"num_heads": 20,
"num_layers": 32,
"mlp_ratio": 4.0,
"vocab_size": 49408,
"max_seq_len": 77,
"projection_dim": 1280,
"hidden_act": "gelu"
},
"hidden_act": "quick_gelu",
"layer_norm_eps": 1e-05,
"bos_token_id": 49406,
"eos_token_id": 49407,
"pad_token_id": 49407,
"pad_token_id_2": 0,
"max_sequence_length": 256,
"eos_token_id_3": 1,
"pad_token_id_3": 0,
"scheduler_config": {
"_class_name": "FlowMatchEulerDiscreteScheduler",
"num_train_timesteps": 1000,
"shift": 3.0
},
"generate_args": {
"num_inference_steps": 28,
"guidance_scale": 7.0
}
}
|