Skip to content

Commit

Permalink
close writer in after_run
Browse files Browse the repository at this point in the history
  • Loading branch information
ly015 authored and ZwwWayne committed Nov 10, 2021
1 parent 9071202 commit a68d28c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mmcv/runner/hooks/logger/pavi.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ def after_run(self, runner):
snapshot_file_path=ckpt_path,
iteration=iteration)

# flush the buffer and send a task ending signal to Pavi
if hasattr(self, 'writer'):
self.writer.close()

@master_only
def before_epoch(self, runner):
if runner.epoch == 0 and self.add_graph:
Expand All @@ -112,7 +116,3 @@ def before_epoch(self, runner):
image = data[self.img_key][0:1].to(device)
with torch.no_grad():
self.writer.add_graph(_model, image)

def __del__(self):
if hasattr(self, 'writer'):
self.writer.close()

0 comments on commit a68d28c

Please sign in to comment.