mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-22 13:30:11 +08:00
Minor imports cleaning (#402)
* code cleaning * drop unused imports * optimize imports
This commit is contained in:
committed by
William Falcon
parent
e6e325c853
commit
f18aee30a5
+15
-13
@@ -3,34 +3,30 @@ import shutil
|
||||
import warnings
|
||||
from argparse import Namespace
|
||||
|
||||
import pytest
|
||||
import numpy as np
|
||||
import pytest
|
||||
import torch
|
||||
|
||||
from pl_examples import LightningTemplateModel
|
||||
# sys.path += [os.path.abspath('..'), os.path.abspath('../..')]
|
||||
from pytorch_lightning import Trainer
|
||||
from pytorch_lightning.callbacks import (
|
||||
ModelCheckpoint,
|
||||
EarlyStopping,
|
||||
)
|
||||
from pytorch_lightning.logging import TestTubeLogger
|
||||
from pytorch_lightning.root_module import memory
|
||||
from pytorch_lightning.testing import (
|
||||
LightningTestModel,
|
||||
LightningTestModelBase,
|
||||
LightningValidationMixin,
|
||||
LightningValidationStepMixin,
|
||||
LightningValidationMultipleDataloadersMixin,
|
||||
LightningTestMixin,
|
||||
LightningTestMultipleDataloadersMixin,
|
||||
)
|
||||
from pytorch_lightning.callbacks import (
|
||||
ModelCheckpoint,
|
||||
EarlyStopping,
|
||||
GradientAccumulationScheduler,
|
||||
)
|
||||
from pytorch_lightning.utilities.debugging import MisconfigurationException
|
||||
from pytorch_lightning.root_module import memory
|
||||
from pytorch_lightning.root_module import model_saving
|
||||
from pytorch_lightning.trainer import trainer_io
|
||||
from pytorch_lightning.logging import TestTubeLogger
|
||||
from pl_examples import LightningTemplateModel
|
||||
from pytorch_lightning.trainer.logging_mixin import TrainerLoggingMixin
|
||||
|
||||
from pytorch_lightning.utilities.debugging import MisconfigurationException
|
||||
|
||||
# generate a list of random seeds for each test
|
||||
RANDOM_FILE_PATHS = list(np.random.randint(12000, 19000, 1000))
|
||||
@@ -325,8 +321,10 @@ def test_running_test_without_val():
|
||||
reset_seed()
|
||||
|
||||
"""Verify test() works on a model with no val_loader"""
|
||||
|
||||
class CurrentTestModel(LightningTestMixin, LightningTestModelBase):
|
||||
pass
|
||||
|
||||
hparams = get_hparams()
|
||||
model = CurrentTestModel(hparams)
|
||||
|
||||
@@ -634,6 +632,7 @@ def test_no_val_module():
|
||||
|
||||
class CurrentTestModel(LightningTestModelBase):
|
||||
pass
|
||||
|
||||
model = CurrentTestModel(hparams)
|
||||
|
||||
save_dir = init_save_dir()
|
||||
@@ -678,6 +677,7 @@ def test_no_val_end_module():
|
||||
|
||||
class CurrentTestModel(LightningValidationStepMixin, LightningTestModelBase):
|
||||
pass
|
||||
|
||||
hparams = get_hparams()
|
||||
model = CurrentTestModel(hparams)
|
||||
|
||||
@@ -1365,6 +1365,7 @@ def test_multiple_val_dataloader():
|
||||
LightningTestModelBase
|
||||
):
|
||||
pass
|
||||
|
||||
hparams = get_hparams()
|
||||
model = CurrentTestModel(hparams)
|
||||
|
||||
@@ -1402,6 +1403,7 @@ def test_multiple_test_dataloader():
|
||||
LightningTestModelBase
|
||||
):
|
||||
pass
|
||||
|
||||
hparams = get_hparams()
|
||||
model = CurrentTestModel(hparams)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user