GithubHelp home page GithubHelp logo

isabella232 / hydra-torch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pytorch/hydra-torch

0.0 0.0 0.0 11.17 MB

Configuration classes enabling type-safe PyTorch configuration for Hydra apps

License: MIT License

Python 100.00%

hydra-torch's Introduction

hydra-torch

Configuration classes enabling type-safe PyTorch configuration for Hydra apps.
This repo is work in progress.

The config dataclasses are generated using configen, check it out if you want to generate config dataclasses for your own project.

Install:

# For now, please obtain through github. Soon, versioned (per-project) dists will be on PyPI.
pip install git+https://github.com/pytorch/hydra-torch

Example config:

Here is one of many configs available. Notice it uses the defaults defined in the torch function signatures:

@dataclass
class TripletMarginLossConf:
    _target_: str = "torch.nn.modules.loss.TripletMarginLoss"
    margin: float = 1.0
    p: float = 2.0
    eps: float = 1e-06
    swap: bool = False
    size_average: Any = None
    reduce: Any = None
    reduction: str = "mean"

Importing Convention:

from hydra_configs.<package_name>.path.to.module import <ClassName>Conf

where <package_name> is the package being configured and path.to.module is the path in the original package.

Inferring where the package is located is as simple as prepending hydra_configs. and postpending Conf to the original class import: e.g.

#module to be configured
from torch.optim.adam import Adam

#config for the module
from hydra_configs.torch.optim.adam import AdamConf

Getting Started:

Take a look at our tutorial series:

  1. Basic Tutorial
  2. Intermediate Tutorial (coming soon)
  3. Advanced Tutorial (coming soon)

Other Config Projects:

A list of projects following the hydra_configs convention (please notify us if you have one!):

Pytorch Lightning

License

hydra-torch is licensed under MIT License.

hydra-torch's People

Contributors

omry avatar romesco 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.