Text-to-Image
ZeroModels
Keras
PyTorch
JAX
TensorFlow
English
stable-diffusion
stable-diffusion-diffusers
diffusion
latent-diffusion
Instructions to use zeromodels/stable-diffusion-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ZeroModels
How to use zeromodels/stable-diffusion-2 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-2") - Keras
How to use zeromodels/stable-diffusion-2 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-2") - Notebooks
- Google Colab
- Kaggle
File size: 2,266 Bytes
2546b6e 780a656 2546b6e 780a656 | 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 | {
"library_name": "zeromodels",
"zeromodels_version": "1.3.3",
"model_module": "zeromodels.diffusers",
"model_class": "ZMDiffusion",
"variant": "stable-diffusion-2",
"weights": "model.weights.h5",
"schema_version": 2,
"weight_dtype": "float32",
"model_type": "stable_diffusion_2",
"unet_config": {
"sample_size": 96,
"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": 768,
"scaling_factor": 0.18215,
"force_upcast": false,
"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": "DDIMScheduler",
"beta_end": 0.012,
"beta_schedule": "scaled_linear",
"beta_start": 0.00085,
"clip_sample": false,
"num_train_timesteps": 1000,
"prediction_type": "v_prediction",
"set_alpha_to_one": false,
"skip_prk_steps": true,
"steps_offset": 1,
"trained_betas": null
},
"generate_args": {
"num_inference_steps": 50,
"guidance_scale": 7.5
}
}
|