Fix LayoutLM ONNX test error (#13710)

Fix LayoutLM ONNX test error
This commit is contained in:
Nishant Prabhu 2021-09-29 19:20:15 +05:30 committed by GitHub
parent 3a8a8013ad
commit a1ea3adb28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 7 deletions

View File

@ -42,6 +42,7 @@ Ready-made configurations include the following models:
- BERT
- DistilBERT
- GPT-2
- LayoutLM
- RoBERTa
- T5
- XLM-RoBERTa

View File

@ -183,11 +183,6 @@ class LayoutLMOnnxConfig(OnnxConfig):
raise ValueError("Cannot generate dummy inputs without PyTorch installed.")
import torch
input_dict["bbox"] = torch.tensor(
[
[0] * 4,
*[box] * seq_length,
[self.max_2d_positions] * 4,
]
).tile(batch_size, 1, 1)
batch_size, seq_length = input_dict["input_ids"].shape
input_dict["bbox"] = torch.tensor([*[box] * seq_length]).tile(batch_size, 1, 1)
return input_dict