image = ds[0]["image"]
image

We will now see how to infer without a pipeline. Process the image with an image processor and place the pixel_values on a GPU:

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")  # use GPU if available, otherwise use a CPU
encoding = image_processor(image, return_tensors="pt")
pixel_values = encoding.pixel_values.to(device)

Pass your input to the model and return the logits:

outputs = model(pixel_values=pixel_values)
logits = outputs.logits.cpu()