Skip to main content

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.

Metadata

Release files for dlengine 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dlengine 0.1.0
File Size Uploaded
dlengine-0.1.0.tar.gz 43.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dlengine 0.1.0
File Interpreter ABI Platform
dlengine-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 97.0 kB

Release files / dlengine-0.1.0.tar.gz

Download URL dlengine-0.1.0.tar.gz
Size 43.6 kB
Tags Source
SHA-256 checksum
How to use checksums
10520a82e0a5c5ebc602fc3491af29dfb82ee247fe8005123834812bedbde9a1
BLAKE2b-256 checksum
How to use checksums
e720cb4d7b3b8fd7389dc94b586b73d7fd1a2cc30066c28d50147ef64738bb49
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / dlengine-0.1.0-py3-none-any.whl

Download URL dlengine-0.1.0-py3-none-any.whl
Size 53.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1efe479e815adb6f1a52f09962ab12e92213a7c06b6c2f574c91a9753960dcb
BLAKE2b-256 checksum
How to use checksums
93b218352d13a23ce4689d7950de61970eb6e3f12a01fc673069e83dd11a6ec7
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page