Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing optional packages to requirements/*.txt #450

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion pl_bolts/callbacks/vision/confused_logit.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import importlib

import torch
from pytorch_lightning import Callback
from torch import nn

from pl_bolts.utils.warnings import warn_missing_pkg

_MATPLOTLIB_AVAILABLE = importlib.util.find_spec("matplotlib") is not None
if _MATPLOTLIB_AVAILABLE:
from matplotlib import pyplot as plt
else:
warn_missing_pkg("matplotlib") # pragma: no-cover


class ConfusedLogitCallback(Callback): # pragma: no-cover
"""
Expand Down Expand Up @@ -93,7 +103,10 @@ def training_step(...):
pl_module.train()

def _plot(self, confusing_x, confusing_y, trainer, model, mask_idxs):
from matplotlib import pyplot as plt
if not _MATPLOTLIB_AVAILABLE:
raise ModuleNotFoundError( # pragma: no-cover
'You want to use `matplotlib` which is not installed yet, install it with `pip install matplotlib`.'
)

confusing_x = confusing_x[:self.top_k]
confusing_y = confusing_y[:self.top_k]
Expand Down
5 changes: 4 additions & 1 deletion requirements/loggers.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# test_tube>=0.7.5
# trains>=0.14.1
# trains>=0.14.1
matplotlib
wandb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grep wandb -rn pl_bolts

pl_bolts/callbacks/data_monitor.py:14:    import wandb
pl_bolts/callbacks/data_monitor.py:16:    wandb = None
pl_bolts/callbacks/data_monitor.py:91:                data={name: wandb.Histogram(tensor)}, commit=False,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, is wandb the only one supporting histograms? I think that it shall be logger agnostic...
anyway, lest move it among logger?
https://github.com/PyTorchLightning/pytorch-lightning-bolts/blob/master/requirements/loggers.txt

Copy link
Contributor Author

@akihironitta akihironitta Dec 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? so, shall we add wandb to requirements for now?

scipy