Skip to content
This repository has been archived by the owner on Jun 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #121 from justusschock/parallel_master
Browse files Browse the repository at this point in the history
Add trainer refactoring into master
  • Loading branch information
justusschock committed Jun 5, 2019
2 parents 0313cca + 69080a8 commit f7ae91b
Show file tree
Hide file tree
Showing 109 changed files with 4,471 additions and 3,018 deletions.
111 changes: 53 additions & 58 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,69 @@
language: python

services:
- docker

matrix:
include:
- name: "Unittests Python 3.5"
python: 3.5
dist: xenial
env:
- TEST_TYPE="unittests"
- name: "Unittests Python 3.6"
python: 3.6
dist: xenial
env:
- TEST_TYPE="unittests"
- name: "Unittests Python 3.7"
python: 3.7
dist: xenial
env:
- TEST_TYPE="unittests"
- name: "Static Style Checks"
python: 3.7
dist: xenial
env:
- TEST_TYPE="style-check"
include:
- name: "Unittests Python 3.5"
python: 3.5
dist: xenial
env:
- TEST_TYPE="unittests"
- name: "Unittests Python 3.6"
python: 3.6
dist: xenial
env:
- TEST_TYPE="unittests"
- name: "Unittests Python 3.7"
python: 3.7
dist: xenial
env:
- TEST_TYPE="unittests"
- name: "Static Style Checks"
python: 3.7
dist: xenial
env:
- TEST_TYPE="style-check"

# command to install dependencies
before_install:
- if [[ "$TEST_TYPE" == "unittests" ]]; then
bash scripts/ci/install_before_tests.sh;
else
bash scripts/ci/install_before_style_check.sh;
fi
- if [[ "$TEST_TYPE" == "unittests" ]]; then
bash scripts/ci/install_before_tests.sh;
else
bash scripts/ci/install_before_style_check.sh;
fi

install:
- pip install --no-deps .
- pip install --no-deps .

# command to run tests
script:
# run tests or stylechecks
- if [[ "$TEST_TYPE" == "unittests" ]]; then
bash scripts/ci/run_tests.sh;

# build docs if python == 3.7
if [[ "$TRAVIS_PYTHON_VERSION" == "3.7" ]]; then
bash scripts/ci/build_docs.sh;
# run tests or stylechecks
- if [[ "$TEST_TYPE" == "unittests" ]]; then
bash scripts/ci/run_tests.sh;
else
bash scripts/ci/run_style_checks.sh;
fi

# build docs if python == 3.7
- if [[ "$TRAVIS_PYTHON_VERSION" == 3.7 ]] && [[ "$TEST_TYPE" == "unittests" ]]; then
bash scripts/ci/build_docs.sh;
fi

else
bash scripts/ci/install_before_style_check.sh;
fi

before_deploy:
- cd $TRAVIS_BUILD_DIR
- cd $TRAVIS_BUILD_DIR

deploy:
- provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard, marked secure
keep-history: true
on:
branch: master
condition: "$TRAVIS_PYTHON_VERSION = 3.7" && "$TEST_TYPE" = "unittests"
local_dir: docs/_build/html
- provider: pypi
user: $PYPI_USERNAME
password: $PYPI_PASSWORD
on:
tags: true
distributions: "sdist bdist_wheel"
skip_existing: true

- provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard, marked secure
keep-history: true
on:
branch: master
condition: $TRAVIS_PYTHON_VERSION = 3.7 AND $TEST_TYPE = unittests
local_dir: docs/_build/html
- provider: pypi
user: $PYPI_USERNAME
password: $PYPI_PASSWORD
on:
tags: true
distributions: "sdist bdist_wheel"
skip_existing: true
15 changes: 5 additions & 10 deletions delira/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
__version__ = '0.3.3'

# from .models import AbstractNetwork
# from .logging import TrixiHandler, MultiStreamHandler
# from .data_loading import BaseCacheDataset, BaseLazyDataset, BaseDataManager, \
# RandomSampler, SequentialSampler
import json
import os
import warnings
Expand Down Expand Up @@ -69,14 +65,13 @@ def get_backends():
"""
Return List of currently available backends
Returns
-------
list
list of strings containing the currently installed backends
"""

if not __BACKENDS:
_determine_backends()
return __BACKENDS


# if "TORCH" in get_backends():
# from .io import torch_load_checkpoint, torch_save_checkpoint
# from .models import AbstractPyTorchNetwork
# from .data_loading import TorchvisionClassificationDataset
5 changes: 2 additions & 3 deletions delira/data_loading/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

from delira import get_backends
from .data_loader import BaseDataLoader
from .data_manager import BaseDataManager
from .dataset import AbstractDataset, BaseCacheDataset, BaseLazyDataset, \
ConcatDataset, BaseExtendCacheDataset
ConcatDataset, BaseExtendCacheDataset
from .load_utils import default_load_fn_2d, LoadSample, LoadSampleLabel
from .sampler import LambdaSampler, \
WeightedRandomSampler, \
Expand All @@ -12,7 +13,5 @@
SequentialSampler
from .sampler import __all__ as __all_sampling

from delira import get_backends

if "TORCH" in get_backends():
from .dataset import TorchvisionClassificationDataset
4 changes: 2 additions & 2 deletions delira/data_loading/data_loader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
from batchgenerators.dataloading.data_loader import SlimDataLoaderBase
from multiprocessing import Pool

from .dataset import AbstractDataset
from .sampler import AbstractSampler, SequentialSampler

Expand All @@ -10,6 +10,7 @@ class BaseDataLoader(SlimDataLoaderBase):
Class to create a data batch out of data samples
"""

def __init__(self, dataset: AbstractDataset,
batch_size=1, num_batches=None, seed=1,
sampler=None):
Expand Down Expand Up @@ -118,4 +119,3 @@ def _get_sample(self, index):
Returned Data
"""
return self._data[index]

0 comments on commit f7ae91b

Please sign in to comment.