Pre-release
This release is a pre-release and may not be stable for production use.
torchmeta
A collection of extensions and data-loaders for few-shot learning & meta-learning in PyTorch. The package contains popular meta-learning benchmarks, fully compatible with both torchvision and PyTorch's DataLoader.
Example
This minimal example below shows how to create a dataloader for the 5-shot 5-way Omniglot dataset with torchmeta. The dataloader loads a batch of randomly generated tasks. For more examples, check the examples folder.
from torchmeta.datasets import Omniglot
from torchmeta.transforms import Categorical, ClassSplitter
from torchvision.transforms import Resize, ToTensor, Compose
from torchmeta.utils.data import BatchMetaDataLoader
dataset = Omniglot('data', num_classes_per_task=5,
transform=Compose([Resize(28), ToTensor()]),
target_transform=Categorical(num_classes=5),
meta_train=True, download=True)
dataset = ClassSplitter(dataset, num_train_per_class=5, num_test_per_class=15)
dataloader = BatchMetaDataLoader(dataset, batch_size=16, num_workers=4)
for batch in dataloader:
train_inputs, train_targets = batch['train']
print('Train inputs shape: {0}'.format(train_inputs.shape))
print('Train targets shape: {0}'.format(train_targets.shape))
# Train inputs shape: torch.Size([16, 25, 1, 28, 28])
# Train targets shape: torch.Size([16, 25])
test_inputs, test_targets = batch['test']
print('Test inputs shape: {0}'.format(test_inputs.shape))
print('Test targets shape: {0}'.format(test_targets.shape))
# Test inputs shape: torch.Size([16, 75, 1, 28, 28])
# Test targets shape: torch.Size([16, 75])
Metadata
Release files for torchmeta 1.1.0rc2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| torchmeta-1.1.0rc2.tar.gz | 105.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| torchmeta-1.1.0rc2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 235.5 kB
Release files / torchmeta-1.1.0rc2.tar.gz
| Download URL | torchmeta-1.1.0rc2.tar.gz |
|---|---|
| Size | 105.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f53dba3b453e1d238be21539208585540b5046d0c38964f6907a9cb622df18b8
|
|
BLAKE2b-256 checksum How to use checksums |
5173d250a3c5a5d90aed9bee806e5afbe0f4334d89e8ee91c3af6bd8e75a947c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.2
|
Release files / torchmeta-1.1.0rc2-py3-none-any.whl
| Download URL | torchmeta-1.1.0rc2-py3-none-any.whl |
|---|---|
| Size | 129.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ae54eb36c144c39e39253254d3a1a82662e063cc89d3ed02c0e1161fefaf9f21
|
|
BLAKE2b-256 checksum How to use checksums |
0bd9c07c041950869b933372beaf67a701c6f7b2d68091c649e65c365518c6ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.2
|