shiviguptta commited on
Commit
da0cacb
1 Parent(s): 9e2b369

End of training

Browse files
.gitattributes CHANGED
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ images_0.png filter=lfs diff=lfs merge=lfs -text
37
+ images_1.png filter=lfs diff=lfs merge=lfs -text
38
+ images_2.png filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+ license: creativeml-openrail-m
4
+ base_model: runwayml/stable-diffusion-v1-5
5
+ tags:
6
+ - stable-diffusion
7
+ - stable-diffusion-diffusers
8
+ - image-to-image
9
+ - diffusers
10
+ - controlnet
11
+ - controllora
12
+ ---
13
+
14
+ # ControlLoRA - Cocos Version
15
+
16
+ ControlLoRA is a neural network structure extended from Controlnet to control diffusion models by adding extra conditions. This checkpoint corresponds to the ControlLoRA conditioned on Cocos.
17
+
18
+ ControlLoRA uses the same structure as Controlnet. But its core weight comes from UNet, unmodified. Only hint image encoding layers, linear lora layers and conv2d lora layers used in weight offset are trained.
19
+
20
+ The main idea is from my [ControlLoRA](https://github.com/HighCWu/ControlLoRA) and sdxl [control-lora](https://huggingface.co/stabilityai/control-lora).
21
+
22
+ ## Example
23
+
24
+ 1. Clone ControlLoRA from [Github](https://github.com/HighCWu/control-lora-v2):
25
+ ```sh
26
+ $ git clone https://github.com/HighCWu/control-lora-v2
27
+ ```
28
+
29
+ 2. Enter the repo dir:
30
+ ```sh
31
+ $ cd control-lora-v2
32
+ ```
33
+
34
+ 3. Run code:
35
+ ```py
36
+ from PIL import Image
37
+ from diffusers import StableDiffusionControlNetPipeline, UNet2DConditionModel, UniPCMultistepScheduler
38
+ import torch
39
+ from PIL import Image
40
+ from models.controllora import ControlLoRAModel
41
+
42
+ image = Image.open('<Your Conditioning Image Path>')
43
+
44
+ base_model = "runwayml/stable-diffusion-v1-5"
45
+
46
+ unet = UNet2DConditionModel.from_pretrained(
47
+ base_model, subfolder="unet", torch_dtype=torch.float16
48
+ )
49
+ controllora: ControlLoRAModel = ControlLoRAModel.from_pretrained(
50
+ "shiviguptta/controllora_coco", torch_dtype=torch.float16
51
+ )
52
+ controllora.tie_weights(unet)
53
+
54
+ pipe = StableDiffusionControlNetPipeline.from_pretrained(
55
+ base_model, unet=unet, controlnet=controllora, safety_checker=None, torch_dtype=torch.float16
56
+ )
57
+
58
+ pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
59
+
60
+ # Remove if you do not have xformers installed
61
+ # see https://huggingface.co/docs/diffusers/v0.13.0/en/optimization/xformers#installing-xformers
62
+ # for installation instructions
63
+ pipe.enable_xformers_memory_efficient_attention()
64
+
65
+ pipe.enable_model_cpu_offload()
66
+
67
+ image = pipe("Girl smiling, professional dslr photograph, high quality", image, num_inference_steps=20).images[0]
68
+
69
+ image.show()
70
+ ```
71
+
72
+ You can find some example images below.
73
+
74
+ prompt: High-quality close-up dslr photo of man wearing a hat with trees in the background
75
+ ![images_0)](./images_0.png)
76
+ prompt: Girl smiling, professional dslr photograph, dark background, studio lights, high quality
77
+ ![images_1)](./images_1.png)
78
+ prompt: Portrait of a clown face, oil on canvas, bittersweet expression
79
+ ![images_2)](./images_2.png)
80
+
config.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "ControlLoRAModel",
3
+ "_diffusers_version": "0.21.1",
4
+ "act_fn": "silu",
5
+ "addition_embed_type": null,
6
+ "addition_embed_type_num_heads": 64,
7
+ "addition_time_embed_dim": null,
8
+ "attention_head_dim": 8,
9
+ "block_out_channels": [
10
+ 320,
11
+ 640,
12
+ 1280,
13
+ 1280
14
+ ],
15
+ "class_embed_type": null,
16
+ "conditioning_channels": 3,
17
+ "conditioning_embedding_out_channels": [
18
+ 16,
19
+ 32,
20
+ 96,
21
+ 256
22
+ ],
23
+ "controlnet_conditioning_channel_order": "rgb",
24
+ "cross_attention_dim": 768,
25
+ "down_block_types": [
26
+ "CrossAttnDownBlock2D",
27
+ "CrossAttnDownBlock2D",
28
+ "CrossAttnDownBlock2D",
29
+ "DownBlock2D"
30
+ ],
31
+ "downsample_padding": 1,
32
+ "encoder_hid_dim": null,
33
+ "encoder_hid_dim_type": null,
34
+ "flip_sin_to_cos": true,
35
+ "freq_shift": 0,
36
+ "global_pool_conditions": false,
37
+ "in_channels": 4,
38
+ "layers_per_block": 2,
39
+ "lora_conv2d_rank": 32,
40
+ "lora_linear_rank": 32,
41
+ "mid_block_scale_factor": 1,
42
+ "norm_eps": 1e-05,
43
+ "norm_num_groups": 32,
44
+ "num_attention_heads": null,
45
+ "num_class_embeds": null,
46
+ "only_cross_attention": false,
47
+ "projection_class_embeddings_input_dim": null,
48
+ "resnet_time_scale_shift": "default",
49
+ "transformer_layers_per_block": 1,
50
+ "upcast_attention": false,
51
+ "use_linear_projection": false
52
+ }
diffusion_pytorch_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7528390cb28c26efc3e5b1d931bfce441d159b36722a38c7f51c631808bb9b37
3
+ size 105423984
image_control.png ADDED
images_0.png ADDED

Git LFS Details

  • SHA256: b10766ecccca01ac0d32e855e00227c6d40d2dd57ea04c2f496d7f7c622e9706
  • Pointer size: 132 Bytes
  • Size of remote file: 1.91 MB
images_1.png ADDED

Git LFS Details

  • SHA256: 46453832fbb04746de0b5d6b7a4e413622733bac048bb1c3020754d8fc5deec0
  • Pointer size: 132 Bytes
  • Size of remote file: 1.4 MB
images_2.png ADDED

Git LFS Details

  • SHA256: 0b2a087453634f8a80a702a82c6f291da4f63a61186a394f73530ec6904c9559
  • Pointer size: 132 Bytes
  • Size of remote file: 1.92 MB