Skip to content

CLI

tserve builds Server and calls run, which blocks until the process stops.

tserve chronos_bolt ttm_r3

Names after tserve are models to load. naive is always loaded as well.

Startup output: Docker, UV / Pip.

Flags

flag default
MODEL … none catalog models and/or id=craft-spec tokens. naive is always loaded too
--models-dir none directory of saved sktime .zip files
--host 127.0.0.1 bind address; 0.0.0.0 also accepts connections from the network
--port 8000 bind port
--log-level info debug, info, warning, error, or critical, for TServe and uvicorn

A craft spec is id=spec, split on the first =, so constructor kwargs may contain = too. Quote the whole token:

tserve chronos_bolt \
  'ttm-local=TinyTimeMixerForecaster(model_path="ibm-granite/granite-timeseries-ttm-r3", revision="52-16-dec-52-r3", fit_strategy="zero-shot")'

--models-dir never loads a directory wholesale. It loads .zip stems you also named; other names fall through to the registry. A live estimator has no CLI form: Live objects. Quoting and source values: Craft specs.

Startup and exit

Models load while Server is constructed, so an unknown model, a missing dependency, or a duplicate model fails before uvicorn binds the port. Those exceptions are listed under Errors.

Ctrl+C and a normal server exit both return 0; argparse usage errors exit 2. tserve --help prints the flags above.

In Docker the entrypoint is already tserve --host 0.0.0.0 --port 8000. Arguments after the image name are models or flags, so chronos_bolt ttm_r3 and any flag here work there too: Docker.

Python entry point

main

main(argv: list[str] | None = None) -> int

Parse argv, construct Server, and run it.

KeyboardInterrupt from server.run returns 0.

Parameters:

Name Type Description Default
argv list of str

Arguments for parse_args. None uses sys.argv.

None

Returns:

Type Description
int

Always 0 on return. parser.error exits via SystemExit instead of returning.

Raises:

Type Description
SystemExit

From ArgumentParser.error or argparse usage errors.

ValueError

If positional tokens are malformed (empty id=spec, a bare craft spec), or Server / bootstrap reject a load spec (duplicate id, unknown registry id, non-zip path, unknown executor).

TypeError

If a model object is not a sktime BaseForecaster.

ImportError

If the executor extra is not installed.

See Also

tserve.server.serve.Server Constructed from leftover positionals, --models-dir, --host, --port, and --log-level. Install and serve Install server and model-family dependencies. Models catalog Registry ids accepted as leftover positionals. Docker Container entrypoint. Startup errors Failures that occur before uvicorn binds the port.