Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This `ControlNetModel` was created using the code below:
|
| 2 |
+
|
| 3 |
+
```python
|
| 4 |
+
from diffusers import ControlNetModel
|
| 5 |
+
from huggingface_hub import HfApi, create_repo
|
| 6 |
+
|
| 7 |
+
controlnet = ControlNetModel(
|
| 8 |
+
block_out_channels=(32, 64),
|
| 9 |
+
layers_per_block=2,
|
| 10 |
+
in_channels=4,
|
| 11 |
+
down_block_types=("DownBlock2D", "CrossAttnDownBlock2D"),
|
| 12 |
+
conditioning_embedding_out_channels=(16, 32),
|
| 13 |
+
# SD2-specific config below
|
| 14 |
+
attention_head_dim=(2, 4),
|
| 15 |
+
use_linear_projection=True,
|
| 16 |
+
addition_embed_type="text_time",
|
| 17 |
+
addition_time_embed_dim=8,
|
| 18 |
+
transformer_layers_per_block=(1, 2),
|
| 19 |
+
projection_class_embeddings_input_dim=80, # 6 * 8 + 32
|
| 20 |
+
cross_attention_dim=64,
|
| 21 |
+
)
|
| 22 |
+
local_path = "tiny-controlnet-sdxl"
|
| 23 |
+
controlnet.save_pretrained(local_path)
|
| 24 |
+
|
| 25 |
+
repo_id = create_repo(
|
| 26 |
+
repo_id=f"hf-internal-testing/{local_path}",
|
| 27 |
+
exist_ok=True
|
| 28 |
+
).repo_id
|
| 29 |
+
|
| 30 |
+
api = HfApi()
|
| 31 |
+
|
| 32 |
+
api.upload_folder(
|
| 33 |
+
repo_id=repo_id,
|
| 34 |
+
folder_path=local_path
|
| 35 |
+
)
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
Can be initialized like so:
|
| 39 |
+
|
| 40 |
+
```python
|
| 41 |
+
from diffusers import ControlNetModel
|
| 42 |
+
|
| 43 |
+
controlnet = ControlNetModel.from_pretrained("hf-internal-testing/tiny-controlnet-sdxl")
|
| 44 |
+
```
|