Skip to main content

run

Given a path to one or more pre-trained (.pt) MODELS, the run command launches a session for real-time model inference, via OSC. Each model can be individually addressed via the <model_id> routeβ€”e.g., the first model has ID of 1, the second has ID of 2, and so on. The following OSC routes are available:

Input routes​

Each model can receive OSC messages via the following routes:

  • /<model_id>/input <...features>: The current event, as a list of features, for the model to make the next prediction. The number of event features must match either the masked or unmasked event size. For example, if the first model was trained on xy coordinates, the OSC message would look like this:
Example of input OSC route and message
/1/input -0.1 0.3
  • /<model_id>/sample: Request a random sample from the model's learned distribution, to be sent via the /<model_id>/output route. Useful for kicking off an auto-regressive loop.

  • /<model_id>/reset: Resets the model's hidden state (i.e., it's context), as well as cancelling any scheduled predictions, if the model is temporal.

  • /stop: Shuts down OSC server and stops session.

info

For input routes, /<model_id> can be optionally omitted as a way to address all models at once.

Output routes​

The model output can be received via the following OSC routes:

  • /<model_id>/output <...features>: Model's predicted event (unmasked). The predicted event can be sent as is back to /input for auto-regression, even if the model is trained on masked features. For example, if three models are being run, and the third was trained to generate 4 values, the output OSC message could look something like this:
Example of output OSC route and message
/3/output -0.1 0.4 -1.2 2.0
  • /status <int>: OSC server status. 1 when it's launched, and 0 when closed. This is automatically sent at the start and end of each session.
tip

Note that, in some cases, running the model on CPU results in lower prediction latency.

Usage​

hxmx run [MODELS]... [--in-port <INTEGER RANGE>] [--out-port <INTEGER RANGE>] [--address <TEXT>] [-d <CHOICE>] [--debug] [--help]

Arguments​

NameTypeRequiredDefault
MODELSpath β€” must exist, file (multiple)β€”

Options​

NameTypeDefaultDescription
--in-portinteger [1000, 9999]8000Input OSC port.
--out-portinteger [1000, 9999]9000Output OSC port.
--addressstring127.0.0.1OSC IP address
--device, -dchoice (auto|cpu| ...)cpuComputing device. To list all available devices, run hxmx devices.
--debugbooleanFalseDebug mode. Includes traceback when an error is raised.
-h, --helpbooleanFalseOpen web documentation in browser.