Skip to content

Commit 0895a41

Browse files
Merge pull request #64 from williamFalcon/cov
added test model to do also
2 parents 7812a13 + 8c41bfe commit 0895a41

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

.codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ comment:
4040
require_changes: false
4141
behavior: default # update if exists else create new
4242
# branches: *
43+
44+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ removed until windows install issues resolved.
1717
removed until codecov badge isn't empy. likely a config error showing nothing on master.
1818
[![codecov](https://codecov.io/gh/Borda/pytorch-lightning/branch/master/graph/badge.svg)](https://codecov.io/gh/Borda/pytorch-lightning)
1919
-->
20-
[![Coverage](https://github.com/williamFalcon/pytorch-lightning/blob/master/coverage.svg)](https://github.com/williamFalcon/pytorch-lightning/tree/master/tests#running-coverage)
20+
[![Coverage](https://github.com/williamFalcon/pytorch-lightning/blob/master/docs/source/_static/coverage.svg)](https://github.com/williamFalcon/pytorch-lightning/tree/master/tests#running-coverage)
2121
[![CodeFactor](https://www.codefactor.io/repository/github/borda/pytorch-lightning/badge)](https://www.codefactor.io/repository/github/borda/pytorch-lightning)
2222
[![ReadTheDocs](https://readthedocs.org/projects/pytorch-lightning/badge/?version=latest)](https://pytorch-lightning.readthedocs.io/en/latest)
2323
[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/williamFalcon/pytorch-lightning/blob/master/LICENSE)

coverage.svg renamed to docs/source/_static/coverage.svg

Lines changed: 2 additions & 2 deletions
Loading

pytorch_lightning/testing/lm_test_module.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,16 @@ def validation_step(self, data_batch, batch_i):
135135
val_acc = val_acc.unsqueeze(0)
136136

137137
# alternate possible outputs to test
138-
if self.trainer.batch_nb % 1 == 0:
138+
if batch_i % 1 == 0:
139139
output = OrderedDict({
140140
'val_loss': loss_val,
141141
'val_acc': val_acc,
142142
})
143143
return output
144-
if self.trainer.batch_nb % 2 == 0:
144+
if batch_i % 2 == 0:
145145
return val_acc
146146

147-
if self.trainer.batch_nb % 3 == 0:
147+
if batch_i % 3 == 0:
148148
output = OrderedDict({
149149
'val_loss': loss_val,
150150
'val_acc': val_acc,
@@ -232,7 +232,7 @@ def test_dataloader(self):
232232
return self.__dataloader(train=False)
233233

234234
@staticmethod
235-
def add_model_specific_args(parent_parser, root_dir):
235+
def add_model_specific_args(parent_parser, root_dir): # pragma: no cover
236236
"""
237237
Parameters you define here will be available to your model through self.hparams
238238
:param parent_parser:

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ exclude_lines =
3131
print(traceback.print_exc())
3232
return *
3333
raise Exception
34+
raise *
35+
except *
3436
warnings
3537
print
3638
raise RuntimeError
@@ -42,6 +44,7 @@ omit =
4244
pytorch_lightning/callbacks/pt_callbacks.py
4345
tests/test_models.py
4446
pytorch_lightning/testing_models/lm_test_module.py
47+
pytorch_lightning/utilities/arg_parse.py
4548

4649
[flake8]
4750
ignore = E731,W504,F401,F841

tests/test_models.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,10 +681,14 @@ def get_hparams(continue_training=False, hpc_exp_number=0):
681681
return hparams
682682

683683

684-
def get_model():
684+
def get_model(use_test_model=False):
685685
# set up model with these hyperparams
686686
hparams = get_hparams()
687-
model = LightningTemplateModel(hparams)
687+
688+
if use_test_model:
689+
model = LightningTestModel(hparams)
690+
else:
691+
model = LightningTemplateModel(hparams)
688692

689693
return model, hparams
690694

0 commit comments

Comments
 (0)