GithubHelp home page GithubHelp logo

torch-lego's Introduction

torch-lego

Build pytorch modules using yaml description files. Yaml can be used to keep track of model architecture using tools such as Mlflow. This library supports convolution (1d, 2d and 3d) modules, transpose convolution (1d,2d,3d) modules and linear modules. Average and max pooling layers are also supported as well as fully connected layers. Batch/Layer/Instance norm, dropout and all built-in PyTorch activations are available. See the examples in the test directory for more detail.

Example

Deep convolutional classifier

The example given below is a simple MNIST classifier. LeakyReLU are used as activations. The negative slope value is not specfied so the default PyTorch value will be used. The same applies for all non-specified parameters. Max pooling is used and the input size is automatically computed using parameters from the preceeding convolution layer.

architecture:
  encoder:
    - conv:
        in_channels: 1
        out_channels: 36
        kernel_size: [3,3]
        stride: 1
        padding: 2
      mpool:
        kernel_size: [2,2]
      act:
        type: 'LeakyReLU'
        params:
    - conv:
        in_channels: 36
        out_channels: 100
        kernel_size: [3,3]
        stride: 1
        padding: 2
      mpool:
        kernel_size: [ 2,2 ]
      act:
        type: 'LeakyReLU'
        params:
      drpt: 0.5
  classifier:
    - in_features: 6400
    - out_features: 200
      act:
        type: 'ReLU'
        params:
      drpt: 0.4
    - out_features: 100
      act:
        type: 'ReLU'
        params:
      drpt: 0.4
    - out_features: 10
      act:
        type:
        params:
      drpt: 0.2

Installation and test

This is a python package that can be installed using pip after cloning the repository:

pip install -e torch_lego

All tests can be run by executing the all.sh script in the tests directory.

torch-lego's People

Contributors

ma3oun avatar

Stargazers

 avatar  avatar

Watchers

 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.