chunit-quic commented on PR #14050: URL: https://github.com/apache/tvm/pull/14050#issuecomment-1436413982
Hi community, This is the last PR for the frontend span filling in [TVM explorer infra](https://github.com/apache/tvm/issues/13116). After this PR, the source node information of PyTorch will be tagged to the converted relay. The conversion flow of Pytorch is the most complex frontend within our PRs. To give you more context, I would try to describe some key points here. # Renaming We rename the debug names of C graph instructions' outputs within the model at first. Then we can obtain them during the conversion. Rather than using the high-level IR, TopLevelTracedModule, the source IR of pytorch frontend is C graph instance. In some cases, there is no unique source name to use. Therefore we construct a unique name for each output of a C graph instruction based on their op types. Via renaming the debug name at first, we can obtain them during the conversion. # The exported model format We export the pure text format of C graph for users. There are two reasons for us to choose this format. 1. Native Netron cannot obtain the modified dubeg names Considering the most used visulization tool, Netron. The way how it obtains the source name is [based on the sequence of modules](https://github.com/lutzroeder/netron/blob/5d35a11d70997d3ca68235db27803282d5ea373d/source/pytorch.js#L579). It is extremely hard for us to tag the rewritten name of C graph instruction to its source. Without a patch to modify the code of Netron, we cannot check the rewritten names via Netron. 2. C Graph will be modified In some conversion, like qnn, C graph might be modified compared to its original format. To give more information to users, we decide to export the modified graph for them, so that users can have more clues to check with. Comparing with previous three frontends, Pytorch is a relative hard one. Because we have to deal the renaimg problem, exported format, and some more special cases during the conversion. Thank you for reading. Please feel free to give us any comment. :D # For your reference, here is the related links. [PreRFC in forum](https://discuss.tvm.apache.org/t/pre-rfc-tvm-explorer-infrastructure/13457/24) https://github.com/apache/tvm-rfcs/pull/92 https://github.com/apache/tvm/issues/13116 [@haowhsu-quic](https://github.com/haowhsu-quic), [@zack-ch](https://github.com/zack-ch) # One more thing which is not related to this PR, but I would like to throw it out there. When I try to run pytest for pytorch frontend. I found some test cases were failed even in main branch inside CI docker. Are they expected to be failed? Or something did I do wrong (I use CPU to test only) ``` test_forward.py -test_forward_conv -group convolution -test_forward_conv2d_transpose_group test_fx_quant.py qnn_test.py -test_quantized_imagenet test_object_detection.py ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
