Tools for tracking structured weight sparsity in PyTorch models.
Project description
torch-weighttracker
PyTorch tools for tracking structured weight sparsity, regularization signals, and bit-operation estimates in neural network modules.
The public API is centered on WeightTracker:
import torch
from torch import nn
from torch_weighttracker import WeightTracker
model = nn.Sequential(nn.Linear(4, 8), nn.ReLU(), nn.Linear(8, 2))
tracker = WeightTracker(model, example_inputs=torch.randn(1, 4))
print(tracker.view_structures())
Installation
python -m pip install torch-weighttracker
Structured BOPs MAC accounting uses fvcore for baseline per-module MACs:
python -m pip install "torch-weighttracker[structured-bops]"
Development
python -m pip install -e ".[dev]"
Run tests and lint checks:
pytest
ruff check .
ruff format --check .
Smoke Test
python -c "from torch_weighttracker import WeightTracker; print(WeightTracker)"
Status
This package is pre-1.0. Public APIs may still change while the tracker, calculation, and regularizer surfaces settle.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torch_weighttracker-0.1.0.tar.gz.
File metadata
- Download URL: torch_weighttracker-0.1.0.tar.gz
- Upload date:
- Size: 81.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ce93bc6ac13f24e0632eab7857b65badfbfab55c3da031ec15be051dc72c5e8
|
|
| MD5 |
bfdfaaf4376040d723de83f113892af2
|
|
| BLAKE2b-256 |
17c35619ba988380bc4d8b9800bd0051bf01fde5504208662c32c07d836bc50a
|
File details
Details for the file torch_weighttracker-0.1.0-py3-none-any.whl.
File metadata
- Download URL: torch_weighttracker-0.1.0-py3-none-any.whl
- Upload date:
- Size: 91.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1451405748d79670ae129a3493a4a92ffe76724651cbea796bd6110d20570045
|
|
| MD5 |
243604c13cdb4584da473d1fce3b7b30
|
|
| BLAKE2b-256 |
1e7cf48674f383693acfb212a7277754541b7c930634ae82d04ee4df0229e44b
|