-
Notifications
You must be signed in to change notification settings - Fork 843
Closed
Description
Is there a way to export a pretrained model to executorch? This example https://pytorch.org/executorch/stable/getting-started-setup.html#export-a-program only shows how to export a new model instance. I tried doing it like this
# 1. torch.export: Defines the program with the ATen operator set.
model.eval()
aten_dialect = torch.export.export( model, ( torch.ones( 2 ) ) )
# 2. to_edge: Make optimizations for Edge devices
edge_program = executorch.exir.to_edge( aten_dialect )
# 3. to_executorch: Convert the graph to an ExecuTorch program
executorch_program = edge_program.to_executorch()
# 4. Save the compiled .pte program
with open( "net.pte", "wb" ) as file:
file.write(executorch_program.buffer)
but I get Expecting 'args' to be a tuple of example positional inputs, got <class 'torch.Tensor'>.
My model:
class Net( nn.Module ):
def __init__( self ):
super().__init__()
self.inputFeatures = 2
self.fc1 = nn.Linear( self.inputFeatures, 1 )
def forward( self, x ):
fc1 = F.sigmoid( self.fc1( x ) )
return fc1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels