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.0.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.0-py3-none-any.whl (293.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: canvas_template-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 b2431dbc3eb88588f04a5da2defce870d9e9574ba05171bc908efbf6b55a599e
MD5 425462d9a8dc614f9999f57680c8520e
BLAKE2b-256 3fc86c30392dac3c977c25a4c1da38407f463f56b67efcb32295b5a9ab5ea60b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for canvas_template-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12b7e392e9eda09dcdcf8179c7306dbc96664ceef5d2a7d016fc5894c384b5b6
MD5 e3a3036027057c5aa0e17ae6929c7ae2
BLAKE2b-256 aed802fda9d49175d50e4f41292edf2e69b7c02f70983296ec914cd0b535dc2c

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