Text-to-Image
ZeroModels
Keras
PyTorch
JAX
TensorFlow
English
stable-diffusion
stable-diffusion-diffusers
diffusion
latent-diffusion
Instructions to use zeromodels/sd-turbo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ZeroModels
How to use zeromodels/sd-turbo 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/sd-turbo") - Keras
How to use zeromodels/sd-turbo with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://zeromodels/sd-turbo") - Notebooks
- Google Colab
- Kaggle
| { | |
| "library_name": "zeromodels", | |
| "zeromodels_version": "1.3.3", | |
| "model_module": "zeromodels.models.stable_diffusion_2", | |
| "model_class": "StableDiffusion2Model", | |
| "variant": "sd-turbo", | |
| "weights": "model.weights.h5", | |
| "schema_version": 2, | |
| "weight_dtype": "float32", | |
| "model_type": "stable_diffusion_2", | |
| "unet_config": { | |
| "sample_size": 64, | |
| "in_channels": 4, | |
| "out_channels": 4, | |
| "down_block_types": [ | |
| "CrossAttnDownBlock2D", | |
| "CrossAttnDownBlock2D", | |
| "CrossAttnDownBlock2D", | |
| "DownBlock2D" | |
| ], | |
| "up_block_types": [ | |
| "UpBlock2D", | |
| "CrossAttnUpBlock2D", | |
| "CrossAttnUpBlock2D", | |
| "CrossAttnUpBlock2D" | |
| ], | |
| "block_out_channels": [ | |
| 320, | |
| 640, | |
| 1280, | |
| 1280 | |
| ], | |
| "layers_per_block": 2, | |
| "cross_attention_dim": 1024, | |
| "num_attention_heads": [ | |
| 5, | |
| 10, | |
| 20, | |
| 20 | |
| ], | |
| "norm_num_groups": 32, | |
| "use_linear_projection": true, | |
| "transformer_layers_per_block": 1, | |
| "addition_embed_type": null, | |
| "addition_time_embed_dim": 256, | |
| "projection_class_embeddings_input_dim": null, | |
| "num_time_ids": 6, | |
| "text_seq_len": 77 | |
| }, | |
| "vae_config": { | |
| "in_channels": 3, | |
| "out_channels": 3, | |
| "latent_channels": 4, | |
| "block_out_channels": [ | |
| 128, | |
| 256, | |
| 512, | |
| 512 | |
| ], | |
| "layers_per_block": 2, | |
| "norm_num_groups": 32, | |
| "sample_size": 512, | |
| "scaling_factor": 0.18215, | |
| "force_upcast": true, | |
| "shift_factor": 0.0, | |
| "use_quant_conv": true, | |
| "use_post_quant_conv": true | |
| }, | |
| "text_config": { | |
| "hidden_dim": 1024, | |
| "num_heads": 16, | |
| "num_layers": 23, | |
| "mlp_ratio": 4.0, | |
| "vocab_size": 49408, | |
| "max_seq_len": 77 | |
| }, | |
| "hidden_act": "gelu", | |
| "layer_norm_eps": 1e-05, | |
| "bos_token_id": 49406, | |
| "eos_token_id": 49407, | |
| "pad_token_id": 0, | |
| "scheduler_config": { | |
| "_class_name": "EulerDiscreteScheduler", | |
| "beta_end": 0.012, | |
| "beta_schedule": "scaled_linear", | |
| "beta_start": 0.00085, | |
| "clip_sample": false, | |
| "interpolation_type": "linear", | |
| "num_train_timesteps": 1000, | |
| "prediction_type": "epsilon", | |
| "sample_max_value": 1.0, | |
| "set_alpha_to_one": false, | |
| "sigma_max": null, | |
| "sigma_min": null, | |
| "skip_prk_steps": true, | |
| "steps_offset": 1, | |
| "timestep_spacing": "trailing", | |
| "timestep_type": "discrete", | |
| "trained_betas": null, | |
| "use_karras_sigmas": false | |
| }, | |
| "generate_args": { | |
| "num_inference_steps": 1, | |
| "guidance_scale": 0.0 | |
| } | |
| } |