Allow 3D animation to run on GPU's other than GPU0

The device (potentially a CUDA device) wasn't being passed to the instantiation of the AdaBins InferenceHelper. Thus it was always picking the default -- typically "cuda:0".
This change passes the same device initialized in the main notebook (Which yeah, is hardcoded to "cuda:0".. but is really easy to change to something else).
pull/95/head^2
Adam Letts 2 years ago committed by GitHub
parent 39232ffe7b
commit e2e5e5bc6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      disco_xform_utils.py

@ -28,7 +28,7 @@ def transform_image_3d(img_filepath, midas_model, midas_transform, device, rot_m
predictions using nyu dataset
"""
print("Running AdaBins depth estimation implementation...")
infer_helper = InferenceHelper(dataset='nyu')
infer_helper = InferenceHelper(dataset='nyu', device=device)
image_pil_area = w*h
if image_pil_area > MAX_ADABINS_AREA:
@ -128,4 +128,4 @@ def get_spherical_projection(H, W, center, magnitude,device):
d = center - grid
d_sum = torch.sqrt((d**2).sum(axis=-1))
grid += d * d_sum.unsqueeze(-1) * magnitude
return grid.unsqueeze(0)
return grid.unsqueeze(0)

Loading…
Cancel
Save