Skip to content

Commit

Permalink
Fix LayoutLM ONNX test error (huggingface#13710)
Browse files Browse the repository at this point in the history
Fix LayoutLM ONNX test error
  • Loading branch information
nishprabhu authored and sgugger committed Sep 29, 2021
1 parent 11144a3 commit 1008324
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/source/serialization.rst
Expand Up @@ -42,6 +42,7 @@ Ready-made configurations include the following models:
- BERT
- DistilBERT
- GPT-2
- LayoutLM
- RoBERTa
- T5
- XLM-RoBERTa
Expand Down
9 changes: 2 additions & 7 deletions src/transformers/models/layoutlm/configuration_layoutlm.py
Expand Up @@ -183,11 +183,6 @@ def generate_dummy_inputs(
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

0 comments on commit 1008324

Please sign in to comment.