mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-09 11:32:07 +08:00
drop torchvision, tests only (#797)
* drop torchvision, tests only * manifest * move test utils
This commit is contained in:
+1
-3
@@ -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 *
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
torchvision>=0.4.0
|
||||
@@ -1,12 +0,0 @@
|
||||
from .model import LightningTestModel
|
||||
from .model_base import LightningTestModelBase
|
||||
from .model_mixins import (
|
||||
LightningValidationStepMixin,
|
||||
LightningValidationMixin,
|
||||
LightningValidationStepMultipleDataloadersMixin,
|
||||
LightningValidationMultipleDataloadersMixin,
|
||||
LightningTestStepMixin,
|
||||
LightningTestMixin,
|
||||
LightningTestStepMultipleDataloadersMixin,
|
||||
LightningTestMultipleDataloadersMixin,
|
||||
)
|
||||
@@ -1,13 +0,0 @@
|
||||
import torch
|
||||
|
||||
from .model_base import LightningTestModelBase
|
||||
from .model_mixins import LightningValidationMixin, LightningTestMixin
|
||||
|
||||
|
||||
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)
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -9,7 +9,7 @@ from pl_examples import LightningTemplateModel
|
||||
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))
|
||||
@@ -1,3 +1,4 @@
|
||||
torchvision>=0.4.0, < 0.5 # the 0.5. has some issues with torch JIT
|
||||
tox
|
||||
coverage
|
||||
codecov
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@ import os
|
||||
|
||||
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
|
||||
|
||||
@@ -2,12 +2,12 @@ import warnings
|
||||
|
||||
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,
|
||||
|
||||
@@ -3,13 +3,13 @@ import os
|
||||
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 (
|
||||
|
||||
@@ -4,7 +4,7 @@ import pickle
|
||||
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,
|
||||
@@ -15,7 +15,7 @@ from pytorch_lightning.loggers import (
|
||||
WandbLogger,
|
||||
NeptuneLogger
|
||||
)
|
||||
from pytorch_lightning.testing import LightningTestModel
|
||||
from tests.models import LightningTestModel
|
||||
|
||||
|
||||
def test_testtube_logger(tmpdir):
|
||||
|
||||
@@ -3,10 +3,10 @@ import os
|
||||
|
||||
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):
|
||||
|
||||
@@ -3,12 +3,12 @@ import os
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user