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
Download zm_config.json from zeromodels/stable-diffusion-3-medium: direct link, hf CLI and curl.
- Browser
- Download file 2.1 kB
-
https://huggingface.co/zeromodels/stable-diffusion-3-medium/resolve/main/zm_config.json
- Command line
-
hf download hf://zeromodels/stable-diffusion-3-medium/zm_config.json
-
curl -L -o zm_config.json https://huggingface.co/zeromodels/stable-diffusion-3-medium/resolve/main/zm_config.json
2.1 kB
| { | |
| "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 | |
| } | |
| } | |