mirror of
https://github.com/open-mmlab/mmcv.git
synced 2025-06-03 21:54:52 +08:00
close writer in after_run
This commit is contained in:
parent
9071202fde
commit
a68d28c9f8
@ -100,6 +100,10 @@ class PaviLoggerHook(LoggerHook):
|
|||||||
snapshot_file_path=ckpt_path,
|
snapshot_file_path=ckpt_path,
|
||||||
iteration=iteration)
|
iteration=iteration)
|
||||||
|
|
||||||
|
# flush the buffer and send a task ending signal to Pavi
|
||||||
|
if hasattr(self, 'writer'):
|
||||||
|
self.writer.close()
|
||||||
|
|
||||||
@master_only
|
@master_only
|
||||||
def before_epoch(self, runner):
|
def before_epoch(self, runner):
|
||||||
if runner.epoch == 0 and self.add_graph:
|
if runner.epoch == 0 and self.add_graph:
|
||||||
@ -112,7 +116,3 @@ class PaviLoggerHook(LoggerHook):
|
|||||||
image = data[self.img_key][0:1].to(device)
|
image = data[self.img_key][0:1].to(device)
|
||||||
with torch.no_grad():
|
with torch.no_grad():
|
||||||
self.writer.add_graph(_model, image)
|
self.writer.add_graph(_model, image)
|
||||||
|
|
||||||
def __del__(self):
|
|
||||||
if hasattr(self, 'writer'):
|
|
||||||
self.writer.close()
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user