Skip to content

Commit b0d17ee

Browse files
authored
Merge pull request #547 from VahidooX/fix_time_print
Removed extra epoch time printing in checkpoint callback.
2 parents 4cd1018 + 6bec71e commit b0d17ee

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

nemo/core/callbacks.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18+
import datetime
1819
import glob
1920
import os
2021
import sys
@@ -200,8 +201,10 @@ def on_epoch_start(self):
200201
def on_epoch_end(self):
201202
if self.global_rank is None or self.global_rank == 0:
202203
step = self.step
203-
run_time = time.time() - self._last_epoch_start
204-
logging.info(f"Finished epoch {self.epoch_num} in {run_time}")
204+
205+
delta = datetime.timedelta(seconds=(time.time() - self._last_epoch_start))
206+
logging.info(f"Finished epoch {self.epoch_num} in {delta}")
207+
205208
if self._swriter is not None:
206209
value = self.epoch_num
207210
self._swriter.add_scalar('misc/epoch', value, step)
@@ -373,8 +376,6 @@ def on_epoch_start(self):
373376
def on_epoch_end(self):
374377
if self._epoch_freq > 0:
375378
if self.global_rank is None or self.global_rank == 0:
376-
run_time = time.time() - self._last_epoch_start
377-
logging.info(f'Finished epoch {self.epoch_num} in {run_time}')
378379
if (self.epoch_num + 1) % self._epoch_freq == 0:
379380
self.__save_to(path=self._folder)
380381

0 commit comments

Comments
 (0)