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 Alberto B茅gu茅 committed Jan 27, 2022
1 parent fe9c3de commit bdd18f3
Showing 1 changed file with 2 additions and 7 deletions.
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 bdd18f3

Please sign in to comment.