Skip to main content

Useful functions to use with PyTorch

Project description

TorchToolkit

PyPI version fury.io GitHub workflow GitHub license

Hi 👋, this is a small Python package containing useful functions to use with PyTorch. It includes utilities, metrics and sampling methods to use during and after training a model.

Feel free to use it, take the code for your projects, and raise an issue if you have question or a pull request if you want to contribute.

pip install torchtoolkit

It requires Python 3.8 or above.

Simplest example:

from torchtoolkit.metrics import Accuracy
from torch import randint, randn
from pathlib import Path

acc = Accuracy(mode='top_k', top_kp=5)
for _ in range(10):
    res = randn((16, 32))
    expected = randint(0, 32, (16, ))
    acc(res, expected)  # saving results
acc.save(Path('path', 'to', 'save', 'file.csv'))
acc.analyze()

I built it for my own usage, so you won't find documentation besides the docstring.

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

torchtoolkit-0.0.4.tar.gz (14.9 kB view hashes)

Uploaded Source

Built Distribution

torchtoolkit-0.0.4-py3-none-any.whl (13.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page