Reference: integrations (flashruntime.integrations)
Framework adapters that build a CommandWorkload for you. Each is a small,
framework-neutral function — the recipe axis of the four-axis architecture. No
adapter imports its framework at the top level (the import is paid only in your
training process).
Signatures below are exact; each entry says, in one line, why it exists.
integrations.pytorch (fr_torch)
def ddp(
script,
*,
source=".",
nproc_per_node=2,
nnodes=1,
script_args="",
env=None,
) -> CommandWorkload: ...
Builds the torchrun launch command for a PyTorch script — the launch
conventions only; DDP is wired by your code (or flashruntime.torch.prepare).
Emits torchrun --nproc-per-node=N --nnodes=1 --standalone
--local-addr=127.0.0.1 <script> <args>. nnodes > 1 raises
NotImplementedError (multi-node rendezvous is a later slice). See the
PyTorch guide.
integrations.sklearn (fr_sklearn)
def sweep(
script,
task_params,
*,
source=".",
metric="accuracy_mean",
maximize=True,
python="python",
) -> CommandWorkload: ...
def hpo(script, grid, **kwargs) -> CommandWorkload: ...
sweep— one independent task per params dict; setsoutputs.primary_metric=metricsorun.best_trial()needs no arguments.hpo— Cartesian-grid sugar oversweep({"model": ["logreg", "rf"], "C": [0.1, 1]}→ 4 trials).
Distributes across runs, never inside a single .fit(). See the
scikit-learn guide.
integrations.huggingface (fr_hf)
def trainer(script, *, source=".", nproc_per_node=1, script_args="") -> CommandWorkload: ...
def latest_checkpoint(output_dir) -> str | None: ...
def flashruntime_callback(): ... # returns a transformers TrainerCallback
trainer— a thin wrapper overpytorch.ddp(); launching an HF Trainer job is just the PyTorch path (Trainer wraps DDP/FSDP internally undertorchrun).latest_checkpoint— newestcheckpoint-*dir with a valid manifest (orNone); pass straight totrainer.train(resume_from_checkpoint=...).flashruntime_callback— aTrainerCallbackwhoseon_savecommits a verified manifest and whoseon_logrelays metrics throughflashruntime.torch.log_metrics. Thetransformersimport is paid inside this factory, in your process.
See the Hugging Face guide.
The extensibility pattern
Every adapter returns a CommandWorkload and reuses the same
launch/collect/recover machinery. To teach FlashRuntime a new framework, write a
function under flashruntime/integrations/ that returns a CommandWorkload
describing what to run (and, if the framework has hooks, maps them onto
write_manifest / log_metrics). No core change is required — that is the
four-axis payoff. The SDK reference documents the CommandWorkload
shape you build.