druta (द्रुत)
A fast video dataset format for PyTorch (for when storage is cheap, but time is not)
pip install druta
import druta
druta.prep_dataset(
video="video.mp4",
save_as="video.druta",
num_threads=4,
)
dataset = druta.Dataset(
filename="video.druta",
)
for i in range(len(dataset)):
frame = dataset[i]
## (height, width, 3)
print(f"Frame {i} shape: {frame.shape}")
Why druta?
When training a model on video data using something like decord, we end up performing the video decoding gymnastics thousands of times redundantly. Druta skips this redundancy by decoding the video once and storing it as a memory mapped file with raw uint8 tensor data.
But there's no free lunch. The speedup comes at a cost of a massive disk-size, but this trade-off is well worth it for some folks. (The speed-tests were run on an M3 Max macbook pro on 2048 frames)
Running tests
pytest -vvx --capture=no tests/
Metadata
Release files for druta 0.0.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 | |
|---|---|---|---|
| druta-0.0.2.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| druta-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.0 kB
Release files / druta-0.0.2.tar.gz
| Download URL | druta-0.0.2.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63a3a9cc1a9563ae3270fedce23f492992e4c2675cfb2d4efa656a9484c59517
|
|
BLAKE2b-256 checksum How to use checksums |
44949ca7c6def860a3ec88d092e58651be6da12ed9ece40eb33a72d696087467
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / druta-0.0.2-py3-none-any.whl
| Download URL | druta-0.0.2-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
803bbfbe1ea534b02a78aa8cd897c3b301902b97dc12c95071c904202a0186d6
|
|
BLAKE2b-256 checksum How to use checksums |
66bb953db70ed3bfe9280593d09aaefdb8778595a32f709d94f3f3f1605c9280
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|