Public API
Import the package as import relflow as rf. This map points to the contracts behind the common workflow; constructor options live with their owning type.
Model And Schema
| API | Purpose |
|---|---|
rf.Model(...) |
Build a Lightning module from named fields and branches. An existing rf.Schema is also accepted. |
rf.Branch(...) |
Group child fields into a repeated local context. |
rf.Attention, rf.Mean |
Choose the branch reduction; reduction=None preserves routed tokens. |
rf.Mask, rf.Jitter |
Configure visibility/objectives and continuous input perturbation. |
rf.Address, rf.where, rf.predicate |
Address and select schema nodes. |
model.select, update, extend, delete, reset, override |
Inspect or change the schema. |
See Model Tree, Data Types, and Schema Mutation.
Data And Training
| API | Purpose |
|---|---|
rf.ArrowDataModule |
Named splits backed by Arrow tables, files, datasets, or restartable Arrow factories. |
rf.PolarsDataModule |
Eager DataFrames converted once to the Arrow pipeline. |
rf.source |
Configure Arrow file reading. |
rf.preprocess, rf.Preprocessor |
Transform eager Polars frames before binding data. |
rf.adamw |
Configure the AdamW optimizer factory, fused by default. |
rf.RollbackCheckpoint |
Save validation checkpoints and restore the best one at fit end. |
model.compile |
Attach compilation to selected encoders and attention pools; returns the same model. |
CustomDataModule and SyntheticDataModule support application-owned mapping streams. Prefer the Arrow and Polars modules when the data already has that form. See Data Modules, Preprocessing, Training, Pretraining And Fine-Tuning, and Performance.
Prediction And Persistence
| API | Purpose |
|---|---|
model.save, rf.Model.load |
Save and restore the schema and learned model state. |
model.predict |
Return predictions as an Arrow table. |
model.encode, model.forward, model.write |
Explicit encoding, Torch computation, and Arrow writing stages. |
rf.Writer |
Write Lightning prediction batches to rank-partitioned Parquet files. |
rf.postprocess, rf.Postprocessor |
Transform eager Polars frames after prediction writing. |
rf.Deployment |
Serve models through the optional HTTP runtime. |
Serving types, including Accelerator, JSONBackend, and ModelSource, require relflow[serving]. See Prediction Output, Postprocessors, and Serving.
Extensions
rf.Extension registers the request, tensorfield, embedder, decoder, output, and related behavior for a datatype. RequestBase, TensorFieldBase, EmbedderBase, DecoderBase, TensorInput, Context, and RaggedField provide its shared contracts. See Custom Tensorfields.