BoLiu VibhuJawa commited on
Commit
2eb66f1
·
verified ·
1 Parent(s): b903fe1

vjawa_move_preprocessing_to_device (#8)

Browse files

- move pre processing to device (0f79b282d3df71101f492bc42acd6c49beb2957a)


Co-authored-by: Vibhu Jawa <VibhuJawa@users.noreply.huggingface.co>

nemotron_graphic_elements_v1/model.py CHANGED
@@ -141,6 +141,7 @@ class YoloXWrapper(nn.Module):
141
  """
142
  if not isinstance(image, torch.Tensor):
143
  image = torch.from_numpy(image)
 
144
  image = image.permute(2, 0, 1) # [H, W, 3] -> [3, H, W]
145
  image = resize_pad(image, self.img_size)
146
  return image.float()
 
141
  """
142
  if not isinstance(image, torch.Tensor):
143
  image = torch.from_numpy(image)
144
+ image = image.to(self.device)
145
  image = image.permute(2, 0, 1) # [H, W, 3] -> [3, H, W]
146
  image = resize_pad(image, self.img_size)
147
  return image.float()