This section shows how we translate a pytorch models into intermediate representations (IR), and how to transform this forward IR to training version and perform preprocessing.
Pre-requests:
- Setup forked tvm third_party/tvm-hack
- Pull the remove folder via
git submodule update --init --recursive
- Install GCC/Clang, LLVM (<14.0) and Python (<3.10)
- Compile following tvm compile-from-source (enable LLVM during compilation)
- Export the compiled TVM in path
export TVM_HOME=<DIR to third_party/tvm-hack> export PYTHONPATH=$TVM_HOME/python:${PYTHONPATH}
- Pull the remove folder via
- Translate pytorch models into training IR
and it will generate all required IRs and information under
python mcu_ir_gen.py
ir_zoos
. - Convert the IR into a json format to enable MCU integration
and the json files will be stored in current directory.
python ir2json.py <target IR path>