google-ai-edge / ai-edge-torch

Supporting PyTorch models with the Google AI Edge TFLite runtime.
Apache License 2.0
300 stars 40 forks source link

Trace model in model-explorer #254

Open nigelzzzzzzz opened 4 days ago

nigelzzzzzzz commented 4 days ago

Description of the bug:

hi @pkgoogle, i have some question about computer graph with tinyllama.

Actual vs expected behavior:

No response

Any other information you'd like to share?

No response

pkgoogle commented 4 days ago

Hi @nigelzzzzzzz, I don't think I can explain it better than the code but effectively a model is equivalent to a program -- just like how compilers in the past converted programs to binary, they some times go through intermediary representations. These intermediary representations are expressed in MLIR. StableHLO is a dialect of MLIR, and so is VHLO. During this process to convert a model, there are sometimes opportunities to optimize the model/program/graph. It would take a long time to explain this all and I do not know every piece myself -- you might want to dig into the code yourself to see how you can make sense of it.