deltatorch
Concept
deltatorch allows users to directly use DeltaLake tables as a data source for training using PyTorch.
Using deltatorch, users can create a PyTorch DataLoader to load the training data.
We support distributed training using PyTorch DDP as well.
Why yet another data-loading framework?
- Many Deep Learning projects are struggling with efficient data loading, especially with tabular datasets or datasets containing many small images
- Classical Big Data formats like Parquet can help with this issue, but are hard to operate:
- writers might block readers
- Failed write can make the whole dataset unreadable
- More complicated projects might ingest data all the time, even during training
Delta Lake storage format solves all these issues, but PyTorch has no direct support for DeltaLake datasets.
deltatorch introduces such support and allows users to use DeltaLake for training Deep Learning models using PyTorch.
Usage
Requirements
- Python Version > 3.8
piporconda
Installation
- with
pip:
pip install git+https://github.com/delta-incubator/deltatorch
Create PyTorch DataLoader to read our DeltaLake table
To utilize deltatorch at first, we will need a DeltaLake table containing training data we would like to use for training your PyTorch deep learning model.
There is a requirement: this table must have an autoincrement ID field. This field is used by deltatorch for sharding and parallelization of loading.
After that, we can use the create_pytorch_dataloader function to create PyTorch DataLoader, which can be used directly during training.
Below you can find an example of creating a DataLoader for the following table schema :
CREATE TABLE TRAINING_DATA
(
image BINARY,
label BIGINT,
id INT
)
USING delta LOCATION 'path'
After the table is ready we can use the create_pytorch_dataloader function to create a PyTorch DataLoader :
from deltatorch import create_pytorch_dataloader
from deltatorch import FieldSpec
def create_data_loader(path:str, batch_size:int):
return create_pytorch_dataloader(
# Path to the DeltaLake table
path,
# Autoincrement ID field
id_field="id",
# Fields which will be used during training
fields=[
FieldSpec("image",
# Load image using Pillow
load_image_using_pil=True,
# PyTorch Transform
transform=transform),
FieldSpec("label"),
],
# Number of readers
num_workers=2,
# Shuffle data inside the record batches
shuffle=True,
# Batch size
batch_size=batch_size,
)
Metadata
Release files for deltatorch 0.0.3
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 | |
|---|---|---|---|---|
| deltatorch-0.0.3.tar.gz | 7.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| deltatorch-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.7 kB
Release files / deltatorch-0.0.3.tar.gz
| Download URL | deltatorch-0.0.3.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07206b3e98348bd3c58f70ade670ce0149ac506c681ed2e24ced0f1f76f0c155
|
|
BLAKE2b-256 checksum How to use checksums |
814209a597ed1a2df460150a7921b96c42b7318da89bc0c78b1d97ff96051443
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.0 CPython/3.11.3 Darwin/23.0.0
|
Release files / deltatorch-0.0.3-py3-none-any.whl
| Download URL | deltatorch-0.0.3-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8f3726f16ea8f417f0dcdb19b1e6630aeb6c5c701649266300fa18903ec5bb2
|
|
BLAKE2b-256 checksum How to use checksums |
4a0556d04a27b8299a05b76e2355c6fcda3007f6ad34710134eca2d937bc8f01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.0 CPython/3.11.3 Darwin/23.0.0
|
Security for deltatorch 0.0.3
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.