Giter VIP home page Giter VIP logo

torch-framework's Introduction

status pypi CI CD license code-style

LighTorch

A Pytorch and Lightning based framework for research and ml pipeline automation.

Framework

  1. $\text{Hyperparameter space}.$
  2. $\text{Genetic algorithms(single-objective/multi-objective)}$
  3. $\text{Best hyperparameters in config.yaml}$
  4. $\text{Training session}$

htuning.py

from lightorch.htuning.optuna import htuning
from ... import NormalModule
from ... import FourierVAE

def objective(trial) -> Dict[str, float]:
    ... # define hyperparameters
    return hyperparameters

if __name__ == '__main__':
    htuning(
        model_class = FourierVAE,
        hparam_objective = objective,
        datamodule = NormalModule,
        valid_metrics = [f"Training/{name}" for name in [
            "Pixel",
            "Perceptual",
            "Style",
            "Total variance",
            "KL Divergence"]],
        directions = ['minimize', 'minimize', 'minimize', 'minimize', 'minimize'],
        precision = 'medium',
        n_trials = 150,
    )

exec: python3 -m htuning

config.yaml

trainer: # trainer arguments
  logger: true 
  enable_checkpointing: true
  max_epochs: 250
  accelerator: cuda
  devices:  1
  precision: 32
  
model:
  class_path: utils.FourierVAE #model relative path
  dict_kwargs: #**hparams
    encoder_lr: 2e-2
    encoder_wd: 0
    decoder_lr: 1e-2
    decoder_wd: 0
    alpha:
      - 0.02
      - 0.003
      - 0.003
      - 0.01
    beta: 0.00001
    optimizer: adam

data: # Dataset arguments
  class_path: data.DataModule
  init_args:
    type_dataset: mnist 
    batch_size: 12
    pin_memory: true
    num_workers: 8

training.py

from lightorch.training.cli import trainer

if __name__ == '__main__':
    trainer()

exec: python3 -m training -c config.yaml

Features

  • Built in Module class for:
    • Adversarial training.
    • Supervised, Self-supervised training.
  • Multi-Objective and Single-Objective optimization and Hyperparameter tuning with optuna.

Modules

  • Fourier Convolution.
  • Fourier Deconvolution.
  • Partial Convolution. (Optimized implementation)
  • Grouped Query Attention, Multi Query Attention, Multi Head Attention. (Interpretative usage) (with flash-attention option)
  • Self Attention, Cross Attention.
  • Normalization methods.
  • Positional encoding methods.
  • Embedding methods.
  • Useful criterions.
  • Useful utilities.
  • Built-in Default Feed Forward Networks.
  • Adaptation for $\mathbb{C}$ modules.
  • Interpretative Deep Neural Networks.
  • Monte Carlo forward methods.

Contact

Citation

@misc{lightorch,
  author = {Jorge Enciso},
  title = {LighTorch: Automated Deep Learning framework for researchers},
  howpublished = {\url{https://github.com/Jorgedavyd/LighTorch}},
  year = {2024}
}

torch-framework's People

Contributors

jorgedavyd avatar

Stargazers

 avatar Edgar Martinez avatar  avatar

Watchers

Edgar Martinez avatar Kostas Georgiou avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.