A simple, flexible, and modular pytorch template for your deep learning projects.
Project description
Canvas ☯︎
"Beauty is as important in computing as it is in painting or architecture." — Donald E. Knuth
A simple, flexible, and modular template for your deep learning projects using PyTorch and Hydra. Inspired by the agent-environment interface, Canvas aims to provide a unified template for all ML projects.
Available Templates
Canvas offers unique templates to kickstart various machine learning tasks:
-
Supervised Learning (SL): Perfect for tasks like classification and regression, where you have labeled data.
-
Reinforcement Learning (RL): Designed for building agents that learn by interacting with an environment.
-
Self-Supervised Learning (SSL): Train models to learn representations from unlabeled data.
Installation
Canvas requires Python 3.9+. Since it's a command-line tool, we highly recommend using uv for installation
# Recommended: with uv tool
uv tool install canvas-template
# Alternative: with pip
pip install canvas-template
Usage
To create a new project, just run the canvas init command and pick your template. No need to create a directory first; Canvas will do it for you.
canvas init [sl|ssl|rl]
Example: The following settings will create a project named my_project with the self-supervised learning (SSL) template.
Project Structure
The directory structure of your new project will look something like this (depending on the settings that you choose):
example-project/
├── Makefile # Useful commands for development
├── LICENSE # Project license
├── README.md # Your project's main README file
├── mkdocs.yml # Configuration for building documentation
├── pyproject.toml # Project metadata and dependencies
├── uv.lock # uv lock file for consistent environments
├── docs/ # Where your project's documentation lives
│ └── index.md
├── src/ # All the code for your deep learning project
│ ├── main.py # The main script to run training, evaluation, or inference
│ ├── config/ # Hydra configuration files for managing settings
│ │ └── config.yaml
│ ├── model/ # Your deep learning model definitions
│ │ ├── __init__.py
│ │ ├── model.py
│ │ ├── network.py
│ │ └── loss.py
│ ├── data/ # Scripts for loading and preparing your data
│ │ ├── __init__.py
│ │ ├── data.py
│ │ └── preprocess.py
│ └── algorithm/ # The core algorithm logic: training, evaluation
│ ├── __init__.py
│ ├── trainer.py
│ └── evaluator.py
├── dataset/ # Place your raw or processed datasets here
│ └── ...
└── outputs/ # Where experiment logs, model checkpoints, and results are saved
└── ...
Contributing
Any kind of enhancement or contribution is welcomed. If you have bug fixes, new features, or any improvements, I'd love your help!
TODOs
- Support for loggers (wandb, tensorboard)
- Distributed training integration (ddp, accelerator, etc.)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file canvas_template-0.2.0.tar.gz.
File metadata
- Download URL: canvas_template-0.2.0.tar.gz
- Upload date:
- Size: 668.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b40706bfda7cdd159aca5e44ac411e561ad248f6e286038679522fc4cf9dbee9
|
|
| MD5 |
631cebcd217076281c2ace3db68c758e
|
|
| BLAKE2b-256 |
599147d4d26cd509244d57731a9e707a97ef498d4d64d0c9bbae4a7a63d19b15
|
File details
Details for the file canvas_template-0.2.0-py3-none-any.whl.
File metadata
- Download URL: canvas_template-0.2.0-py3-none-any.whl
- Upload date:
- Size: 231.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbdb6295d2aa373b93eeb5cc15a8f1d2979dfafd8dd20af58b7aa61fdf3be72a
|
|
| MD5 |
b759131e6ba07c6192a633ed618a3162
|
|
| BLAKE2b-256 |
e4f26373b786fb828773db543203c08d8f1bad452e44183187937a250728f7f9
|