MDF icon indicating copy to clipboard operation
MDF copied to clipboard

Added proof of concept for torch.fx to MDF

Open parikshit14 opened this issue 2 years ago • 0 comments

Proof of concept for torch.fx to MDF #431

  • Created pytorch_fx_to_mdf() which takes a pytorch model, argument as its input and converts to MDF model by node then edges then appends them to the current MDF Graph
  • Currently works for examples/PyTorch/simple_pytorch_to_mdf.py https://github.com/ModECI/MDF/blob/main/examples/PyTorch/simple_pytorch_to_mdf.py and added support to use the similar approach
  • In the conversion, I have still used ONNX in functions so that we can execute the MDF graph to verify the results but in future, we will need changes in execution_engine or maybe use another representation. (Didn't explore actr, ddm present in execution engine)
  • Because of using ONNX functions, parameter.args dictionary is restricted to particular values of key for the respective functions.
  • Tried to make it as general as possible and use the standard way as in pytorch_to_mdf(), typically the onnx::Reshape op requires further generalization
  • Minor Fix for ORT 1.9 issue src/modeci_mdf/functions/onnx.py
ValueError: This ORT build has ['AzureExecutionProvider', 'CPUExecutionProvider'] enabled.
Since ORT 1.9, you are required to explicitly set the providers parameter when instantiating InferenceSession. For 
example, onnxruntime.InferenceSession(..., providers=['AzureExecutionProvider', 'CPUExecutionProvider'], ...)

@davidt0x @pgleeson

parikshit14 avatar Oct 23 '23 16:10 parikshit14