Small utilities for PyTorch
Project description
Weaver PyTorch 🧶🧵
from weaver import get_classifier, get_optimizer, get_scheduler, get_transforms
from torchvision.transforms import Compose
model = get_classifier('torchvision', 'resnet50')
optim = get_optimizer(model.parameters(), name='SGD', lr=1e-3)
sched = get_scheduler(optim, name='CosineAnnealingLR', T_max=10)
transform = Compose(get_transforms([
{'name': 'RandAugment', 'num_ops': 2, 'magnitude': 10},
{"name": "ToTensor"},
{"name": "Normalize", "mean": "cifar10", "std": "cifar10"}
]))
Install
pip install weaver-pytorch-rnx0dvmdxk
API
get_classifier(src, name, **kwargs)
- weaver:
wide_resnet{depth}_{width},preact_resnet{depth} - torchvision: https://pytorch.org/vision/stable/models.html
get_optimizer(params, name, **kwargs)
- PyTorch: https://pytorch.org/docs/stable/optim.html#algorithms
- AdaBelief: https://github.com/juntang-zhuang/Adabelief-Optimizer
get_scheduler(optim, name, **kwargs)
- PyTorch: https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate
- Custom:
HalfCosineAnnealingLR
get_transform(name, **kwargs)
- PyTorch: https://pytorch.org/vision/stable/transforms.html
- Custom:
AllRandAugment,Cutout,Contain
get_transforms(kwargs_list)
- get list of transforms
Others
weaver.optimizers.exclude_wd(module: Module, skip_list=['bias', 'bn'])weaver.optimizers.EMAModel(model: Module, alpha: float)weaver.datasets.IndexedDatasetweaver.datasets.RandomSubset
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
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 weaver-pytorch-rnx0dvmdxk-0.0.4.tar.gz.
File metadata
- Download URL: weaver-pytorch-rnx0dvmdxk-0.0.4.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dc7752af41bd24e95757bc85194ba338347a73996833502f1cb467c3838900e
|
|
| MD5 |
bbd835f34a5c294c72869cc27f86136e
|
|
| BLAKE2b-256 |
ae044f8520780e1041a7a0327a956269b3048066f766030cb8f9f67ab57ca13d
|
File details
Details for the file weaver_pytorch_rnx0dvmdxk-0.0.4-py3-none-any.whl.
File metadata
- Download URL: weaver_pytorch_rnx0dvmdxk-0.0.4-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f85c2f1b623d18fb39bcaa67bc812ef0e5b5d17f1c096184be14aa78df80112
|
|
| MD5 |
fa04853642e46158d202317128aa71e7
|
|
| BLAKE2b-256 |
eb86af22e6710669704da00420f851e742154580de82d338dfbff3d56c19ff1b
|