Giter Club home page Giter Club logo

nn-template's Introduction

NN Template

CI CI Docs Release Code style: black

"We demand rigidly defined areas of doubt and uncertainty."

Generic template to bootstrap your PyTorch project, read more in the documentation.

asciicast

Get started

If you already know cookiecutter, just generate your project with:

cookiecutter https://github.com/grok-ai/nn-template
Otherwise Cookiecutter manages the setup stages and delivers to you a personalized ready to run project.

Install it with:

pip install cookiecutter

More details in the documentation.

Strengths

  • Actually works for research!
  • Guided setup to customize project bootstrapping;
  • Fast prototyping of new ideas, no need to build a new code base from scratch;
  • Less boilerplate with no impact on the learning curve (as long as you know the integrated tools);
  • Ensure experiments reproducibility;
  • Automatize via GitHub actions: testing, stylish documentation deploy, PyPi upload;
  • Enforce Python best practices;
  • Many more in the documentation;

Integrations

Avoid writing boilerplate code to integrate:

  • PyTorch Lightning, lightweight PyTorch wrapper for high-performance AI research.
  • Hydra, a framework for elegantly configuring complex applications.
  • Hugging Face Datasets,a library for easily accessing and sharing datasets.
  • Weights and Biases, organize and analyze machine learning experiments. (educational account available)
  • Streamlit, turns data scripts into shareable web apps in minutes.
  • MkDocs and Material for MkDocs, a fast, simple and downright gorgeous static site generator.
  • DVC, track large files, directories, or ML models. Think "Git for data".
  • GitHub Actions, to run the tests, publish the documentation and to PyPI automatically.
  • Python best practices for developing and publishing research projects.

Maintainers

nn-template's People

Contributors

crisostomi avatar flegyas avatar leonardoemili avatar lorenzo-delsignore avatar lucmos avatar mikcnt avatar rtaiello avatar valahaar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nn-template's Issues

Curious if you checked out DAGsHub

Hi @lucmos, this looks like an awesome repo. I stumbled on it while doing some research on project templates for ML projects. I'm one of the creators of DAGsHub which is a platform built on Git, DVC, and MLflow. It integrates with GitHub and provides a free DVC remote and MLflow server so that you can track experiments and share your data & models in one UI.

Here's an example project to showcase the abilities:
https://dagshub.com/OperationSavta/SavtaDepth

It seems really in line with what you're creating here, and I would love to hear your thoughts about it.

Update LightningDataModule example usage

I believe L217 in datamodule.py should be changed from

_: pl.LightningDataModule = hydra.utils.instantiate(cfg.data.datamodule, _recursive_=False)

to

_: pl.LightningDataModule = hydra.utils.instantiate(cfg.nn.data, _recursive_=False)

Thanks for the great project, keep up with the good work! @lucmos

load_model

Hi,
This issue concerns the function from nn_core.serialization import load_model
Suppose i train a pytorch model with class MyLightningModule, and that I saved the checkpoint in model_path.
Suppose now that the class MyLightningModule has received some minor changes, like a new class variable has been added.
Let's call this version MyLightningModuleV2.
When I load a model using this function, like:

self.model = load_model(module_class=MyLightningModuleOld, checkpoint_path=Path(model_path), map_location=self.device).to(self.device).eval()

I get an error because the chekpoint refers to the model of class MyLightningModule and therefore the new variable is (obviously) missing.
To make it work, i need to load the model with the old version of the class, that is, MyLightningModule, and then manually setting "model.new_variable" to the value i want to get, like the following:

self.model = load_model(module_class=MyLightningModuleOld, checkpoint_path=Path(model_path), map_location=self.device).to(self.device).eval()
self.model.new_variable = False

It would be nice to have this option in the load_model function to avoid creating multiple versions of the same class.

PyTorch Lightning EcoCI integration to check for compatibility with latest & upcoming releases

Hey Valentino & Luca,

I am just catching up with some bookmarks and remembered your repo here :). As someone who constantly fuzzes about the ideal project structure, that's actually pretty cool. I have been using an adapted version of the data science cookiecutter for generic ML projects, but nothing sophisticated like this here with code stubs.

Haven't thoroughly played with it yet, though, besides creating an example folder and looking at the pl_module.py and datamodule.py files, which look good to me!

In any case, long story short, I was wondering if you'd be interested in the PyTorch Lightning's ecosystem CI to make sure that it stays fresh and relevant wrt to upcoming version releases (comes with free CPU and multi-GPU CI tests): https://devblog.pytorchlightning.ai/stay-ahead-of-breaking-changes-with-the-new-lightning-ecosystem-ci-b7e1cf78a6c7

If you are interested in that, I am sure my colleague @Borda would be happy to assist with questions & technical details -- he built this thing, so he probably knows best :)

Streamlit UI - Weights and Biases login

The template is really awesome.

I had a small issue. When I run the Streamlit UI without being logged in in Weights and Biases. The UI just hanged with the loading status without giving me any feedback about what was happening, so that I have to log in first in wandb.
I had to login manually from the console. Is there any way to solve this issue? For example to have feedback from the UI if I'm not logged in.

Thanks!

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.