mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-09 11:32:07 +08:00
pkg relative imports
* split requirements.txt * pytest verbose
This commit is contained in:
+1
-1
@@ -16,4 +16,4 @@ formats: all
|
||||
python:
|
||||
version: 3.7
|
||||
install:
|
||||
- requirements: docs/doc_requirements.txt
|
||||
- requirements: docs/requirements.txt
|
||||
+2
-1
@@ -6,6 +6,7 @@ cache: pip
|
||||
install:
|
||||
- pip install -e .
|
||||
- pip install -r requirements.txt
|
||||
- pip install -r tests/requirements.txt
|
||||
- pip install -U numpy
|
||||
|
||||
# keep build from timing out
|
||||
@@ -13,4 +14,4 @@ dist: xenial
|
||||
|
||||
# command to run tests
|
||||
script:
|
||||
- py.test # or py.test for Python versions 3.5 and below
|
||||
- py.test -v # or py.test for Python versions 3.5 and below
|
||||
@@ -1 +1,2 @@
|
||||
mkdocs-material==4.4.0
|
||||
mkdocs==1.0.4
|
||||
@@ -14,17 +14,7 @@ SEED = 2334
|
||||
torch.manual_seed(SEED)
|
||||
np.random.seed(SEED)
|
||||
|
||||
# ---------------------
|
||||
# DEFINE MODEL HERE
|
||||
# ---------------------
|
||||
from lightning_module_template import LightningTemplateModel
|
||||
# ---------------------
|
||||
|
||||
"""
|
||||
Allows training by using command line arguments
|
||||
Run by:
|
||||
# TYPE YOUR RUN COMMAND HERE
|
||||
"""
|
||||
from .lightning_module_template import LightningTemplateModel
|
||||
|
||||
|
||||
def main_local(hparams):
|
||||
|
||||
@@ -13,7 +13,7 @@ SEED = 2334
|
||||
torch.manual_seed(SEED)
|
||||
np.random.seed(SEED)
|
||||
|
||||
from lightning_module_template import LightningTemplateModel
|
||||
from .lightning_module_template import LightningTemplateModel
|
||||
|
||||
|
||||
def main(hparams):
|
||||
|
||||
@@ -13,7 +13,7 @@ SEED = 2334
|
||||
torch.manual_seed(SEED)
|
||||
np.random.seed(SEED)
|
||||
|
||||
from lightning_module_template import LightningTemplateModel
|
||||
from .lightning_module_template import LightningTemplateModel
|
||||
|
||||
|
||||
def main(hparams):
|
||||
|
||||
@@ -13,7 +13,7 @@ SEED = 2334
|
||||
torch.manual_seed(SEED)
|
||||
np.random.seed(SEED)
|
||||
|
||||
from lightning_module_template import LightningTemplateModel
|
||||
from .lightning_module_template import LightningTemplateModel
|
||||
|
||||
|
||||
def main(hparams):
|
||||
|
||||
@@ -13,7 +13,7 @@ SEED = 2334
|
||||
torch.manual_seed(SEED)
|
||||
np.random.seed(SEED)
|
||||
|
||||
from lightning_module_template import LightningTemplateModel
|
||||
from .lightning_module_template import LightningTemplateModel
|
||||
|
||||
|
||||
def main(hparams):
|
||||
|
||||
@@ -5,7 +5,8 @@ from test_tube import HyperOptArgumentParser, Experiment
|
||||
from pytorch_lightning.models.trainer import Trainer
|
||||
from pytorch_lightning.utilities.arg_parse import add_default_args
|
||||
from pytorch_lightning.callbacks.pt_callbacks import EarlyStopping, ModelCheckpoint
|
||||
from lightning_module_template import LightningTemplateModel
|
||||
|
||||
from .lightning_module_template import LightningTemplateModel
|
||||
|
||||
|
||||
def main(hparams):
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import numpy as np
|
||||
import os
|
||||
import shutil
|
||||
from pytorch_lightning.pt_overrides.override_data_parallel import LightningDistributedDataParallel
|
||||
|
||||
import numpy as np
|
||||
|
||||
from ..pt_overrides.override_data_parallel import LightningDistributedDataParallel
|
||||
|
||||
|
||||
class Callback(object):
|
||||
@@ -261,4 +263,3 @@ if __name__ == '__main__':
|
||||
print(loss)
|
||||
if should_stop:
|
||||
break
|
||||
|
||||
|
||||
@@ -8,17 +8,17 @@ import os
|
||||
import pdb
|
||||
import re
|
||||
|
||||
import numpy as np
|
||||
import tqdm
|
||||
import torch
|
||||
from torch.utils.data.distributed import DistributedSampler
|
||||
import torch.multiprocessing as mp
|
||||
import torch.distributed as dist
|
||||
import numpy as np
|
||||
import tqdm
|
||||
|
||||
from pytorch_lightning.root_module.memory import get_gpu_memory_map
|
||||
from pytorch_lightning.root_module.model_saving import TrainerIO
|
||||
from pytorch_lightning.pt_overrides.override_data_parallel import LightningDistributedDataParallel, LightningDataParallel
|
||||
from pytorch_lightning.utilities.debugging import MisconfigurationException
|
||||
from ..root_module.memory import get_gpu_memory_map
|
||||
from ..root_module.model_saving import TrainerIO
|
||||
from ..pt_overrides.override_data_parallel import LightningDistributedDataParallel, LightningDataParallel
|
||||
from ..utilities.debugging import MisconfigurationException
|
||||
|
||||
try:
|
||||
from apex import amp
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
from torch import nn
|
||||
|
||||
"""
|
||||
Module to describe gradients
|
||||
"""
|
||||
|
||||
from torch import nn
|
||||
|
||||
class GradInformation(nn.Module):
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import torch
|
||||
import gc
|
||||
import subprocess
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
|
||||
'''
|
||||
Generates a summary of a model's layers and dimensionality
|
||||
'''
|
||||
|
||||
import gc
|
||||
|
||||
import torch
|
||||
import subprocess
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
|
||||
class ModelSummary(object):
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import torch
|
||||
import os
|
||||
import re
|
||||
from pytorch_lightning.pt_overrides.override_data_parallel import LightningDistributedDataParallel, LightningDataParallel
|
||||
|
||||
import torch
|
||||
|
||||
from ..pt_overrides.override_data_parallel import LightningDistributedDataParallel, LightningDataParallel
|
||||
|
||||
|
||||
class ModelIO(object):
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import torch
|
||||
from pytorch_lightning.root_module.memory import ModelSummary
|
||||
from pytorch_lightning.root_module.grads import GradInformation
|
||||
from pytorch_lightning.root_module.model_saving import ModelIO, load_hparams_from_tags_csv
|
||||
from pytorch_lightning.root_module.hooks import ModelHooks
|
||||
from pytorch_lightning.root_module.decorators import data_loader
|
||||
|
||||
from .memory import ModelSummary
|
||||
from .grads import GradInformation
|
||||
from .model_saving import ModelIO, load_hparams_from_tags_csv
|
||||
from .hooks import ModelHooks
|
||||
from .decorators import data_loader
|
||||
|
||||
|
||||
class LightningModule(GradInformation, ModelIO, ModelHooks):
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import os
|
||||
from collections import OrderedDict
|
||||
import torch.nn as nn
|
||||
from torchvision.datasets import MNIST
|
||||
import torchvision.transforms as transforms
|
||||
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
import torch.nn.functional as F
|
||||
from test_tube import HyperOptArgumentParser
|
||||
from torch import optim
|
||||
from torch.utils.data import DataLoader
|
||||
from torch.utils.data.distributed import DistributedSampler
|
||||
from torchvision.datasets import MNIST
|
||||
from torchvision import transforms
|
||||
from test_tube import HyperOptArgumentParser
|
||||
|
||||
from pytorch_lightning.root_module.root_module import LightningModule
|
||||
import pytorch_lightning as ptl
|
||||
from ..root_module.root_module import LightningModule
|
||||
from pytorch_lightning import data_loader
|
||||
|
||||
|
||||
class LightningTestModel(LightningModule):
|
||||
@@ -214,15 +215,15 @@ class LightningTestModel(LightningModule):
|
||||
|
||||
return loader
|
||||
|
||||
@ptl.data_loader
|
||||
@data_loader
|
||||
def tng_dataloader(self):
|
||||
return self.__dataloader(train=True)
|
||||
|
||||
@ptl.data_loader
|
||||
@data_loader
|
||||
def val_dataloader(self):
|
||||
return self.__dataloader(train=False)
|
||||
|
||||
@ptl.data_loader
|
||||
@data_loader
|
||||
def test_dataloader(self):
|
||||
return self.__dataloader(train=False)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import pdb
|
||||
|
||||
|
||||
def add_default_args(parser, root_dir, rand_seed=None, possible_model_names=None):
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import pdb
|
||||
import sys
|
||||
|
||||
|
||||
class MisconfigurationException(Exception):
|
||||
pass
|
||||
pass
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
coverage==4.5.3
|
||||
mkdocs==1.0.4
|
||||
pytest==5.0.1
|
||||
scikit-learn==0.20.2
|
||||
tqdm==4.32.1
|
||||
twine==1.13.0
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
coverage==4.5.3
|
||||
pytest==5.0.1
|
||||
Reference in New Issue
Block a user