profile snapshot saving
@@ -228,6 +228,12 @@ static void Train(
profile.StartNextIteration();
+ if (timer.Passed() > ctx->OutputOptions.GetSnapshotSaveInterval()) {
+ profile.AddOperation("Save snapshot");
+ ctx->SaveProgress();
+ timer.Reset();
+ }
+
trainOneIterationFunc(learnData, testDataPtrs, ctx);
bool calcAllMetrics = DivisibleOrLastIteration(
@@ -272,11 +278,6 @@ static void Train(
&logger
);
- if (timer.Passed() > ctx->OutputOptions.GetSnapshotSaveInterval()) {
- ctx->SaveProgress();
- timer.Reset();
- }
-
if (HasInvalidValues(ctx->LearnProgress.LeafValues)) {
ctx->LearnProgress.LeafValues.pop_back();
ctx->LearnProgress.TreeStruct.pop_back();
