Skip to content

Commit 3d64783

Browse files
authored
[microTVM] Add wrapper for creating project using a MLF (#9090)
Currently there is already a wrapper function for creating a new project directory based on an ExportableModule, but there isn't one for creating a new project directory based on an existing MLF archive, which is also handy. Hence that commit adds a new wrapper for creating a project using an existing model compiled and kept in a MLF archive. Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org> Reviewed-by: Christopher Sidebottom <chris.sidebottom@arm.com> Reviewed-by: Andrew Reusch <areusch@octoml.ai>
1 parent 229eca4 commit 3d64783

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

python/tvm/micro/project.py

+33
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,36 @@ def generate_project(
164164
"""
165165
template = TemplateProject.from_directory(str(template_project_dir))
166166
return template.generate_project(module, str(generated_project_dir), options)
167+
168+
169+
def generate_project_from_mlf(
170+
template_project_dir: Union[pathlib.Path, str],
171+
project_dir: Union[pathlib.Path, str],
172+
mlf_path: Union[pathlib.Path, str],
173+
options: dict,
174+
):
175+
"""Generate a project from a platform template and an existing Model Library Format archive.
176+
177+
Parameters
178+
----------
179+
template_project_path : pathlib.Path or str
180+
Path to a template project containing a microTVM Project API server.
181+
182+
project_dir : pathlib.Path or str
183+
Path to a directory where the project will be created.
184+
185+
mlf_path : pathlib.Path or str
186+
Path to the Model Library Format archive that will be used when creating
187+
the new project.
188+
189+
options : dict
190+
Project API options given to the microTVM API server for the specified platform.
191+
192+
Returns
193+
-------
194+
GeneratedProject :
195+
A class that wraps the generated project and which can be used to further interact with it.
196+
"""
197+
198+
template = TemplateProject.from_directory(str(template_project_dir))
199+
return template.generate_project_from_mlf(str(mlf_path), str(project_dir), options)

0 commit comments

Comments
 (0)