microsoft / onnxscript

ONNX Script enables developers to naturally author ONNX functions and models using a subset of Python.
https://onnxscript.ai/
MIT License
246 stars 46 forks source link

Use IR in the optimizer #1701

Open justinchuby opened 2 weeks ago

justinchuby commented 2 weeks ago

And improve robustness so it is reliable enough to be turned on by default.

justinchuby commented 1 week ago

The ExternalTensor support in the IR is working only when code is launched at the same directory as the model file. Aka. we read the external data file using relative paths. This is because when a model is loaded as a proto, its path information is lost to the IR. We need to design a way (e.g. pass in base path when deserializing) to handle when the model file is somewhere else.

This is relevant because I assume the optimizer will sometimes fold external tensors. Some examples may include Transpose(x) and element wise computation, casting, etc.

gramalingam commented 1 week ago

Related: https://github.com/microsoft/onnxscript/issues/1436