renesas-rz / rzv_drp-ai_tvm

Extension package of Apache TVM (Machine Learning Compiler) for Renesas DRP-AI accelerators powered by Edgecortix MERA(TM) Based Apache TVM version: v0.11.1
Apache License 2.0
39 stars 5 forks source link

tutorial script fails due to ModuleNotFoundError: No module named 'graph_optimizer' #11

Open jo-tham opened 1 year ago

jo-tham commented 1 year ago

tflite model compilation fails due to missing module "graph_optimizer"

any suggestions to resolve this?

I assume something is wrong in my docker image - if you have is a working image/container, perhaps you can share it on dockerhub?

For what it's worth, the basic example also fails for me with the same error.

traceback and pip dependencies below:

root@b7335b00dd25:/drp-ai_tvm/tutorials# python3 compile_tflite_model.py ../data/model.tflite -o model_tflite
[Check arguments]
  Input AI model         :  ../data/model.tflite
  SDK path               :  /opt/poky/3.1.14
  DRP-AI Translator path :  /opt/drp-ai_translator_release
  Output dir             :  model_tflite
  Default input shape    :  [1, 3, 224, 224]
-------------------------------------------------
   Run TVM frotend compiler 
-------------------------------------------------
   Run TVM backend compiler with DRP-AI Translator
[03:24:54] /root/drp-tvm-share/src/relay/transforms/to_mixed_precision.cc:429: Warning: Op "layout_transform" not registered FTVMMixedPrecisionConversionType appears 1 times in graph.
def @tvmgen_default_tvmgen_default_mera_drp_91...

One or more operators have not been tuned. Please tune your model for better performance. Use DEBUG logging level to see more details.
Function name: tvmgen_default_tvmgen_default_mera_drp_104
Model size: 5432
GraphSize: 5432
Traceback (most recent call last):
  File "compile_tflite_model.py", line 86, in <module>
    drp.build(mod, \
  File "python/tvm/relay/mera/drp/build.py", line 237, in tvm.relay.mera.drp.build.build
  File "python/tvm/relay/mera/drp/build.py", line 238, in tvm.relay.mera.drp.build.build
  File "/drp-ai_tvm/tvm/python/tvm/relay/build_module.py", line 357, in build
    executor_config, runtime_mod, params = bld_mod.build(
  File "/drp-ai_tvm/tvm/python/tvm/relay/build_module.py", line 172, in build
    self._build(mod, target, target_host, executor, mod_name)
  File "/drp-ai_tvm/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 237, in __call__
    raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
  File "/root/drp-tvm-share/src/relay/backend/contrib/mera/drp/mera_drp_codegen.cc", line 1298
TVMError: drp translator toolchain failed: 
Traceback (most recent call last):
  File "/opt/drp-ai_translator_release/DRP-AI_translator/api_translator/scripts/run_translator.py", line 1, in <module>
    from translator import translator
  File "translator.py", line 8, in init translator
ModuleNotFoundError: No module named 'graph_optimizer'
Error: run_translator.py failed

pip environment is:

root@b7335b00dd25:/drp-ai_tvm/tutorials# pip freeze
absl-py==1.4.0
astunparse==1.6.3
attrs==23.1.0
cachetools==5.3.0
certifi==2019.11.28
chardet==3.0.4
cmake==3.26.3
coloredlogs==15.0.1
Cython==0.29.30
dbus-python==1.2.16
decorator==5.1.1
distro-info===0.23ubuntu1
et-xmlfile==1.1.0
exceptiongroup==1.1.1
filelock==3.12.0
flatbuffers==23.3.3
gast==0.4.0
google-auth==2.17.3
google-auth-oauthlib==1.0.0
google-pasta==0.2.0
grpcio==1.54.0
h5py==3.8.0
humanfriendly==10.0
idna==2.8
importlib-metadata==6.6.0
iniconfig==2.0.0
jax==0.4.8
Jinja2==3.1.2
keras==2.12.0
libclang==16.0.0
lit==16.0.2
Markdown==3.4.3
MarkupSafe==2.1.2
ml-dtypes==0.1.0
mpmath==1.3.0
networkx==3.0
numpy==1.23.5
nvidia-cublas-cu11==11.10.3.66
nvidia-cuda-cupti-cu11==11.7.101
nvidia-cuda-nvrtc-cu11==11.7.99
nvidia-cuda-runtime-cu11==11.7.99
nvidia-cudnn-cu11==8.5.0.96
nvidia-cufft-cu11==10.9.0.58
nvidia-curand-cu11==10.2.10.91
nvidia-cusolver-cu11==11.4.0.1
nvidia-cusparse-cu11==11.7.4.91
nvidia-nccl-cu11==2.14.3
nvidia-nvtx-cu11==11.7.91
oauthlib==3.2.2
onnx==1.13.1
onnxruntime==1.14.1
opencv-python==4.7.0.72
openpyxl==3.1.2
opt-einsum==3.3.0
packaging==23.1
pandas==1.5.3
Pillow==9.5.0
pluggy==1.0.0
protobuf==4.22.3
pyasn1==0.5.0
pyasn1-modules==0.3.0
PyGObject==3.36.0
pytest==7.3.1
python-apt==2.0.1+ubuntu0.20.4.1
python-dateutil==2.8.2
pytz==2023.3
PyYAML==6.0
requests==2.22.0
requests-oauthlib==1.3.1
requests-unixsocket==0.2.0
rsa==4.9
scipy==1.10.1
six==1.14.0
sympy==1.11.1
tensorboard==2.12.3
tensorboard-data-server==0.7.0
tensorflow==2.12.0
tensorflow-estimator==2.12.0
tensorflow-io-gcs-filesystem==0.32.0
termcolor==2.3.0
tflite==2.10.0
tomli==2.0.1
torch==1.8.1
torchvision==0.9.1
triton==2.0.0
typing_extensions==4.5.0
unattended-upgrades==0.1
urllib3==1.25.8
Werkzeug==2.3.3
wrapt==1.14.1
zipp==3.15.0
simobepu commented 1 year ago

Hello Jotham-san, Our tool works only with Intel-based Linux and it does not support Apple M1-based environments.