how to use cuda

#17
by susht - opened

how to add cuda?
model_path = "google/deplot"
processor = Pix2StructProcessor.from_pretrained(model_path)
model = Pix2StructForConditionalGeneration.from_pretrained(model_path)
image = Image.open(image_path).convert("RGB")
inputs = processor(images=image, text="Generate underlying data table of the figure below:", return_tensors="pt")
predictions = model.generate(**inputs, max_new_tokens=512)
res = processor.decode(predictions[0], skip_special_tokens=True)

Sign up or log in to comment