Spaces:
Running
on
Zero
Running
on
Zero
enable zerogpu
Browse files
app.py
CHANGED
@@ -262,6 +262,9 @@ def make_ref_cond(
|
|
262 |
):
|
263 |
print("ready to run autoencoder")
|
264 |
# print(f"image.device: {image.device}, type(image): {type(image)}")
|
|
|
|
|
|
|
265 |
latent = opts.latent_scaling_factor * autoencoder.encode(image[None, ...]).sample()
|
266 |
return image[None, ...], latent
|
267 |
|
@@ -338,9 +341,7 @@ def get_ref_anno(ref):
|
|
338 |
Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5], inplace=True),
|
339 |
]
|
340 |
)
|
341 |
-
image = image_transform(img)
|
342 |
-
image = image.numpy()
|
343 |
-
# image = torch.tensor(image)
|
344 |
kpts_valid = check_keypoints_validity(keypts, opts.image_size)
|
345 |
heatmaps = torch.tensor(
|
346 |
keypoint_heatmap(
|
|
|
262 |
):
|
263 |
print("ready to run autoencoder")
|
264 |
# print(f"image.device: {image.device}, type(image): {type(image)}")
|
265 |
+
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
266 |
+
torch.cuda.set_device(0)
|
267 |
+
image = image.to("cuda")
|
268 |
latent = opts.latent_scaling_factor * autoencoder.encode(image[None, ...]).sample()
|
269 |
return image[None, ...], latent
|
270 |
|
|
|
341 |
Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5], inplace=True),
|
342 |
]
|
343 |
)
|
344 |
+
image = image_transform(img).to(device)
|
|
|
|
|
345 |
kpts_valid = check_keypoints_validity(keypts, opts.image_size)
|
346 |
heatmaps = torch.tensor(
|
347 |
keypoint_heatmap(
|