Valtra (Validation - Train)
Valtra is a mini-project I created because I got sick of keeping track of train and validation/test datasets separately.
It dynamically switches between training and validation/test data using a simple wrapper around PyTorch’s DataLoader.
📌 Why "Valtra"?
The name comes from Validation and Train. Plus, it has a nice ring to it.
🚀 Installation
pip install valtra
🔧 Usage
import torch
from valtra.dataloader import DynamicDataLoader
from valtra.utils import split_dataset
# Create dummy data
data = torch.randn(1000, 10)
labels = torch.randint(0, 5, (1000,))
dataset = torch.utils.Dataset(data, labels)
# Create DynamicDataLoader
dataloader = split_dataset(dataset, split_ratio=0.8, batch_size=32)
# Training loop (default behavior is training mode)
for batch in dataloader(train=True):
print("Train batch:", batch[0].shape)
# Evaluation loop
for batch in dataloader(test=True):
print("Test batch:", batch[0].shape)
# Evaluation loop
for batch in dataloader(other=True):
print("Other batch:", batch[0].shape)
Contribution
There are many ways to make code more readable in torch. If you have another idea feel free to contact me or create an issue!
📜 License
MIT License
Metadata
Release files for valtra 0.1.0
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 |
|---|---|---|---|---|
| valtra-0.1.0.tar.gz | 6.0 kB | Without provenance | Details for valtra-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| valtra-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for valtra-0.1.0-py3-none-any.whl |
Total release size: 10.6 kB
Release files / valtra-0.1.0.tar.gz
| Download URL | valtra-0.1.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a847021d204e23150cd8277e36c8e0f1d3591ed90fb26c1faf731e9ac533fbca
|
|
BLAKE2b-256 checksum How to use checksums |
9adb593dd997a8357d0b65aa72408cfbf389968f94ebc84b799ff6629afa152b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / valtra-0.1.0-py3-none-any.whl
| Download URL | valtra-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42b0e9d5329c2e8337ce40a570e67bec90bb9b541465d7d641d0cfeeeea529ad
|
|
BLAKE2b-256 checksum How to use checksums |
c0ffad33a38f1f3c617a9729276de54032b4b651567ba701398ae9e25de6ad61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Security for valtra 0.1.0
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.