How to automate workflows by running a notebook from the command line.
script
from the command line. This tutorial will show you best practice for setting up a notebook to parse command line arguments, and be flexible enough to run from the command line or from a βedit modeβ in the UI.
edit
or script
mode. For this example, we will be writing a dummy training loop for a model that simply sleeps for a user provided number of epochs.
typer
. The typer
library allows you to add a decorator to your function to turn it into a command line application. It will automagically infer the command names, types and default values from the function signature. The function is now usable from the command line without affecting itβs ability to be used in other parts of your code.
mo.app_meta().mode
is set to script
.
mo.ui.run_button
is a nice pattern. At the top of your notebook, define a cell with a button in it.
mo.stop
method, simply call the same function we used for the CLI.
train.py
file must be committed and pushed to your Oxen.ai remote repository on https://oxen.ai for this command to work.