Skip to main content

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.

Canvas Architecture

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.

Canvas Demo

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
│   ├── data/               # Scripts for loading and preparing your data
│   │   ├── __init__.py
│   │   ├── data.py
│   │   └── prepare.py
│   └── algorithm/          # The core machine learning logic: training, loss, evaluation
│       ├── __init__.py
│       ├── loss.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

canvas_template-0.1.1.tar.gz (726.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

canvas_template-0.1.1-py3-none-any.whl (293.0 kB view details)

Uploaded Python 3

File details

Details for the file canvas_template-0.1.1.tar.gz.

File metadata

  • Download URL: canvas_template-0.1.1.tar.gz
  • Upload date:
  • Size: 726.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for canvas_template-0.1.1.tar.gz
Algorithm Hash digest
SHA256 603b63427a17752616797cc38dde6b15819a6064c7c75b8abad1d7e0797827a8
MD5 b2553dfa259d486652119d07d1720c18
BLAKE2b-256 38ca7939e38ea02cdebe591e85adf285634ea5ccdcd611245116e7f4bb97ec7a

See more details on using hashes here.

File details

Details for the file canvas_template-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for canvas_template-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 73b2465695b3630ae417b10e98a039758f7934b3359a4ad9bf1eb0148211364f
MD5 34903527036231677b62ce8046c927dc
BLAKE2b-256 997a1464474ed08613609926a926c884ae3bda943873be045191d710db15b26c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page