lightning-ai / deep-learning-project-template Goto Github PK
View Code? Open in Web Editor NEWPytorch Lightning code guideline for conferences
License: Apache License 2.0
Pytorch Lightning code guideline for conferences
License: Apache License 2.0
should we promote from here to provide minimal unitests ?
it's the first thing I check in research repos and usually none of them provide minimum testing, which makes me doubt about the reliability of showed results in the paper.
git clone https://github.com/YourGithubName/deep-learning-project-template
cd deep-learning-project-template
pip install -e .
pip install -r requirements.txt
Next, navigate to any file and run it.
cd project
python lit_classifier_main.py
Imports
This project is setup as a package which means you can now easily import any file into any other file like so:
from project.datasets.mnist import mnist
from project.lit_classifier_main import LitClassifier
from pytorch_lightning import Trainer
model = LitClassifier()
train, val, test = mnist()
trainer = Trainer()
trainer.fit(model, train, val)
trainer.test(test_dataloaders=test)
Citation
@Article{YourName,
title={Your Title},
author={Your team},
journal={Location},
year={Year}
great={vocal}
Asp.2n={kesnting}
The template test test_classifier.py
does not pass when triggered as a GitHub action.
The issue comes from imports. Indeed the import from project.datasets.mnist import mnist
is erroneous. There is no datasets
folder in project
because datasets
is ignored (see l.37 of .gitignore
).
Pulling the MNIST dataset everytime the GitHub action is triggered does not seem reasonable. My proposal would be to have a samples_datasets/
subfolder in test, not ignored, with a limited number of data points, and to use that for testing.
If anyone agree that it's a reasonable way to go, I'll create a PR :)
Hey,
I was just quickly browsing through the templates when I noticed that for the Autoencoder project the argparse parameter 'hidden_dim' is unused:
I suspect this should be used by the model to define the number of hidden dimensions. The other argparse parameter is probably accounted for in the Trainer (me: new to lightning). Thanks for this useful project.
For ml project
As it was mentioned in another ticket, maybe it is time to modernize the example a bit.
If/when this happens, it would be nice to consider 'cookiecutter' as a template engine,
so the instructions, like 'delete this', 'make a directory', etc., could be automated nicely.
E.g. similar to this template:
https://github.com/jeannefukumaru/cookiecutter-ml
The current example templates in the project
folder are nice, but simpler than most engineering/research projects will be.
Would it be possible to have a template with all batteries included that shows how to properly use:
dataset = MNIST('', train=True, download=True, transform=transforms.ToTensor())
self.log()
to_torchscript
function. Needing to have access to the code to restore models, can be troublesome if a script change was not git pushed, but still used to train a model. Or library mismatches. TorchScript makes sure that the saved model can be used to reproduce the results, with the added benefit of working in C++.Should we change it to support newer versions?
I think it would be more than beneficial to provide an example that would use all the hooks from the LightningModule
and LightningDataModule
so that the end user has a clear overview about customisation and use.
Recently I've been trying to develop a very general PyTorch Lightning + Hydra template.
The idea is to extend deep-learning-project-template, by just adding some Hydra config structure and simple example, which initializes modules from config parts in the most generic and obvious way.
I've been wondering if it would be a good idea to develop an official template of this sort and add it to Lightning ecosystem as an alternative for deep-learning-project-template?
Currently it seems like Hydra is still a little rough around the edges and it's not obvious how config should be structured for Lightning, but still such a template could be a useful addition in the future.
Here is a link to my version:
https://github.com/hobogalaxy/lightning-hydra-template
The latest docs state that validation_end should return a dict, optionally with two special keys, progress_bar and log. The code in this template only puts the metrics instead at the top level, resulting in them not showing up in whatever logger the user has selected. This is particularly confusing because the example code on the main docs page doesn't make use of this either, and so the only way to learn about the existence of the log key is to look directly at the validation_end signature directly, leading new users to assume all metrics are logged automatically as in issues such as Lightning-AI/pytorch-lightning#324 (comment). I stumbled upon that issue whilst trying to debug the same problem, but since I started with MLFlow I initially thought I must be doing something wrong with the non-default logger and ended up somewhat confused.
This has been clarified in the example code talked about in the above issue; that change should probably be ported to this repo. I also think there's a good argument this is non-obvious enough to put in the "minimal example" in the docs; if agreed I'll open an issue on the main repo for that.
Would be great if people's lightning modules became easily accessible via pip install. This functionality may work as is right now, but it would be great to showcase and encourage this pattern:
pip install git+https://github.com/teddykoker/teddys-model/
Then in python
from pl_bolts.datamodules import ImageNet
from teddys-model import TeddysModel
pl.Trainer().fit(TeddysModel(), ImageNet())
This encourages reusability of modules and datamodules which would be great for research reproducibility as well as just plug-n-play with different models.
@williamFalcon have you considered making this a GitHub Template?
"After you make your repository a template, anyone with access to the repository can generate a new repository with the same directory structure and files."
I want to add GAN as a project
Is it okay if I make it myself and apply for a PR here?
In my own project using this seed, I updated to 1.0.0rc2 to discover that TrainResult and EvalResult are deprecated.
For example, I got the error: AttributeError: module 'pytorch_lightning' has no attribute 'EvalResult'
It would be great if this repo can be used with the upcoming 1.0.0 release.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.