We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d981306 commit 3f04994Copy full SHA for 3f04994
torchtune/data/_utils.py
@@ -78,15 +78,16 @@ def load_image(image_loc: Union[Path, str]) -> torch.Tensor:
78
try:
79
image_loc = request.urlopen(image_loc).read()
80
image = torchvision.io.decode_image(
81
- torch.frombuffer(image_loc, dtype=torch.uint8)
+ torch.frombuffer(image_loc, dtype=torch.uint8),
82
+ mode="RGB",
83
)
84
except Exception as e:
85
raise ValueError("Failed to load remote image as torch.Tensor") from e
86
87
# Open the local image as a Tensor image
88
else:
89
- image = torchvision.io.decode_image(image_loc)
90
+ image = torchvision.io.decode_image(image_loc, mode="RGB")
91
92
raise ValueError("Failed to load local image as torch.Tensor") from e
93
return image
0 commit comments