Spaces:
Runtime error
Runtime error
Zhenyu Li
commited on
Commit
·
254d800
1
Parent(s):
a732259
update
Browse files
app.py
CHANGED
@@ -96,7 +96,9 @@ overwrite_kwargs['model_cfg_path'] = args.model_cfg_path
|
|
96 |
overwrite_kwargs["model"] = args.model
|
97 |
config_depth = get_config_user(args.model, **overwrite_kwargs)
|
98 |
config_depth["pretrained_resource"] = ''
|
99 |
-
|
|
|
|
|
100 |
|
101 |
controlnet_ckp = hf_hub_download(repo_id="zhyever/PatchFusion", filename="control_sd15_depth.pth")
|
102 |
model = create_model('./ControlNet/models/cldm_v15.yaml')
|
@@ -132,14 +134,10 @@ def process(input_image, prompt, a_prompt, n_prompt, num_samples, image_resoluti
|
|
132 |
with torch.no_grad():
|
133 |
w, h = input_image.size
|
134 |
|
135 |
-
depth_model = build_model(config_depth)
|
136 |
-
depth_model = load_ckpt(depth_model, args.ckp_path)
|
137 |
-
depth_model.eval()
|
138 |
depth_model.to(DEVICE)
|
139 |
-
|
140 |
detected_map = predict_depth(depth_model, input_image, mode, patch_number, resolution, patch_size, device=DEVICE)
|
141 |
|
142 |
-
|
143 |
gc.collect()
|
144 |
torch.cuda.empty_cache()
|
145 |
|
|
|
96 |
overwrite_kwargs["model"] = args.model
|
97 |
config_depth = get_config_user(args.model, **overwrite_kwargs)
|
98 |
config_depth["pretrained_resource"] = ''
|
99 |
+
depth_model = build_model(config_depth)
|
100 |
+
depth_model = load_ckpt(depth_model, args.ckp_path)
|
101 |
+
depth_model.eval()
|
102 |
|
103 |
controlnet_ckp = hf_hub_download(repo_id="zhyever/PatchFusion", filename="control_sd15_depth.pth")
|
104 |
model = create_model('./ControlNet/models/cldm_v15.yaml')
|
|
|
134 |
with torch.no_grad():
|
135 |
w, h = input_image.size
|
136 |
|
|
|
|
|
|
|
137 |
depth_model.to(DEVICE)
|
|
|
138 |
detected_map = predict_depth(depth_model, input_image, mode, patch_number, resolution, patch_size, device=DEVICE)
|
139 |
|
140 |
+
depth_model.cpu() # free some mem
|
141 |
gc.collect()
|
142 |
torch.cuda.empty_cache()
|
143 |
|