Skip to content

Commit

Permalink
Avoid forced log in the DMatrix binary loader. (#11080)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis authored Dec 8, 2024
1 parent 8173e57 commit 98b9b93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion R-package/tests/testthat/test_dmatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ test_that("xgb.DMatrix: saving, loading", {
on.exit(unlink(tmp_file))
expect_true(xgb.DMatrix.save(dtest1, tmp_file))
# read from a local file
xgb.set.config(verbosity = 2)
expect_output(dtest3 <- xgb.DMatrix(tmp_file), "entries loaded from")
expect_output(dtest3 <- xgb.DMatrix(tmp_file, silent = TRUE), NA)
xgb.set.config(verbosity = 1)
expect_output(dtest3 <- xgb.DMatrix(tmp_file), NA)
unlink(tmp_file)
expect_equal(getinfo(dtest1, 'label'), getinfo(dtest3, 'label'))

Expand Down
4 changes: 2 additions & 2 deletions src/data/data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -878,8 +878,8 @@ DMatrix* TryLoadBinary(std::string fname, bool silent) {
if (magic == data::SimpleDMatrix::kMagic) {
DMatrix* dmat = new data::SimpleDMatrix(&is);
if (!silent) {
LOG(CONSOLE) << dmat->Info().num_row_ << 'x' << dmat->Info().num_col_ << " matrix with "
<< dmat->Info().num_nonzero_ << " entries loaded from " << fname;
LOG(INFO) << dmat->Info().num_row_ << 'x' << dmat->Info().num_col_ << " matrix with "
<< dmat->Info().num_nonzero_ << " entries loaded from " << fname;
}
return dmat;
}
Expand Down

0 comments on commit 98b9b93

Please sign in to comment.