Skip to content

Commit

Permalink
Fix: clean train dir before CV to avoid 'loading' fold progress from …
Browse files Browse the repository at this point in the history
…previous runs.. Fix #2221.
  • Loading branch information
andrey-khropov committed Apr 23, 2023
1 parent b35c23a commit dcaf5f5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions catboost/libs/train_lib/cross_validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <util/stream/labeled.h>
#include <util/string/cast.h>
#include <util/system/compiler.h>
#include <util/system/fs.h>
#include <util/system/hp_timer.h>

#include <cmath>
Expand Down Expand Up @@ -395,6 +396,9 @@ void CrossValidate(

TString tmpDir;
if (outputFileOptions.AllowWriteFiles()) {
// Need to clean train dir first because snapshots are used in the implementation in GPU mode but they
// should not be used to load data from the previous call to CrossValidation with the same train dir.
NFs::RemoveRecursive(outputFileOptions.GetTrainDir());
NCB::NPrivate::CreateTrainDirWithTmpDirIfNotExist(outputFileOptions.GetTrainDir(), &tmpDir);
}

Expand Down

0 comments on commit dcaf5f5

Please sign in to comment.