What is tf_model in your example? If you are following pattern of https://github.com/pytorch/executorch/blob/main/examples/models/inception_v3/model.py#L28, then the TFModel needs to defined get_random_inputs method.
I am not sure I understand. Sorry.
It sounds like I need to define get_random_input method in my model. Right?
The link in your message points to get_example_inputs method. I this an example of get_random_input method? In my model, input datasets are stored offline. They are not random tensors. Can I just supply to exir.capture an input dataset?
yes that is correct. In the code that tried, the expectation was that the model has “get_random_inputs” method specified on it. You can also just create a tuple of inputs (which is what the example code, I pointed you to, does) and supply that with exir.capture.
And no, capture cannot just take input dataset. It needs the tuple of example input to “trace” the model with.
I was able to have exir.capture run the trace of my model (I think). However, now the code fails with the error listed below. Could yo please take a look and let me know what you think I am ding wrong and what I should do next?
Thanks
<executorch.exir.program._program.ExirExportedProgram object at 0x7f59c4f14f40>
0%| | 0/25 [00:48<?, ?it/s]
Traceback (most recent call last):
File "/home/adonnini1/anaconda3/lib/python3.9/site-packages/torch/fx/passes/infra/pass_manager.py", line 270, in __call__
res = fn(module)
File "/home/adonnini1/anaconda3/lib/python3.9/site-packages/torch/fx/passes/infra/pass_base.py", line 41, in __call__
self.ensures(graph_module)
File "/home/adonnini1/Development/ContextQSourceCode/NeuralNetworks/trajectory-prediction-transformers-master/executorch/exir/passes/__init__.py", line 311, in ensures
raise RuntimeError(f"Missing out variants: {self.missing_out_vars}")
RuntimeError: Missing out variants: {'aten::alias'}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/adonnini1/Development/ContextQSourceCode/NeuralNetworks/trajectory-prediction-transformers-master/train.py", line 318, in <module>
open("tfmodel.pte", "wb").write(exir.capture(m, (enc_input, dec_input, dec_source_mask, dec_target_mask))
File "/home/adonnini1/Development/ContextQSourceCode/NeuralNetworks/trajectory-prediction-transformers-master/executorch/exir/program/_program.py", line 181, in to_executorch
new_prog = ep._transform(*edge_to_executorch_passes(config))
File "/home/adonnini1/anaconda3/lib/python3.9/site-packages/torch/export/exported_program.py", line 569, in _transform
res = pm(self.graph_module)
File "/home/adonnini1/anaconda3/lib/python3.9/site-packages/torch/fx/passes/infra/pass_manager.py", line 296, in __call__
raise Exception(msg) from e
Exception: An error occurred when running the 'ToOutVarPass' pass after the following passes: ['SpecPropPass', 'EdgeToBackendOpsPass', 'RemoveAssertAsyncPass', 'HintBasedSymShapeEvalPass']