Commit 52cc9096 authored by Ilya Ovodov's avatar Ilya Ovodov

fix tb logger start_server

parent 1237f3d8
import copy import copy
import math import math
import os import os
import subprocess
import torch import torch
import ignite import ignite
from ignite.engine import Events from ignite.engine import Events
...@@ -172,9 +173,13 @@ class TensorBoardLogger: ...@@ -172,9 +173,13 @@ class TensorBoardLogger:
trainer_engine.add_event_handler(Events.COMPLETED, self.on_completed) trainer_engine.add_event_handler(Events.COMPLETED, self.on_completed)
def start_server(self, port): def start_server(self, port):
cmd = r"tensorboard --host 127.0.0.1 --port {port} --logdir {dir}".format(port=port, dir=self.log_dir) #cmd = r"tensorboard --host 127.0.0.1 --port {port} --logdir {dir}".format(port=port, dir=self.log_dir)
print(cmd) #print(cmd)
os.popen(cmd) #os.popen(cmd)
cmd = r'tensorboard --host 127.0.0.1 --port {port} --logdir ""'.format(port=port).split(' ')
cmd[-1] = self.log_dir # can contain spaces
print(' '.join(cmd))
subprocess.Popen(cmd)
def on_completed(self, engine): def on_completed(self, engine):
self.writer.close() self.writer.close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment