mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 18:48:51 +00:00
Move image tensor to device in trocr example (#2063)
Signed-off-by: Harry Stern <harry@harrystern.net>
This commit is contained in:
@ -115,7 +115,7 @@ pub fn main() -> anyhow::Result<()> {
|
|||||||
let processor = image_processor::ViTImageProcessor::new(&processor_config);
|
let processor = image_processor::ViTImageProcessor::new(&processor_config);
|
||||||
|
|
||||||
let image = vec![args.image.as_str()];
|
let image = vec![args.image.as_str()];
|
||||||
let image = processor.preprocess(image)?;
|
let image = processor.preprocess(image)?.to_device(&device)?;
|
||||||
|
|
||||||
let encoder_xs = model.encoder().forward(&image)?;
|
let encoder_xs = model.encoder().forward(&image)?;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user