Skip to main content

Functions, losses, and module blocks to share between experiments.

Project description

Pugh Torch

Build Status Documentation Code Coverage

Functions, losses, module blocks to share between experiments.

Package Features

  • Additional methods to TensorBoard summary writer for adding normalized images and semantic segmentation images.
  • hetero_cross_entropy for cross_entropy loss across heterogeneous datasets
  • Convenient dataset downloading/unpacking to ~/.pugh_torch/datasets/.
    • You can override this via the ENV variable ROOT_DATASET_PATH.


Stable Release: pip install pugh_torch
Development Head: pip install git+


A big part of this repo is a framework to quickly be able to iterate on ideas.

To accomplish this, we provide the following:

  • A docker container brianpugh/pugh_torch that contains many dependencies experimenters would like to use.
    • You can pull the docker image and launch the container via:
      docker pull brianpugh/pugh_torch
    • This will map ~/.pugh_torch and the local copy of the git repo into the container. You may change this if you like. This will also pass in any available GPUs and set other common docker flags for running/training neural nets.
    • This container runs a VNC server, incase you need to perform some visual actions, like using matplotlib.pyplot
  • A unified training driver experiments/ to run experiments.
    • From the experiments/ folder, run python3 template to begin training the default resnet50 architecture on ImageNet.
    • ImageNet cannot be automatically downloaded (see the error raised). To get training started with an easier-to-obtain dataset, run: python3 template dataset=cifar100 model=cifar100
  • A template project experiments/template that should get you going. The goal here is to provide maximum flexibility while minimizing "project startup costs". We leverage the following libraries:
    • Hydra for managing experiment hyperparameters and other configuration. It's a good idea to make your code configurable via this configuration rather than directly tweaking code to make experiments more trackable and reproduceable.
    • PyTorch-Lightning for general project organization and training.
    • pugh_torch for various tweaks and helpers that make using the above libraries easier for common projects and tasks.


For full package documentation please visit

Free software: MIT license


All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[0.4.0] - TBD


  • pytorch-lightning callbacks (TensorBoardAddSS, TensorBoardAddClassification) for add_ss and add_rgb for segmentation and classification tasks, respectively.
  • Initial form of a project template to get ideas going quickly.
  • ADE20K dataset
  • various optimizers and getters
  • various activation functions and getters
  • LoadStateDictMixin that adds verbosity to model loading and has more laxed strict shape requirements.
  • pretrained resnet models (from torchvision) that utilize LoadStateDictMixin
  • Label smoothing losses

[0.3.1] - 2020-09-21


  • Aliased ResizeShortest to ShortestMaxSize to be consistent with albumentations.augmentations.transforms.LongestMaxSize


  • Add missing interpolation attribute in ResizeShortest transform.
  • Fixed ResizeShortest producing erroenous results when both sides are the same length.

[0.3.0] - 2020-09-21


  • Text label adding to TensorBoard Images
  • ResizeShortest augmentation transform
  • Unit Testing utilities
  • basic Datasets API
  • A bunch of useful dependencies added.

[0.2.0] - 2020-09-15


  • Additional extra_requires in preparation for docker release.

[0.1.0] - 2020-09-13


  • Initial Release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pugh-torch, version 0.4.0
Filename, size File type Python version Upload date Hashes
Filename, size pugh_torch-0.4.0.tar.gz (41.3 kB) File type Source Python version None Upload date Hashes View
Filename, size pugh_torch-0.4.0-py2.py3-none-any.whl (43.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page