pytorch / executorch

On-device AI across mobile, embedded and edge for PyTorch
https://pytorch.org/executorch/
Other
1.7k stars 291 forks source link

Compile error on mobilenetV2 model by Arm ethos-u55 backend #3747

Closed chchen59 closed 3 months ago

chchen59 commented 3 months ago

Hi, I try to compile mobilenetV2 model by Arm ethos-u55 backend. But meet error as follow

chchen59@chchen59:~/executorch_home$ python executorch/examples/arm/aot_arm_compiler.py  -m mv2 -q -d
[WARNING 2024-05-27 11:20:04,031 aot_arm_compiler.py:174] Using a model from examples/models not all of these are currently supported
[W NNPACK.cpp:61] Could not initialize NNPACK! Reason: Unsupported hardware.
Traceback (most recent call last):
  File "/home/chchen59/executorch_home/executorch/examples/arm/aot_arm_compiler.py", line 211, in <module>
    exec_prog = edge.to_executorch(
  File "/home/chchen59/executorch_home/executorch/exir/program/_program.py", line 914, in to_executorch
    new_gm_res = p(new_gm)
  File "/home/chchen59/.local/lib/python3.10/site-packages/torch/fx/passes/infra/pass_base.py", line 40, in __call__
    res = self.call(graph_module)
  File "/home/chchen59/executorch_home/executorch/exir/passes/__init__.py", line 423, in call
    raise RuntimeError(f"Missing out variants: {missing_out_vars}")
RuntimeError: Missing out variants: {'quantized_decomposed::quantize_per_tensor', 'quantized_decomposed::dequantize_per_tensor'}

How can I fix it?

OS: Ubuntu 22.04 torch: 2.3.0 executorch: commit 9d4727d176cc5779a5d2d8dc60db043bf6b2e764 (May 24 18:15:20 2024)

Thanks, CHChen

Erik-Lundell commented 3 months ago

Hi CHChen! It sounds like the libquantized_ops_aot_lib needed for the mobilenetV2 compilation is not loaded. If you have run examples/arm/run.sh successfully, it should already be built for you. You then need to supply the path of the lib to aot_arm_compiler using the -s (or --so-_library) flag. You can find the path of the lib using (in executorch dir)

find . -name libquantized_ops_aot_lib.so

Thanks for raising the issue, the error message is not very clear for a problem that is likely just a missing command line argument. I'll address this for future users. Hope this helps! Erik

chchen59 commented 3 months ago

Hi Erik, Yes, I missed the libquantized_ops_aot_lib.so option.

Thank you so much! CHChen