Skip to main content
File added late

1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.

[!] This code is under development and mainly for my personal use. This project is for fast prototyping of deep learning and machine learning model with minimal code. Some parts of the code may not be well-commented or lack of citation.

Features

  • Writing minimal code to set up a new experiment
  • Pytorch or Tensorflow 2.0 or scikit-learn as backend with similar training flow
  • Efficiently log and analyze model results
  • Cross-platform GUI for monitoring experiments, either local or remote sever (Electron-based)

screenshot

See here for a list of implemented models

Installation

pip install dlex

Set up an experiment

Step 1: Folder structure

Experiment/
|-- model_configs
|-- model_outputs
|-- logs
|-- saved_models
|-- src
|   |-- datasets
|   |   |-- <dataset>.py
|   |-- models
|   |   |-- <model>.py
|-- README.md

Model parameters and outputs are saved to ./saved_models and ./model_outputs unless DLEX_SAVED_MODELS_PATH and DLEX_MODEL_OUTPUTS_PATH is specified

Step 2: Define dataset

  • Dataset Builder: handle downloading and preprocessing data. DatasetBuilder should be framework and config independent.
  • PytorchDataset, TensorflowDataset: handle loading dataset from the storage, shuffle, sort, batchify, etc. using concepts from each framework
from dlex.configs import AttrDict
from dlex.datasets.torch import PytorchDataset
from dlex.datasets.builder import DatasetBuilder

class SampleDatasetBuilder(DatasetBuilder):
    def __init__(self, params: AttrDict):
        super().__init__(params)
        
    def maybe_download_and_extract(self, force=False):
        super().maybe_download_and_extract(force)
        # Download dataset...
        # self.download_and_extract([some url], self.get_raw_data_dir())
            
    def maybe_preprocess(self, force=False):
        super().maybe_preprocess(force)
        # Preprocess data...
        
    def get_pytorch_wrapper(self, mode: str):
        return PytorchSampleDataset(self, mode)

class PytorchSampleDataset(PytorchDataset):
    def __init__(self, builder, mode):
        super().__init__(builder, mode)
        # Load data from preprocessed files...

Step 3: Construct model

Model supports loss calculation, training, predicting and outputting prediction to specified format.

from dlex.torch.models.base import BaseModel

class Model(BaseModel):
     def __init__(self, params, dataset):
        super().__init__(params, dataset)

    def infer(self, batch):
        ...

    def forward(self, batch):
        ...

    def loss(self, batch):
        ...

Step 4: Configuration

Model

Dataset

Train

  • batch_size: int or dict of { [progress]: [batch_size] } (0 as key must always be included)

  • num_epochs

  • optimizer: dict of name and optimizer's arguments. Support sgd, adam, adadelta.

Test

  • batch_size: int. Training batch size value is used if not specified.
model:
  name: {model import path}
  ...{model configs}
dataset:
  name: {dataset import path}
  ...{dataset configs}
train:
  batch_size: 256
  num_epochs: 30
  optimizer:
    name: adam
    learning_rate: 0.01
    weight_decay: 1e-5

Step 5: Train & evaluate

dlex train <config_path>
dlex evaluate <config_path>
dlex infer <config_path>

Environment Variables

  • DLEX_TMP_PATH (default: ~/tmp)
  • DLEX_DATASETS_PATH (default: ~/tmp/dlex/datasets)
  • DLEX_SAVED_MODELS_PATH (default: ./saved_models)

Using dlex

https://github.com/trungd/ml-graph: Implementations of machine learning algorithms for graph

Release files for dlex 0.0.2

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

File added late

1 file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release files before installing.

Source distribution (sdist)

Source distribution for dlex 0.0.2
File Size Uploaded
dlex-0.0.2.tar.gz 52.8 kB Details

Built distribution (wheel)

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

Total release size: 128.5 kB

Release files / dlex-0.0.2.tar.gz

Download URL dlex-0.0.2.tar.gz
Size 52.8 kB
Tags Source
SHA-256 checksum
How to use checksums
839bc4e63a15f3a0bf2c8b25ed067c744ddd56087d0c28d0278794e1ae9e03fb
BLAKE2b-256 checksum
How to use checksums
1f32881bdbfce2612d808bdeebee03b175e63ae743aded419dac63c9e003ce62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / dlex-0.0.2-py3-none-any.whl

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL dlex-0.0.2-py3-none-any.whl
Size 75.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48e6a68c7f1b52f6edbae856bea6f561b7405dcdf875c022fa4311f7e2e4d9dc
BLAKE2b-256 checksum
How to use checksums
46d0c035a0b7d4609d74f78785380dc718e4a9367d069deb9cc2b3641ea5566b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.8.0

Release history Release notifications | RSS feed

0.0.7

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

This release

0.0.2 This release

2 release files

0.0.1

1 release file

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