| This `ControlNetModel` was created using the code below: | |
| ```python | |
| from diffusers import ControlNetModel | |
| from huggingface_hub import HfApi, create_repo | |
| controlnet = ControlNetModel( | |
| block_out_channels=(32, 64), | |
| layers_per_block=2, | |
| in_channels=4, | |
| down_block_types=("DownBlock2D", "CrossAttnDownBlock2D"), | |
| conditioning_embedding_out_channels=(16, 32), | |
| # SD2-specific config below | |
| attention_head_dim=(2, 4), | |
| use_linear_projection=True, | |
| addition_embed_type="text_time", | |
| addition_time_embed_dim=8, | |
| transformer_layers_per_block=(1, 2), | |
| projection_class_embeddings_input_dim=80, # 6 * 8 + 32 | |
| cross_attention_dim=64, | |
| ) | |
| local_path = "tiny-controlnet-sdxl" | |
| controlnet.save_pretrained(local_path) | |
| repo_id = create_repo( | |
| repo_id=f"hf-internal-testing/{local_path}", | |
| exist_ok=True | |
| ).repo_id | |
| api = HfApi() | |
| api.upload_folder( | |
| repo_id=repo_id, | |
| folder_path=local_path | |
| ) | |
| ``` | |
| Can be initialized like so: | |
| ```python | |
| from diffusers import ControlNetModel | |
| controlnet = ControlNetModel.from_pretrained("hf-internal-testing/tiny-controlnet-sdxl") | |
| ``` |