I’m trying out tvmc with the new tutorial that was recently merged. A few things I’ve noticed:
- Running
tvmc
without any arguments produces a stack trace, rather than usage help.
- I’m attempting to tune the
resnet-50-v2.7.onnx
model using the command tvmc tune --target llvm --output autotuner_records.json resnet-50-v2.7.onnx
, and I’m running into an error:
[Task 1/24] Current/Best: 0.00/ 0.00 GFLOPS | Progress: (160/1000) | 117.97 sWARNING:autotvm:Too many errors happen in the tuning. Now is in debug mode DEBUG:autotvm:No: 161 GFLOPS: 0.00/0.00 result: MeasureResult(costs=(RuntimeError('The function of this task is not found. Possibly the function of this task is registered in another python file which is not imported in this run'),), error_no=2, all_cost=0.0001361370086669922, timestamp=1601682630.652663) [('tile_y', [-1, 1]), ('tile_x', [-1, 50]), ('tile_k', [-1, 128])],None,121
I’m running from the latest as of this writing. Where might I be going wrong?
Thanks for having a shot 
@leandron could you take a look at thees issues? The first one seems straightforward, and I guess the second one is due to missing topi import or something like that.
Halo, I could’t even know how to call tvmc correctly .
I try to remake tvm stack with my MacOS, then type python -m tvm.driver.tvmc
in the command , error reported
promote at ~/tvm/build ±(master) ✗ ❯ python -m tvm.driver.tvmc
Traceback (most recent call last):
File "/Users/wanglei/opt/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/Users/wanglei/opt/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/wanglei/tvm/python/tvm/driver/tvmc/__main__.py", line 24, in <module>
main()
File "/Users/wanglei/tvm/python/tvm/driver/tvmc/main.py", line 95, in main
sys.exit(_main(sys.argv[1:]))
File "/Users/wanglei/tvm/python/tvm/driver/tvmc/main.py", line 86, in _main
assert hasattr(args, "func"), "Error: missing 'func' attribute for subcommand {0}".format(argv)
AssertionError: Error: missing 'func' attribute for subcommand []
When i type -h
promote at ~/tvm/build ±(master) ✗ ❯ python -m tvm.driver.tvmc -h
usage: tvmc [-h] [-v] [--version] {} ...
TVM compiler driver
optional arguments:
-h, --help show this help message and exit
-v, --verbose increase verbosity
--version print the version and exit
commands:
{}
TVMC - TVM driver command-line interface
You can see no compile, no tune, etc.
The first error you mention was already reported by @hogepodge and I just submitted a PR to address that.
Now, the second error, when you see no sub-commands, it is a bit puzzling. Can you provide more context? Are you running it from a particular hash in git?
Also, can you give me the output of the command line below?
python -c "from tvm.driver.tvmc import compiler, autotuner, runner; print(compiler.__file__)"
1 Like
Thank you for reply, I just figure out the second error, it was caused by my failed git pull operation(i changed some files and did not commit then i didn’t notice the error of git pull op).
And thank you again.
1 Like
I’m still investigating this one.
Hey, is that tvmc
the omission of python -m tvm.driver.tvmc
?
cause i didn’t find command tvmc
, as substitute, i append
alias tvmc='python -m tvm.driver.tvmc'
to my shell profile.
it is only created when you install it using setuptools, like python setup.py install
or pip install ...
.
1 Like
That is what I’m doing, installing to a local virtualenv using setuptools.
A quick update on this, it turns out this is part of a larger issue with Python threading on macOS. I don’t think it impacts Linux users.
Oh I see. I think it would be good to have an issue on GitHub to discuss that around AutoTVM?
The different tvmc first-run with ‘compile’ problem
I’m attempting to compile the resnet-50-v2.7.onnx model using the command :
python -m tvm.driver.tvmc compile --target “llvm” --output compiled_module.tar resnet50-v2-7.onnx
and I’m running into an error:
WARNING:root:Attribute momentum is ignored in relay.sym.batch_norm
WARNING:root:Attribute spatial is ignored in relay.sym.batch_norm
Traceback (most recent call last):
File “/home/tw/anaconda3/lib/python3.7/runpy.py”, line 193, in _run_module_as_main
"main ", mod_spec)
File “/home/tw/anaconda3/lib/python3.7/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/tw/tvm/python/tvm/driver/tvmc/main .py”, line 24, in
tvmc.main.main()
File “/home/tw/tvm/python/tvm/driver/tvmc/main.py”, line 92, in main
sys.exit(_main(sys.argv[1:]))
File “/home/tw/tvm/python/tvm/driver/tvmc/main.py”, line 85, in _main
return args.func(args)
File “/home/tw/tvm/python/tvm/driver/tvmc/compiler.py”, line 114, in drive_compile
args.desired_layout,
File “/home/tw/tvm/python/tvm/driver/tvmc/compiler.py”, line 182, in compile_model
with open(target) as target_file:
IsADirectoryError: [Errno 21] Is a directory: ‘llvm’
Therefore,I want to ask you this problem,Where might I be going wrong?
This is actually happening due to a bug, to which I just submitted a fix here: [TVMC] Fix to check whether a path passed to --target is strictly a file by leandron · Pull Request #7663 · apache/tvm · GitHub.
You prabably have a directory called llvm
in the same directory as you’re calling tvmc, and this is causing tvmc to think that you’re actually setting --target
with a path, rather than a string.
this problem has benn solved,but I still have some problems in compiling the resnet-50-v2.7.onnx model using the command :
python -m tvm.driver.tvmc compile --target “llvm” --output compiled_module.tar resnet50-v2-7.onnx
and I’m running into an error:
WARNING:root:Attribute momentum is ignored in relay.sym.batch_norm
WARNING:root:Attribute spatial is ignored in relay.sym.batch_norm
Traceback (most recent call last):
File “/home/tw/anaconda3/lib/python3.7/runpy.py”, line 193, in _run_module_as_main
"main ", mod_spec)
File “/home/tw/anaconda3/lib/python3.7/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/tw/tvm/python/tvm/driver/tvmc/main .py”, line 24, in
tvmc.main.main()
File “/home/tw/tvm/python/tvm/driver/tvmc/main.py”, line 92, in main
sys.exit(_main(sys.argv[1:]))
File “/home/tw/tvm/python/tvm/driver/tvmc/main.py”, line 85, in _main
return args.func(args)
File “/home/tw/tvm/python/tvm/driver/tvmc/compiler.py”, line 114, in drive_compile
args.desired_layout,
File “/home/tw/tvm/python/tvm/driver/tvmc/compiler.py”, line 189, in compile_model
tvm_target = tvm.target.Target(target)
File “/home/tw/tvm/python/tvm/target/target.py”, line 92, in init
self.init_handle_by_constructor (_ffi_api.Target, tag_or_str_or_dict)
File “/home/tw/tvm/python/tvm/_ffi/_ctypes/object.py”, line 131, in init_handle_by_constructor
handle = init_by_constructor (fconstructor, args)
File “/home/tw/tvm/python/tvm/_ffi/_ctypes/packed_func.py”, line 246, in init_handle_by_constructor
values, tcodes, num_args = _make_tvm_args(args, temp_args)
File “/home/tw/tvm/python/tvm/_ffi/_ctypes/packed_func.py”, line 163, in _make_tvm_args
values[i].v_str = c_str(arg)
File “/home/tw/tvm/python/tvm/_ffi/base.py”, line 88, in c_str
return ctypes.c_char_p(string.encode(“utf-8”))
UnicodeEncodeError: ‘utf-8’ codec can’t encode characters in position 0-1: surrogates not allowed
It seems it has something to do with the actual strings being used to invoke tvmc. I’ve seen this sometimes when I copy command lines from the browser or other non-text documents, but in this specific case I’m not being able to spot the exact problem.
Can you please file a bug at https://github.com/apache/tvm/issues/new ?
1 Like
thanks ,I have solved this problem by entering commands manually
1 Like