Skip to content

Commit

Permalink
Add multiple module support to MLF
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrdadh committed Jun 2, 2022
1 parent a329df4 commit 8665d73
Show file tree
Hide file tree
Showing 7 changed files with 441 additions and 194 deletions.
17 changes: 14 additions & 3 deletions python/tvm/driver/tvmc/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,20 @@ def import_package(self, package_path: str):
with open(temp.relpath("metadata.json")) as metadata_json:
metadata = json.load(metadata_json)

has_graph_executor = "graph" in metadata["executors"]
graph = temp.relpath("executor-config/graph/graph.json") if has_graph_executor else None
params = temp.relpath(f'parameters/{metadata["model_name"]}.params')
all_module_names = []
for name in metadata["modules"].keys():
all_module_names.append(name)
assert len(all_module_names) == 1, "Multiple modules in MLF is not supported."

module_name = all_module_names[0]
module_metdata = metadata["modules"][module_name]
has_graph_executor = "graph" in module_metdata["executors"]
graph = (
temp.relpath(f"executor-config/graph/{module_name}.graph")
if has_graph_executor
else None
)
params = temp.relpath(f"parameters/{module_name}.params")

self.type = "mlf"
else:
Expand Down
Loading

0 comments on commit 8665d73

Please sign in to comment.