Docs / Models
Bring your own
Using your own trained model inside a pipeline.
Wrap it in a card
Signal Studio does not train models. It runs them. Put your weights file alongside a card that loads it and exposes whatever you want adjustable as parameters.
run.py
import torch
from pathlib import Path
_model = None
def run(ctx):
global _model
if _model is None:
# Loaded once: the execution cache calls run() again
# on every upstream parameter change.
_model = torch.load(Path(__file__).parent / "weights.pt")
_model.eval()
x = ctx.inputs["in"].get_data()
with torch.no_grad():
y = _model(torch.from_numpy(x).float()).numpy()
return { "out": ctx.table(prediction=y) }Weights are large
The marketplace accepts files up to 200 MB. Above that, host the weights elsewhere and have the card download them on first use, stating clearly in the description that it will.
Declare what it expects
Sampling rate, channel count, montage, preprocessing. Then check them in
run() and raise a clear error when they do not match. A model that
accepts anything is a model that will be misused.