in optimum/exporters/executorch/integrations.py [0:0]
def export(self, pixel_values=None) -> Dict[str, ExportedProgram]:
if pixel_values is None:
batch_size = 1
num_channels = self.config.num_channels
height = self.config.image_size
width = self.config.image_size
pixel_values = torch.rand(batch_size, num_channels, height, width)
with torch.no_grad():
return {
"model": torch.export.export(
self.model,
args=(),
kwargs={"pixel_values": pixel_values},
strict=False,
)
}