Skip to content

Commit 473d807

Browse files
panzhufengcopybara-github
authored andcommitted
Use f-string to replace percent operator to make the logging more robust to data type. (self._num_training/validation_examples are initialized as None)
PiperOrigin-RevId: 504482361
1 parent 6d31080 commit 473d807

File tree

1 file changed

+9
-6
lines changed
  • tensorflow_decision_forests/keras

1 file changed

+9
-6
lines changed

tensorflow_decision_forests/keras/core.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,9 +1395,11 @@ def remote_consumes_training_examples_until_eof(iterator):
13951395
(per_worker_iter,))
13961396

13971397
if self._verbose >= 1:
1398-
tf_logging.info("Training dataset read in %s. Found %d examples.",
1399-
datetime.now() - time_begin_train_dataset_reading,
1400-
self._num_training_examples)
1398+
t = datetime.now() - time_begin_train_dataset_reading
1399+
tf_logging.info(
1400+
f"Training dataset read in {t}. Found"
1401+
f" {self._num_training_examples} examples."
1402+
)
14011403

14021404
# Load the validation dataset
14031405
if validation_data is not None:
@@ -1462,9 +1464,10 @@ def consumes_one_valid_batch(iterator):
14621464
self.num_validation_examples)
14631465

14641466
if self._verbose >= 1:
1465-
tf_logging.info("Validation dataset read in %s. Found %d examples.",
1466-
datetime.now() - time_begin_valid_dataset_reading,
1467-
self._num_validation_examples)
1467+
t = datetime.now() - time_begin_valid_dataset_reading
1468+
tf_logging.info(
1469+
f"Validation dataset read in {t}. Found"
1470+
f" {self._num_validation_examples} examples.")
14681471

14691472
# Train the model
14701473
# Note: The model should be trained after having collected both the training

0 commit comments

Comments
 (0)