vjawa_ensure_device_side_preprocessing (#8)
Browse files- Add device to pre-processing (0e5c49d842cf2fb0ccadd87fe65a6eff06d8da77)
Co-authored-by: Vibhu Jawa <VibhuJawa@users.noreply.huggingface.co>
nemotron_page_elements_v3/model.py
CHANGED
|
@@ -145,6 +145,7 @@ class YoloXWrapper(nn.Module):
|
|
| 145 |
"""
|
| 146 |
if not isinstance(image, torch.Tensor):
|
| 147 |
image = torch.from_numpy(image)
|
|
|
|
| 148 |
image = image.permute(2, 0, 1) # [H, W, 3] -> [3, H, W]
|
| 149 |
image = resize_pad(image, self.img_size)
|
| 150 |
return image.float()
|
|
|
|
| 145 |
"""
|
| 146 |
if not isinstance(image, torch.Tensor):
|
| 147 |
image = torch.from_numpy(image)
|
| 148 |
+
image = image.to(self.device)
|
| 149 |
image = image.permute(2, 0, 1) # [H, W, 3] -> [3, H, W]
|
| 150 |
image = resize_pad(image, self.img_size)
|
| 151 |
return image.float()
|