gromero commented on a change in pull request #9229:
URL: https://github.com/apache/tvm/pull/9229#discussion_r735720743
##########
File path: apps/microtvm/zephyr/template_project/microtvm_api_server.py
##########
@@ -229,40 +229,69 @@ def _get_nrf_device_args(options):
PROJECT_OPTIONS = [
server.ProjectOption(
"extra_files_tar",
+ optional=["generate_project"],
+ type="str",
Review comment:
The issue here is that str, bool, etc are metaclasses of 'type' type
class so they can not themselves be serialized. Hence the following happens if
I do the substitution you suggested:
```
gromero@amd:~/git/tvm$ tvmc micro build /tmp/x20 zephyr --list-options
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/gromero/git/tvm/python/tvm/driver/tvmc/__main__.py", line 24,
in <module>
tvmc.main.main()
File "/home/gromero/git/tvm/python/tvm/driver/tvmc/main.py", line 94, in
main
sys.exit(_main(sys.argv[1:]))
File "/home/gromero/git/tvm/python/tvm/driver/tvmc/main.py", line 69, in
_main
make_subparser(subparser, parser)
File "/home/gromero/git/tvm/python/tvm/driver/tvmc/micro.py", line 173, in
add_micro_parser
template = project.TemplateProject.from_directory(template_dir)
File "/home/gromero/git/tvm/python/tvm/micro/project.py", line 105, in
from_directory
return cls(client.instantiate_from_dir(template_project_dir))
File "/home/gromero/git/tvm/python/tvm/micro/project.py", line 109, in
__init__
self._info = self._api_client.server_info_query(__version__)
File "/home/gromero/git/tvm/python/tvm/micro/project_api/client.py", line
143, in server_info_query
reply = self._request_reply("server_info_query", {"tvm_version":
tvm_version})
File "/home/gromero/git/tvm/python/tvm/micro/project_api/client.py", line
135, in _request_reply
raise server.JSONRPCError.from_json(f"calling method {method}",
reply["error"])
tvm.micro.project_api.server.ServerError: calling method server_info_query:
JSON-RPC error # -32000: calling method server_info_query
Traceback (most recent call last):
File "/home/gromero/git/tvm/python/tvm/micro/project_api/server.py", line
479, in serve_one_request # <--- Outermost server-side stack frame
self._dispatch_request(request)
File "/home/gromero/git/tvm/python/tvm/micro/project_api/server.py", line
592, in _dispatch_request
self._write_reply(request["id"], result=return_value)
File "/home/gromero/git/tvm/python/tvm/micro/project_api/server.py", line
608, in _write_reply
reply_str = json.dumps(reply_dict)
File "/usr/lib/python3.9/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python3.9/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.9/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python3.9/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type type is not JSON serializable
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]