Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
Migrate off of tensorboardX (#488)
Browse files Browse the repository at this point in the history
Summary:
Tensorboard is now available in upstream PyTorch. Use that instead.
Pull Request resolved: #488

Reviewed By: mannatsingh

Differential Revision: D21178331

Pulled By: vreis

fbshipit-source-id: 9cd11382c64cc42764176ecb7f9307da2070a7fa
  • Loading branch information
vreis authored and facebook-github-bot committed Apr 23, 2020
1 parent 9a54c3b commit 64f14e3
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions classy_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ def configure_hooks(args, config):

if not args.skip_tensorboard:
try:
from tensorboardX import SummaryWriter
from torch.utils.tensorboard import SummaryWriter

tb_writer = SummaryWriter(log_dir=Path(base_folder) / "tensorboard")
hooks.append(TensorboardPlotHook(tb_writer))
except ImportError:
logging.warning("tensorboardX not installed, skipping tensorboard hooks")
logging.warning("tensorboard not installed, skipping tensorboard hooks")

args_dict = vars(args)
args_dict["config"] = config
Expand Down
2 changes: 1 addition & 1 deletion classy_vision/generic/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

try:
import visdom
from tensorboardX import SummaryWriter
from torch.utils.tensorboard import SummaryWriter
except ImportError:
pass

Expand Down
10 changes: 5 additions & 5 deletions classy_vision/hooks/model_tensorboard_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@


try:
from tensorboardX import SummaryWriter # noqa F401
from torch.utils.tensorboard import SummaryWriter # noqa F401

tbx_available = True
tb_available = True
except ImportError:
tbx_available = False
tb_available = False


@register_hook("model_tensorboard")
Expand All @@ -43,9 +43,9 @@ def __init__(self, tb_writer) -> None:
"""
super().__init__()
if not tbx_available:
if not tb_available:
raise RuntimeError(
"tensorboardX not installed, cannot use ModelTensorboardHook"
"tensorboard not installed, cannot use ModelTensorboardHook"
)

self.tb_writer = tb_writer
Expand Down
10 changes: 5 additions & 5 deletions classy_vision/hooks/tensorboard_plot_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@


try:
from tensorboardX import SummaryWriter # noqa F401
from torch.utils.tensorboard import SummaryWriter # noqa F401

tbx_available = True
tb_available = True
except ImportError:
tbx_available = False
tb_available = False


log = logging.getLogger()
Expand All @@ -45,9 +45,9 @@ def __init__(self, tb_writer, log_period: int = 10) -> None:
SummaryWriter>`_ instance
"""
super().__init__()
if not tbx_available:
if not tb_available:
raise RuntimeError(
"tensorboardX not installed, cannot use TensorboardPlotHook"
"tensorboard not installed, cannot use TensorboardPlotHook"
)
assert isinstance(log_period, int), "log_period must be an int"

Expand Down
2 changes: 1 addition & 1 deletion scripts/formatter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ then
fi

# run isort
cmd="isort -o classy_vision -o torchelastic -o visdom -o tensorboardX \
cmd="isort -o classy_vision -o torchelastic -o visdom \
-o progressbar $CHANGED_FILES"
echo "Running command \"$cmd\""
($cmd)
Expand Down
2 changes: 1 addition & 1 deletion test/manual/hooks_model_tensorboard_hook_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from classy_vision.hooks import ModelTensorboardHook
from classy_vision.models import build_model
from tensorboardX import SummaryWriter
from torch.utils.tensorboard import SummaryWriter


class TestModelTensorboardHook(HookTestBase):
Expand Down
2 changes: 1 addition & 1 deletion test/manual/hooks_tensorboard_plot_hook_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from classy_vision.optim.param_scheduler import UpdateInterval
from classy_vision.tasks import build_task
from classy_vision.trainer import LocalTrainer
from tensorboardX import SummaryWriter
from torch.utils.tensorboard import SummaryWriter


class TestTensorboardPlotHook(HookTestBase):
Expand Down
2 changes: 1 addition & 1 deletion tutorials/getting_started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
},
"outputs": [],
"source": [
"! pip install tensorboard tensorboardX"
"! pip install tensorboard"
]
},
{
Expand Down

0 comments on commit 64f14e3

Please sign in to comment.