Core Components¤
Core abstractions and building blocks that form the foundation of Datarax pipelines. These modules define the protocols, base classes, and data structures used throughout the framework.
Component Overview¤
| Component | Purpose | Key Classes |
|---|---|---|
| Element & Batch | Data containers | Element, Batch, Metadata |
| Config | Typed configuration | OperatorConfig, StructuralConfig |
| Modules | Base abstractions | DataraxModule, OperatorModule |
| Protocols | Interface contracts | DataSourceModule, SamplerModule |
★ Insight ─────────────────────────────────────
- Element wraps a single data sample with state and metadata
- Batch is a dictionary of batched JAX arrays
- All modules inherit from
DataraxModulefor consistent behavior - Protocols enable duck-typing with
isinstance()checks
─────────────────────────────────────────────────
Architecture¤
DataraxModule (base)
├── OperatorModule → Transformations (learnable)
├── DataSourceModule → Data loading
├── BatcherModule → Batching logic
├── SamplerModule → Index sampling
└── SharderModule → Device sharding
Quick Start¤
from datarax.core import Element, Batch
from datarax.core.config import OperatorConfig
# Create an element
element = Element(
data={"image": jnp.zeros((32, 32, 3))},
state={"step": 0},
metadata=Metadata(index=0),
)
# Access and update immutably
new_element = element.replace(
data={"image": element.data["image"] / 255.0}
)
Modules¤
Data Structures¤
- element_batch -
ElementandBatchdata containers - metadata - Metadata handling and field selection
Configuration¤
- config - Configuration base classes and validation
Base Classes¤
- module -
DataraxModulebase class - operator -
OperatorModulefor transformations - data_source -
DataSourceModulefor data loading - batcher -
BatcherModulefor batch creation - sampler -
SamplerModulefor index sampling - sharder -
SharderModulefor device sharding
Specialized¤
- cross_modal - Cross-modal data handling
- modality - Data modality definitions (image, text, audio)
- structural - Structural utilities and patterns
Real-World Examples¤
- DADA Learned Augmentation -
nnx.Paramandnnx.value_and_gradthrough augmentation operators for policy search - Learned ISP Pipeline - Custom
ModalityOperatorsubclasses with learnable parameters for ISP stages - DDSP Audio Synthesis - Custom
OperatorModulesubclasses for audio, showcasing extensibility to any domain
See Also¤
- Types & Protocols - Type definitions
- Configuration Guide - Detailed config documentation
- DAG Executor - Using core components in pipelines