https://github.com/timesler/pytorch-project-template
A template for building pytorch projects and packages including an optional REST API
https://github.com/timesler/pytorch-project-template
deep-learning pytorch template-project
Last synced: 4 months ago
JSON representation
A template for building pytorch projects and packages including an optional REST API
- Host: GitHub
- URL: https://github.com/timesler/pytorch-project-template
- Owner: timesler
- License: mit
- Created: 2019-07-06T17:36:15.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-17T02:04:28.000Z (almost 7 years ago)
- Last Synced: 2025-04-21T02:40:11.179Z (about 1 year ago)
- Topics: deep-learning, pytorch, template-project
- Language: Python
- Homepage:
- Size: 36.1 KB
- Stars: 14
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pytorch-project-template
A template for building pytorch projects and packages.
```
pytorch_project_template
├── config.py - File to define run parameters
├── data/ - Directory for data storage, data won't be tracked
├── dependencies/ - Directory for dependencies and submodules
├── docker-compose.yml - Docker compose file
├── dockerfile - Dockerfile with all dependencies
├── .dockerignore
├── environment.yml - Conda environment file
├── .gitignore
├── __init__.py - Defines project as a module
├── LICENSE - MIT license
├── main.py - Script that defines API routes (if using API)
├── models/ - Directory for pytorch modules
├── README.md
├── setup.py - PyPI setup script, use for creating pip package
├── tests/
│ └── test.py - Add some test code here, used by CI testing
└── utils/
├── datasets.py - Custom datasets
├── samplers.py - Custom samplers and batch samplers
└── training.py - Functions for training and evaluation
```
## Quick setup
Requires git, python, and conda.
1. Clone this project:
```bash
git clone https://github.com/timesler/pytorch-project-template
```
1. Create a new project (see `create_project.py --help`):
```bash
create_project.py
```
Optionally, the project can also include:
* git: `--git`
* docker and docker-compose to develop models in a container: `--docker`
* a dockerfile and docker-compose service to serve models with a REST API: `--api`
* a setup.py file for building a pip/PyPI package: `--pypi`
* all of the above: `-full`
E.g., for building a python package, you probably want:
```bash
create_project.py --git --pypi
```
1. Create development environment using conda or docker:
* conda:
```bash
conda create -n pytorch-py37 -f environment.yml
conda activate pytorch-py37
```
* docker/nvidia-docker:
```bash
docker-compose run --rm train bash
```
1. (Optional) Deploy API for serving model:
```bash
docker-compose up -d api
```
## Use as Github template
Alternatively, this repo can be used as a template for creating new repos on Github. Simply click "Use this template" at the top of the [main repo page](https://github.com/timesler/pytorch-project-template).
Following this, you should:
* Overwrite this README
* Remove the `create_project.py` utility
* Remove all unwanted files and folders