Skip to main content

dlengine is a trainning engine targeting to separating miscellaneous trainning things from modeling.

Project description

Introduction

dlengine is a trainning engine targeting to separating miscellaneous trainning things from modeling.

With dlengine, you can focuse on building model. dlengine takes care of logging, model saving and restoring, very efficient multi-gpu training for you.

dlengine contains features:

  • very efficient multi-gpu training based on DistributedDataParallel
  • automatic logging
  • automatic model saving and restoring

Usage

step 1. inheriting from DefaultTrainer,overwrite neccesary methods build_model, build_optimizer, build_lr_scheduler, build_train_loader, build_test_loader, build_evaluator.

from dlengine.defaults import DefaultTrainer

class Trainer(DefaultTrainer):
    def __init__(self, args):
        super(Trainer, self).__init__(args, args.output_dir, "classifier", args.num_epoch, args.log_every_n_epoch)

    @classmethod
    def build_model(cls, args):
        pass

    @classmethod
    def build_optimizer(cls, args, model):
        pass

    @classmethod
    def build_lr_scheduler(cls, args, end_iter, optimizer):
        pass

    @classmethod
    def build_train_loader(cls, args):
        pass

    @classmethod
    def build_test_loader(cls, args):
        pass

    @classmethod
    def build_evaluator(cls, args):
        pass

step 2. call lanuchfunction to start training

from dlengine.launch import launch
from dlengine.defaults import default_setup
def main(args):
    default_setup(args.output_dir, "classifier", args)
    trainer = Trainer(args)
    return trainer.train()


if __name__ == "__main__":
    args = parser.parse_args()
    launch(
        main,
        num_gpus_per_machine=args.num_gpu,
        dist_url="tcp://127.0.0.1:28662",
        num_machines=1,
        machine_rank=0,
        args=(args,))

Installation

  1. install package dependencies: pytorch and termcolor.

  2. pip install dlengine

LICENSE

Copyright (c) 2021 The Python Packaging Authority

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dlengine-0.1.0.tar.gz (43.6 kB view details)

Uploaded Source

Built Distribution

dlengine-0.1.0-py3-none-any.whl (53.4 kB view details)

Uploaded Python 3

File details

Details for the file dlengine-0.1.0.tar.gz.

File metadata

  • Download URL: dlengine-0.1.0.tar.gz
  • Upload date:
  • Size: 43.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.2

File hashes

Hashes for dlengine-0.1.0.tar.gz
Algorithm Hash digest
SHA256 10520a82e0a5c5ebc602fc3491af29dfb82ee247fe8005123834812bedbde9a1
MD5 e3fca5e964b1bfe146f990adde0ab682
BLAKE2b-256 e720cb4d7b3b8fd7389dc94b586b73d7fd1a2cc30066c28d50147ef64738bb49

See more details on using hashes here.

File details

Details for the file dlengine-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dlengine-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 53.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.2

File hashes

Hashes for dlengine-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1efe479e815adb6f1a52f09962ab12e92213a7c06b6c2f574c91a9753960dcb
MD5 287f2b2f742778fce8fdd006a8e2f37a
BLAKE2b-256 93b218352d13a23ce4689d7950de61970eb6e3f12a01fc673069e83dd11a6ec7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page