Skip to content

Commit

Permalink
drop torchvision, tests only (#797)
Browse files Browse the repository at this point in the history
* drop torchvision, tests only

* manifest

* move test utils
  • Loading branch information
Borda committed Feb 11, 2020
1 parent 8fa802e commit af44583
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 42 deletions.
4 changes: 1 addition & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ exclude *.svg
recursive-include pytorch_lightning *.py

# include examples
recursive-include pl_examples *.py
recursive-include pl_examples *.md
recursive-include pl_examples *.sh
recursive-include pl_examples *.py *.md *.sh *.txt

# exclude tests from package
recursive-exclude tests *
Expand Down
1 change: 1 addition & 0 deletions pl_examples/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
torchvision>=0.4.0
12 changes: 0 additions & 12 deletions pytorch_lightning/testing/__init__.py

This file was deleted.

13 changes: 0 additions & 13 deletions pytorch_lightning/testing/model.py

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ scikit-learn>=0.20.2
tqdm>=4.35.0
numpy>=1.16.4
torch>=1.1
torchvision>=0.4.0, < 0.5 # the 0.5. has some issues with torch JIT
tensorboard>=1.14
future>=0.17.1 # required for builtins in setup.py

24 changes: 24 additions & 0 deletions tests/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Models for testing."""

import torch

from .base import LightningTestModelBase
from .mixins import (
LightningValidationStepMixin,
LightningValidationMixin,
LightningValidationStepMultipleDataloadersMixin,
LightningValidationMultipleDataloadersMixin,
LightningTestStepMixin,
LightningTestMixin,
LightningTestStepMultipleDataloadersMixin,
LightningTestMultipleDataloadersMixin,
)


class LightningTestModel(LightningValidationMixin, LightningTestMixin, LightningTestModelBase):
"""
Most common test case. Validation and test dataloaders.
"""

def on_training_metrics(self, logs):
logs['some_tensor_to_test'] = torch.rand(1)
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/utils.py → tests/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks import ModelCheckpoint
from pytorch_lightning.loggers import TestTubeLogger, TensorBoardLogger
from pytorch_lightning.testing import LightningTestModel
from tests.models import LightningTestModel

# generate a list of random seeds for each test
RANDOM_PORTS = list(np.random.randint(12000, 19000, 1000))
Expand Down
1 change: 1 addition & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
torchvision>=0.4.0, < 0.5 # the 0.5. has some issues with torch JIT
tox
coverage
codecov
Expand Down
4 changes: 2 additions & 2 deletions tests/test_amp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import pytest

import tests.utils as tutils
import tests.models.utils as tutils
from pytorch_lightning import Trainer
from pytorch_lightning.testing import (
from tests.models import (
LightningTestModel,
)
from pytorch_lightning.utilities.debugging import MisconfigurationException
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cpu_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import torch

import tests.utils as tutils
import tests.models.utils as tutils
from pytorch_lightning import Trainer, data_loader
from pytorch_lightning.callbacks import (
EarlyStopping,
)
from pytorch_lightning.testing import (
from tests.models import (
LightningTestModel,
LightningTestModelBase,
LightningTestMixin,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_gpu_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import pytest
import torch

import tests.utils as tutils
import tests.models.utils as tutils
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks import (
ModelCheckpoint,
)
from pytorch_lightning.core import memory
from pytorch_lightning.testing import (
from tests.models import (
LightningTestModel,
)
from pytorch_lightning.trainer.distrib_parts import (
Expand Down
4 changes: 2 additions & 2 deletions tests/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest
import torch

import tests.utils as tutils
import tests.models.utils as tutils
from pytorch_lightning import Trainer
from pytorch_lightning.loggers import (
LightningLoggerBase,
Expand All @@ -15,7 +15,7 @@
WandbLogger,
NeptuneLogger
)
from pytorch_lightning.testing import LightningTestModel
from tests.models import LightningTestModel


def test_testtube_logger(tmpdir):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_restore_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

import torch

import tests.utils as tutils
import tests.models.utils as tutils
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks import ModelCheckpoint
from pytorch_lightning.testing import LightningTestModel
from tests.models import LightningTestModel


def test_running_test_pretrained_model_ddp(tmpdir):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import pytest
import torch

import tests.utils as tutils
import tests.models.utils as tutils
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks import (
ModelCheckpoint,
)
from pytorch_lightning.testing import (
from tests.models import (
LightningTestModel,
LightningTestModelBase,
LightningValidationStepMixin,
Expand Down

0 comments on commit af44583

Please sign in to comment.