Skip to content

Commit

Permalink
[Nnstreamer-subplugin] Add save_path to setProperty
Browse files Browse the repository at this point in the history
- Add save_path to setProperty to save the model for each epoch.
- Remove model->save() call to avoid saving the current epoch result
  to the model when current epoch is interrupted

**Self evaluation:**
1. Build test:   [X]Passed [ ]Failed [ ]Skipped
2. Run test:     [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: hyunil park <[email protected]>
  • Loading branch information
songgot authored and jijoongmoon committed May 22, 2024
1 parent 6f817c7 commit 688c712
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions nnstreamer/tensor_trainer/tensor_trainer_nntrainer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,8 @@ void NNTrainer::NNTrainerImpl::trainModel() {
ml_logd("pid[%d], tid[%d]", pid, tid);

try {
model->setProperty({"epochs=" + std::to_string(num_epochs)});
model->setProperty(
{"epochs=" + std::to_string(num_epochs), "save_path=" + model_save_path});
} catch (const std::exception &e) {
ml_loge("Error %s, %s", typeid(e).name(), e.what());
return;
Expand All @@ -574,14 +575,6 @@ void NNTrainer::NNTrainerImpl::trainModel() {
return;
}

try {
ml_logd("Save_model: %s", model_save_path.c_str());
model->save(model_save_path, ml::train::ModelFormat::MODEL_FORMAT_BIN);

} catch (const std::exception &e) {
ml_loge("Error %s, %s", typeid(e).name(), e.what());
return;
}
/* send event */
nnstreamer_trainer_notify_event(this->notifier,
TRAINER_EVENT_TRAINING_COMPLETION, NULL);
Expand Down

0 comments on commit 688c712

Please sign in to comment.