-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[onert] Support model file loading from model path #14473
Conversation
5c60451
to
e6e226d
Compare
This commit updates API to support model file loading from model path. ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh <[email protected]>
e6e226d
to
92463ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -48,7 +48,7 @@ NNFW_STATUS nnfw_load_circle_from_buffer(nnfw_session *session, uint8_t *buffer, | |||
NNFW_STATUS nnfw_load_model_from_modelfile(nnfw_session *session, const char *file_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason to maintain the name(nnfw_load_model_from_modelfile
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onert_run
and other test drivers are using this API. It will be removed after migration.
* | ||
* @return @c NNFW_STATUS_NO_ERROR if successful | ||
*/ | ||
NNFW_STATUS nnfw_load_model_from_file(nnfw_session *session, const char *package_file_path); | ||
NNFW_STATUS nnfw_load_model_from_file(nnfw_session *session, const char *file_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to nnfw_load_model_from_file
is going to be used for both nnpkg (= directory) and model (= file), and nnfw_load_model_from_file
will be retired. Is it right?
Then, here is my understanding:
As I guess, someone choose this name to distinguish from_memory
— flatbuffers-based model created in the memory for test.
Also, I guess file
here means not only regular file, but also directory. It may be thought as load_from_filesystem.
Later, if we support archived nnpkg (in zip), we can distinguish nnpkg.zip and a single model by extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I guess, someone choose this name to distinguish from_memory — flatbuffers-based model created in the memory for test.
Exactly! 👍
@@ -213,16 +213,16 @@ NNFW_STATUS nnfw_create_session(nnfw_session **session); | |||
NNFW_STATUS nnfw_close_session(nnfw_session *session); | |||
|
|||
/** | |||
* @brief Load model from nnpackage file or directory | |||
* @brief Load model from model file or nnpackage directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @brief Load model from model file or nnpackage directory | |
* @brief Load model from path to model or nnpackage |
* | ||
* The length of \p package_file_path must not exceed 1024 bytes including zero at the end. | ||
* The length of \p file_path must not exceed 1024 bytes including zero at the end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* The length of \p file_path must not exceed 1024 bytes including zero at the end. | |
* The length of \p path must not exceed 1024 bytes including zero at the end. |
* @param[in] session nnfw_session loading the given file/dir | ||
* @param[in] file_path Path to the model file or nnpackage directory to be loaded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param[in] session nnfw_session loading the given file/dir | |
* @param[in] file_path Path to the model file or nnpackage directory to be loaded | |
* @param[in] session nnfw_session loading the given file/dir | |
* @param[in] path path to the model file or nnpackage directory to be loaded |
* | ||
* @return @c NNFW_STATUS_NO_ERROR if successful | ||
*/ | ||
NNFW_STATUS nnfw_load_model_from_file(nnfw_session *session, const char *package_file_path); | ||
NNFW_STATUS nnfw_load_model_from_file(nnfw_session *session, const char *file_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NNFW_STATUS nnfw_load_model_from_file(nnfw_session *session, const char *file_path); | |
NNFW_STATUS nnfw_load_model_from_file(nnfw_session *session, const char *path); |
* @param session nnfw_session loading the given file/dir | ||
* @param file_path path to the model file or nnpackage directory to be loaded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param session nnfw_session loading the given file/dir | |
* @param file_path path to the model file or nnpackage directory to be loaded | |
* @param session nnfw_session loading the given file/dir | |
* @param path path to the model or nnpackage to be loaded |
{ | ||
NNFW_RETURN_ERROR_IF_NULL(session); | ||
return session->load_model_from_nnpackage(pacakge_file_path); | ||
return session->load_model_from_path(file_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... it is path from here.
I am not opposing this change. My comment is for recording, and optional. I will merge after a few hours. |
This commit updates API to support model file loading from model path.
ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh [email protected]
Related issue: #14466