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)
I can move the model to GPU model.to(device) but it still complains about another tensor...
Working now:
model = Pix2StructForConditionalGeneration.from_pretrained('google/deplot').to(device)
....
inputs.to(device)
