Closed shayal01 closed 1 year ago
What is the issue exactly? Your code only works for batch size = 1
for page_num,page_as_tensor in tqdm(enumerate(dataloader)): model_output = model.inference(image_tensors=page_as_tensor[0])
If i don't mention the index 0 in page_as_tensor ,an error pops because page_as_tensor is a list.May be because i am doing it for just one paper .but in the predict.py and app.py files ,they didn't mention the index.So is it issue too when using multiple pdfs?
if we are just using a single pdf, the sample is a list and inference is expecting a tensor of an image ,so the below code will not work so we should make it into sample[0].where sample[0] is the tensor which is stored in the 0th index of the list model_output = model.inference(image_tensors=sample)
this a function where i passed a single pdf file. and made predictions for each page def predict(): model=NougatModel.from_pretrained("C:/Users/sshamsu/Documents/New folder/nougat weights").to(torch.bfloat16)#getting nougat pretrained model if torch.cuda.is_available(): model.to("cuda")