Skip to content

Commit

Permalink
Use f-string to replace percent operator to make the logging more rob…
Browse files Browse the repository at this point in the history
…ust to data type. (self._num_training/validation_examples are initialized as None)

PiperOrigin-RevId: 504482361
  • Loading branch information
panzhufeng authored and Copybara-Service committed Jan 25, 2023
1 parent 6d31080 commit 473d807
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tensorflow_decision_forests/keras/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1395,9 +1395,11 @@ def remote_consumes_training_examples_until_eof(iterator):
(per_worker_iter,))

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

# Load the validation dataset
if validation_data is not None:
Expand Down Expand Up @@ -1462,9 +1464,10 @@ def consumes_one_valid_batch(iterator):
self.num_validation_examples)

if self._verbose >= 1:
tf_logging.info("Validation dataset read in %s. Found %d examples.",
datetime.now() - time_begin_valid_dataset_reading,
self._num_validation_examples)
t = datetime.now() - time_begin_valid_dataset_reading
tf_logging.info(
f"Validation dataset read in {t}. Found"
f" {self._num_validation_examples} examples.")

# Train the model
# Note: The model should be trained after having collected both the training
Expand Down

0 comments on commit 473d807

Please sign in to comment.