Running notebooks remotely
Leveraging Jupyter notebooks with ZenML.
Why there are limitations
Checklist for step cells
Run a single step remotely
from zenml import step
import pandas as pd
from sklearn.base import ClassifierMixin
from sklearn.svm import SVC
@step(step_operator=True) # remove argument if not using a step operator
def svc_trainer(
X_train: pd.DataFrame,
y_train: pd.Series,
gamma: float = 0.001,
) -> tuple[ClassifierMixin, float]:
"""Train an SVC model and return it together with its training accuracy."""
model = SVC(gamma=gamma)
model.fit(X_train.to_numpy(), y_train.to_numpy())
acc = model.score(X_train.to_numpy(), y_train.to_numpy())
print(f"Train accuracy: {acc}")
return model, acc
# Prepare some data …
X_train = pd.DataFrame(...)
y_train = pd.Series(...)
# ☁️ This call executes remotely on the active stack
model, train_acc = svc_trainer(X_train=X_train, y_train=y_train)Next steps – from notebook to production
Last updated
Was this helpful?