MX8: bounded data runtime (Rust) exposed to Python.
Project description
mx8 (Python)
MX8 is a bounded-memory data runtime exposed to Python (built with PyO3 + maturin).
The v0 focus is “don’t OOM”: MX8 enforces backpressure with hard caps (so prefetch can’t runaway).
Install (from wheel)
Once you have a wheel (from CI or local build):
python -m venv .venv && . .venv/bin/activatepip install mx8-*.whl
Install (from PyPI)
python -m venv .venv && . .venv/bin/activatepip install mx8 pillow numpy torch
Quickstart (local, no S3)
import mx8
mx8.pack_dir(
"/path/to/imagefolder",
out="/path/to/mx8-dataset",
shard_mb=512,
label_mode="imagefolder",
require_labels=True,
)
loader = mx8.vision.ImageFolderLoader(
"/path/to/mx8-dataset@refresh",
batch_size_samples=64,
max_inflight_bytes=256 * 1024 * 1024,
resize_hw=(224, 224), # (H,W); optional
)
print(loader.classes) # ["cat", "dog", ...] if labels.tsv exists
for images, labels in loader:
pass
Bounded memory (v0)
Set a hard cap and periodically print high-water marks:
import mx8
loader = mx8.vision.ImageFolderLoader(
"/path/to/mx8-dataset@refresh",
batch_size_samples=64,
max_inflight_bytes=256 * 1024 * 1024,
max_queue_batches=8,
prefetch_batches=4,
)
for step, (images, labels) in enumerate(loader):
if step % 100 == 0:
print(loader.stats()) # includes ram_high_water_bytes
Avoid patterns that intentionally accumulate batches:
# ❌ Don't do this (will grow RSS regardless of any loader)
all_batches = list(loader)
Labels (optional)
label_mode="imagefolder" is designed to scale:
- Per-sample records reference a numeric
label_id(u64), not a repeated string. - The human-readable mapping is stored once at
out/_mx8/labels.tsv.
If your input layout is mixed (files directly under the prefix and subfolders), label_mode="auto" may disable ImageFolder labeling. To enforce ImageFolder semantics, use:
mx8.pack_dir(..., label_mode="imagefolder", require_labels=True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mx8-0.0.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: mx8-0.0.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 10.5 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e62ee2d79db8f6a703f5031794ec68fb9972f87d4e8105130d20c2d6a615cdb6
|
|
| MD5 |
c88d8c77dfe5d2532905619836d3e231
|
|
| BLAKE2b-256 |
86e4cd2fc57f6fb3254f65efc28dae357b656d0e4153324933c2e4487cb279ee
|
File details
Details for the file mx8-0.0.6-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: mx8-0.0.6-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 18.7 MB
- Tags: CPython 3.8+, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0eaa85aaf8b3160cfe75b2c5ad9c760d81d6bb62cb5112c26cb9380b5747966
|
|
| MD5 |
034c743766b244ff789b2b75c0164c50
|
|
| BLAKE2b-256 |
6aca49174b84eeda0c743f622fa51687c2d2e06195ae3e4ca97b52bba91f9a8f
|