Skip to content

Commit

Permalink
Add missing optional packages to requirements/*.txt (Lightning-Univ…
Browse files Browse the repository at this point in the history
…erse#450)

* Import matplotlib at the top

* Add missing optional packages

* Update wandb

* Add mypy to requirements
  • Loading branch information
akihironitta authored and Christoph Clement committed Dec 16, 2020
1 parent 78c4d00 commit 77ed92e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
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
scipy
1 change: 1 addition & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ check-manifest
twine==1.13.0
isort>=5.6.4
pre-commit>=1.0
mypy

atari-py==0.2.6 # needed for RL

0 comments on commit 77ed92e

Please sign in to comment.