prt-datasets
prt-datasets is a small collection of synthetic and common example datasets packaged as PyTorch Datasets and Lightning DataModules. It provides utilities and ready-to-use DataModules for common examples used in experiments and tutorials such as MNIST (classification) and synthetic regression datasets (circle, cubic, thermistor). The goal of this project is to make it easy to prototype training and uncertainty estimation workflows with minimal setup.
Features
- Lightweight PyTorch Dataset implementations for common toy problems
- Lightning DataModule wrappers for easy integration with PyTorch Lightning
- Built-in examples: MNIST (wrapper), Circle, Cubic, Thermistor
Installation
Requires Python 3.11 or later. The project declares the following runtime dependencies in pyproject.toml:
- lightning
- numpy
- requests
- torch
To install from source (editable) with pip and the dev/test extras, run:
python -m pip install -e .[dev]
Or install the package normally:
python -m pip install .
If you only want runtime dependencies, install them directly:
python -m pip install lightning numpy requests torch
Quick examples
Below are short examples showing how to use DataModules and Datasets in this repository.
Note: the package exposes modules under prt_datasets. Import paths shown assume the package is
installed or the repository root is on PYTHONPATH.
Circle (regression)
The CircleDataModule creates a synthetic 2D circle dataset and exposes train/val/test dataloaders.
from prt_datasets.regression.circle import CircleDataModule
dm = CircleDataModule(batch_size=128, num_workers=4, seed=0)
dm.prepare_data()
dm.setup()
train_loader = dm.train_dataloader()
for x, y in train_loader:
# x: angle values, y: 2D coordinates on noisy circle
break
Cubic (regression)
The CubicDataModule provides samples of the function y = x^3 + noise with separate train/test ranges
so you can experiment with interpolation/epistemic uncertainty.
from prt_datasets.regression.cubic import CubicDataModule
dm = CubicDataModule(batch_size=64, num_workers=4, seed=42)
dm.setup()
loader = dm.train_dataloader()
for x, y in loader:
# x, y are tensors shaped (B, 1)
break
MNIST (classification)
MNISTDataModule is a thin wrapper around torchvision.datasets.MNIST. It normalizes data to the
standard MNIST mean/std and provides Lightning DataModule loaders.
from prt_datasets.classification.mnist import MNISTDataModule
dm = MNISTDataModule(root='data', batch_size=64)
dm.prepare_data()
dm.setup()
train_loader = dm.train_dataloader()
for imgs, labels in train_loader:
break
API overview
- prt_datasets.classification.MNISTDataset, MNISTDataModule
- prt_datasets.regression.CircleDataset, CircleDataModule
- prt_datasets.regression.CubicDataset, CubicDataModule
- prt_datasets.regression.ThermistorDataset, ThermistorModel
Refer to the docstrings in the source files for parameter details and behaviors.
Tests
This repository uses pytest for tests. To run the test suite:
python -m pip install -e .[dev]
pytest -q
There are tests under tests/ that exercise basic dataset behaviors.
Contributing
Contributions are welcome. A few guidelines:
- Open an issue to discuss larger changes before implementing them.
- Keep changes small and focused. Add tests for new functionality.
- Follow the repository style and type annotations where present.
License
This project is provided under the terms of the license in LICENSE.md.
Maintainer
Gavin Strunk
If you spot mistakes or want more example datasets, file an issue or send a PR.
Metadata
Release files for prt-datasets 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| prt_datasets-0.1.2.tar.gz | 21.3 kB | Without provenance | Details for prt_datasets-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| prt_datasets-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for prt_datasets-0.1.2-py3-none-any.whl |
Total release size: 45.9 kB
Release files / prt_datasets-0.1.2.tar.gz
| Download URL | prt_datasets-0.1.2.tar.gz |
|---|---|
| Size | 21.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d1590d18c24e4b731f21a0448d92fd56255a617e410bf0ef2517b4354806615
|
|
BLAKE2b-256 checksum How to use checksums |
993fdd898de80c27776028740eab295609560646341e235f70bd3fc162c99fda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / prt_datasets-0.1.2-py3-none-any.whl
| Download URL | prt_datasets-0.1.2-py3-none-any.whl |
|---|---|
| Size | 24.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2011975715602e65ef361e2cbabb276b086f45ef24a1898d757ad382ef638bb
|
|
BLAKE2b-256 checksum How to use checksums |
fa69c5a7c019f5920381ff94e8258d9078e0d0ad388d2d2227ef2a1db2a112c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for prt-datasets 0.1.2
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.