tvm icon indicating copy to clipboard operation
tvm copied to clipboard

[Bug] Can not tune onnx models in M1 mac

Open HaoKang-Timmy opened this issue 3 years ago • 0 comments
trafficstars

I am using M1 mac to tune onnx resnet50 using the code from TVM tutorial. And I met problems both with autoscheduler and without it.

Expected behavior

It should generate information just like the gudiance.

# [Task  1/24]  Current/Best:    9.65/  23.16 GFLOPS | Progress: (60/1000) | 130.74 s Done.
# [Task  1/24]  Current/Best:    3.56/  23.16 GFLOPS | Progress: (192/1000) | 381.32 s Done.
# [Task  2/24]  Current/Best:   13.13/  58.61 GFLOPS | Progress: (960/1000) | 1190.59 s Done.

Actual behavior

Using command line

tvmc tune \               
--target "llvm" \
--output resnet50-v2-7-autotuner_records.json \
resnet50-v2-7.onnx

The result is

('Traceback (most recent call last):\n  File "/Users/catbeta/Documents/research/tvm/python/tvm/autotvm/measure/measure_methods.py", line 597, in __call__\n    func.export_library(filename, self.build_func)\n  File "/Users/catbeta/Documents/research/tvm/python/tvm/runtime/module.py", line 538, in export_library\n    return fcompile(file_name, files, **kwargs)\n  File "/Users/catbeta/Documents/research/tvm/python/tvm/contrib/tar.py", line 58, in tar\n    raise RuntimeError(msg)\nRuntimeError: Tar error:\ntar: no files or directories specified\n\n', RuntimeError('Tar error:\ntar: no files or directories specified\n'))      [('tile_ic', [-1, 1]), ('tile_oc', [-1, 256]), ('tile_ow', [-1, 16]), ('tile_oh', 1)],None,497
DEBUG:autotvm:No: 324   GFLOPS: 0.00/0.00       result: Traceback (most recent call last):
  File "/Users/catbeta/Documents/research/tvm/python/tvm/autotvm/measure/measure_methods.py", line 597, in __call__
    func.export_library(filename, self.build_func)
  File "/Users/catbeta/Documents/research/tvm/python/tvm/runtime/module.py", line 538, in export_library
    return fcompile(file_name, files, **kwargs)
  File "/Users/catbeta/Documents/research/tvm/python/tvm/contrib/tar.py", line 58, in tar
    raise RuntimeError(msg)
RuntimeError: Tar error:
tar: no files or directories specified

When I use python api


from tvm.driver import tvmc

model = tvmc.load('my_model.onnx') #Step 1: Load
tvmc.tune(model, target="llvm -mcpu=boradwell")
package = tvmc.compile(model, target="llvm")
result = tvmc.run(package, device="cpu")

The same thing happens. I wonder if you have ever used M1 chips to run the tutorial.

Environment

M1 macos python --3.8 miniforge TVM -- 0.10.dev0

Steps to reproduce

Use M1 mac to run

tvmc tune \               
--target "llvm" \
--output resnet50-v2-7-autotuner_records.json \
resnet50-v2-7.onnx

or execute

from tvm.driver import tvmc

model = tvmc.load('my_model.onnx') #Step 1: Load
tvmc.tune(model, target="llvm -mcpu=boradwell")
package = tvmc.compile(model, target="llvm")
result = tvmc.run(package, device="cpu")

HaoKang-Timmy avatar Jul 31 '22 19:07 HaoKang-Timmy