Skip to main content

PyTorch CNN Trainer

Check Formatting Code style: black CI Tests PyPi Release Deploy mkdocs Install Package Downloads Downloads Downloads

Train CNN for your task

A simple engine to fine tune CNNs from torchvision and Pytorch Image models from Ross Wightman.

Example

Why This Package ?

It is very annoying to write training loop and training code for CNN training. Also to support all the training features it takes massive time.

Usually we don't need distributed training and it is very uncomfortable to use argparse and get the job done.

This simplifies the training. It provide you a powerful engine.py which can do lot of training functionalities. Also a dataset.py to load dataset in common scenarios.

Note: - Pytorch Trainer is not a distributed training script.

It will work good for single GPU machine for Google Colab / Kaggle.

But for distributed Training you can use the PyTorch Lightning Trainer (soon).

It will train on multiple GPUs just the way lightning supports (soon).

To install

Install torch and torchvision from PyTorch Run the following in terminal.

pip install -q git+git://github.com/oke-aditya/pytorch_cnn_trainer.git

Or from PyPI now !!

pip install pytorch_cnn_trainer

Docs: -

I have provided some example of how to use this trainer in multiple scenarios. Please check examples folder. Some examples that are provided.

  • Fine Tune Torchvision models using fit().
  • Fine Tune Torchvision models using train_step() and validation_step().
  • Fine Tune Ross Wightman's models.
  • Quantization Aware Training head only.
  • Quantization Aware Training Fully.
  • Mixed Precision Training
  • Training with Stochastic Weighted Average (SWA)
  • LR Finder implementation

Features: -

  • Support PyTorch image models (timm) training and transfer learning.
  • Quantization Aware training example.
  • Early stopping with patience.
  • Support torchvision models trainging and transfer learning.
  • Support torchvision quantized models transfer learning.
  • Support for Mixed Precision Training.
  • L2 Norm Gradient Penalty.
  • LR Finder Implementation.
  • SWA Stochastic weighted Averaging support for training.
  • Add Keras Like fit method.
  • Sanity Check method.

Hope this repo helps people to train models using transfer learning.

If you like it do give * and tell people about it.

Metadata

Release files for pytorch-cnn-trainer 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytorch-cnn-trainer 0.3.0
File Size Uploaded
pytorch_cnn_trainer-0.3.0.tar.gz 17.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytorch-cnn-trainer 0.3.0
File Interpreter ABI Platform
pytorch_cnn_trainer-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.8 kB

Release files / pytorch_cnn_trainer-0.3.0.tar.gz

Download URL pytorch_cnn_trainer-0.3.0.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d7cc04013d1dc2ea3c9754e34df6fe80c7b928c9326282ec55171e400770343e
BLAKE2b-256 checksum
How to use checksums
54273265752bdfa26056a2e1cad53625a854397c233583baa7930172c20de8b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

Release files / pytorch_cnn_trainer-0.3.0-py3-none-any.whl

Download URL pytorch_cnn_trainer-0.3.0-py3-none-any.whl
Size 26.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
feae9f87b402b246cfba345316c5ecb530c9d47b6136fd6ac46faa833e2bbba9
BLAKE2b-256 checksum
How to use checksums
1ba9b2e127a4311b2f468373e8b3bd78ce1c8b9ea5b82b080d642175fbb36dea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page