Skip to main content

Torch Model Compression(tomoco)

This is a Deep Learning Pruning Package. This package allows you to prune layers of Convolution Layers based on L1 or L2 Norm. Tomoco Package

Package install:


pip install tomoco

Channel Pruning based on Norm:

from tomoco import pruner
import timm
from torchvision.datasets import CIFAR10
from torch.utils.data import DataLoader



class config:
    lr = 0.001 
    n_classes = 10			 # Intended for output classes
    epochs = 5                         # Set no. of training epochs
    device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")    # Pick the device availble
    batch_size = 64			# Set batch size
    optim = 0
    training =1                        # Set training to 1 if you would like to train post to prune
    criterion = nn.CrossEntropyLoss()  # Set your criterion here

train_dataset = CIFAR10(root='data/', download=True, transform=transforms.ToTensor())
valid_dataset = CIFAR10(root='data/',  download=True,train=False, transform=transforms.ToTensor())

# define the data loaders
train_loader = DataLoader(dataset=train_dataset, batch_size=config.batch_size, shuffle=True)
valid_loader = DataLoader(dataset=valid_dataset, batch_size=config.batch_size, shuffle=False)


#Use a cutom model or pull a model from a repository

res50 = timm.create_model("resnet50", pretrained=True).to(config.device)
config.optim =  torch.optim.Adam(res50.parameters(), config.lr=0.001,  amsgrad=True) 

pruner(res50,"res50", config, (3,64,64), "L1", 0.15,  train_loader, valid_loader)


Metadata

Release files for tomoco 0.0.11

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

Source distribution (sdist)

Source distribution for tomoco 0.0.11
File Size Uploaded Provenance Actions
tomoco-0.0.11.tar.gz 5.9 kB Without provenance Details for tomoco-0.0.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tomoco 0.0.11
File Interpreter ABI Platform Actions
tomoco-0.0.11-py3-none-any.whl Python 3 none any Details for tomoco-0.0.11-py3-none-any.whl

Total release size: 11.8 kB

Release files / tomoco-0.0.11.tar.gz

Download URL tomoco-0.0.11.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d80d4f77b3bcedffbdbc54157d2ea9b56f885395a0ec46a19f4e04eb2e3d747d
BLAKE2b-256 checksum
How to use checksums
0052b788961a2751088c6bc14f5748d78b37a704a2291d0b000ceb9cbaba5862
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / tomoco-0.0.11-py3-none-any.whl

Download URL tomoco-0.0.11-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4601ca505cd241f7e2b62e7decfb42d95db7bbcf78aef0d80ca457734f84b1f
BLAKE2b-256 checksum
How to use checksums
82b9d863ab05fe60985204307a9654858da983a3e3aa8119e5ae632cef4fd0e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Security for tomoco 0.0.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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