TLDR; We have prepare the commands in the Makefile
for you:
make init # run in host, build a docker image for api server and launch the container
make in # run in host, ctrl + d to exit the container
# experiment
make wandb_login # run in container, login to wandb
make train # run in container, train the model
make table # run in container, generate the latex table
# commit
make copy_git # run in host, copy git config to the container home
make precommit_install # run in container, prepare pre-commit for tidy code
git add . && git commit -m "xxx" # run in container, commit code, it will run pre-commit check
# profiling
python train.py experiment=mnist_lenet debug=profiler # run in container, using pytorch profiler to profile the code
make nsightrun cmd="python train.py experiment=mnist_lenet debug=nsight" # run in container, launch a nsight system profiler
Below is the detailed instructions.
1. Create new project from template
Click [Use this template] to create a new project from this template.
2. Clone the new project to local
You can find the repository url in the new project page.
git clone <repo url>
3. Prepare docker environment
Build the docker image and launch the container with:
python docker.py startd --build
4. Enter the docker container
Enter the container with:
python docker.py
The docker container is our development environment.
5. Train a model
Launch training with:
python train.py experiment=mnist_lenet
or launch multiple training at once:
python batchrun.py scripts/train/train_baselines.sh --quotas 1
6. View results on wandb
The training results will be automatically uploaded to wandb. You can view the results on wandb.ai.
7. Generate Latex table
After training multiple models, you can generate a latex table with:
python scripts/gen_latex_table.py --table baseline
This will generate a table like this:
\usepackage{booktabs}
\begin{table}[t]
\centering
\small
\caption{Performance on the MNIST dataset. }
\label{tab:baseline}
\begin{tabular}{lr}
\toprule
Model & Accuracy \\
\midrule
DNN & 0.974566 \\
LeNet & \textbf{0.983000} \\
\bottomrule
\end{tabular}
\end{table}
8. Custom your own project
Modify the code to fit your own deep learning project. Check our document for more details.
9. Commit you modifications
We strongly recommend you to use pre-commit to check your code before commiting. Before you first commit, you need to install the pre-commit hook with:
pre-commit install
Then, you can commit your modifications with normal git commands.
git add .
git commit -m "commit message"
It will show you the errors if your code does not pass the pre-commit checks. After you fix the errors, you need to git add the modified files and commit again.
Give a star and cite us if you find this project useful.
[![DeepCodebase](https://img.shields.io/badge/Deep-Codebase-2d50a5.svg?style=flat-square)](https://github.com/hughplay/DeepCodebase)
This is a project based on DeepCodebase template.
*This is a project based on [DeepCodebase](https://github.com/hughplay/DeepCodebase) template.*
DeepCodebase is released under the MIT license.