Skip to content

Commit

Permalink
Generate dummy inputs function is not necessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Lacalle Castillo committed Oct 11, 2022
1 parent c67798c commit eda1c7b
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions src/transformers/models/donut/configuration_donut_swin.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,43 +164,3 @@ def atol_for_validation(self) -> float:
@property
def default_onnx_opset(self) -> int:
return 16

def generate_dummy_inputs(
self,
processor: "FeatureExtractionMixin",
batch_size: int = -1,
seq_length: int = -1,
is_pair: bool = False,
framework: Optional["TensorType"] = None,
num_channels: int = 3,
image_width: int = 40,
image_height: int = 40,
) -> Mapping[str, Any]:
"""
Generate inputs to provide to the ONNX exporter for the specific framework
Args:
processor ([`ProcessorMixin`]):
The processor associated with this model configuration.
batch_size (`int`, *optional*, defaults to -1):
The batch size to export the model for (-1 means dynamic axis).
seq_length (`int`, *optional*, defaults to -1):
The sequence length to export the model for (-1 means dynamic axis).
is_pair (`bool`, *optional*, defaults to `False`):
Indicate if the input is a pair (sentence 1, sentence 2).
framework (`TensorType`, *optional*, defaults to `None`):
The framework (PyTorch or TensorFlow) that the processor will generate tensors for.
num_channels (`int`, *optional*, defaults to 3):
The number of channels of the generated images.
image_width (`int`, *optional*, defaults to 40):
The width of the generated images.
image_height (`int`, *optional*, defaults to 40):
The height of the generated images.
Returns:
Mapping[str, Any]: holding the kwargs to provide to the model's forward function
"""

batch_size = compute_effective_axis_dimension(batch_size, fixed_dimension=OnnxConfig.default_fixed_batch)
dummy_input = self._generate_dummy_images(batch_size, num_channels, image_height, image_width)
return dict(processor(images=dummy_input, return_tensors=framework))

0 comments on commit eda1c7b

Please sign in to comment.