docvqa icon indicating copy to clipboard operation
docvqa copied to clipboard

Not able to post process the model output.

Open Ajithbalakrishnan opened this issue 3 years ago • 2 comments

I am not able to process the output. Please refer to the error log.

Traceback (most recent call last)
Input In [12], in <cell line: 7>()
     23 eval_feature = features[example_index.item()]
     24 unique_id = int(eval_feature.unique_id)
---> 26 output = [to_list(output[i]) for output in outputs]
     27 print("type: ",output)
     28 start_logits, end_logits = output

Input In [12], in <listcomp>(.0)
     23 eval_feature = features[example_index.item()]
     24 unique_id = int(eval_feature.unique_id)
---> 26 output = [to_list(output[i]) for output in outputs]
     27 print("type: ",output)
     28 start_logits, end_logits = output

Input In [12], in to_list(tensor)
      4 def to_list(tensor):
----> 5     return tensor.detach().cpu().tolist()

AttributeError: 'str' object has no attribute 'detach'

Ajithbalakrishnan avatar Jul 08 '22 05:07 Ajithbalakrishnan

I made 2 modifications in the demo.ipynb script. output = [to_list(output[i]) for output in outputs.logits] start_logits, end_logits = output[0]

This modification resolved the issue. But the predicted result was wrong. what is the contact person name mentioned in letter ? [CLS]

Ajithbalakrishnan avatar Jul 08 '22 06:07 Ajithbalakrishnan

Hi @Ajithbalakrishnan, I have the same issue. Were you able to generate the correct result?

zanvari avatar Apr 11 '23 00:04 zanvari