leonardo_iania commited on
Commit
231f8db
·
1 Parent(s): 02b21a5

first commit

Browse files
config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "ControlNetModel",
3
+ "_diffusers_version": "0.16.0.dev0",
4
+ "_name_or_path": "/home/patrick/controlnet_v1_1/control_v11p_sd15_openpose",
5
+ "act_fn": "silu",
6
+ "attention_head_dim": 8,
7
+ "block_out_channels": [
8
+ 320,
9
+ 640,
10
+ 1280,
11
+ 1280
12
+ ],
13
+ "class_embed_type": null,
14
+ "conditioning_embedding_out_channels": [
15
+ 16,
16
+ 32,
17
+ 96,
18
+ 256
19
+ ],
20
+ "controlnet_conditioning_channel_order": "rgb",
21
+ "cross_attention_dim": 768,
22
+ "down_block_types": [
23
+ "CrossAttnDownBlock2D",
24
+ "CrossAttnDownBlock2D",
25
+ "CrossAttnDownBlock2D",
26
+ "DownBlock2D"
27
+ ],
28
+ "downsample_padding": 1,
29
+ "flip_sin_to_cos": true,
30
+ "freq_shift": 0,
31
+ "in_channels": 4,
32
+ "layers_per_block": 2,
33
+ "mid_block_scale_factor": 1,
34
+ "norm_eps": 1e-05,
35
+ "norm_num_groups": 32,
36
+ "num_class_embeds": null,
37
+ "only_cross_attention": false,
38
+ "projection_class_embeddings_input_dim": null,
39
+ "resnet_time_scale_shift": "default",
40
+ "upcast_attention": false,
41
+ "use_linear_projection": false
42
+ }
control_net_open_pose.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ import torch
3
+ import os
4
+ from huggingface_hub import HfApi
5
+ from pathlib import Path
6
+ from diffusers.utils import load_image
7
+ from controlnet_aux import OpenposeDetector
8
+
9
+ from diffusers import (
10
+ ControlNetModel,
11
+ StableDiffusionControlNetPipeline,
12
+ UniPCMultistepScheduler,
13
+ )
14
+ import sys
15
+
16
+ checkpoint = sys.argv[1]
17
+
18
+ <<<<<<< HEAD
19
+ image = load_image("https://github.com/lllyasviel/ControlNet-v1-1-nightly/raw/main/test_imgs/demo.jpg").resize((512, 512))
20
+ prompt = "The pope with sunglasses rapping with a mic"
21
+
22
+
23
+ openpose = OpenposeDetector.from_pretrained('lllyasviel/ControlNet')
24
+ image = openpose(image, hand_and_face=True)
25
+ =======
26
+ image = load_image("https://huggingface.co/lllyasviel/sd-controlnet-openpose/resolve/main/images/pose.png")
27
+ prompt = "chef in the kitchen"
28
+
29
+
30
+ openpose = OpenposeDetector.from_pretrained('lllyasviel/ControlNet')
31
+ image = openpose(image)
32
+ >>>>>>> 6e2c3bc1a649ac194d79bb2f4ee11900d7f0e8f6
33
+
34
+ controlnet = ControlNetModel.from_pretrained(checkpoint, torch_dtype=torch.float16)
35
+ pipe = StableDiffusionControlNetPipeline.from_pretrained(
36
+ "runwayml/stable-diffusion-v1-5", controlnet=controlnet, torch_dtype=torch.float16
37
+ )
38
+
39
+ pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
40
+ pipe.enable_model_cpu_offload()
41
+
42
+ generator = torch.manual_seed(33)
43
+ <<<<<<< HEAD
44
+ out_image = pipe(prompt, num_inference_steps=35, generator=generator, image=image).images[0]
45
+ =======
46
+ out_image = pipe(prompt, num_inference_steps=20, generator=generator, image=image).images[0]
47
+ >>>>>>> 6e2c3bc1a649ac194d79bb2f4ee11900d7f0e8f6
48
+
49
+ path = os.path.join(Path.home(), "images", "aa.png")
50
+ out_image.save(path)
51
+
52
+ api = HfApi()
53
+
54
+ api.upload_file(
55
+ path_or_fileobj=path,
56
+ path_in_repo=path.split("/")[-1],
57
+ repo_id="patrickvonplaten/images",
58
+ repo_type="dataset",
59
+ )
60
+ print("https://huggingface.co/datasets/patrickvonplaten/images/blob/main/aa.png")
diffusion_pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:40c80b93aea10c31de2d282adbe8bbb945611a037ca36e0cd55d3ee7d59fedce
3
+ size 1445254969
diffusion_pytorch_model.fp16.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:65c13c04dc49231f7044373e3f0dbd2f44b01a445c8577ea919cd5ff5fac29a6
3
+ size 722698343
diffusion_pytorch_model.fp16.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b25b1125e870275550b2a7de289056cb3c236c01c293bd5ba883657b1c006e3e
3
+ size 722598642
diffusion_pytorch_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:46b10abb28f3750aba7eea208e188539f7945d9256de9a248cbb9902f2276988
3
+ size 1445157124