Skip to main content
Version: 0.6.0

Starwhale Model

overview

A Starwhale Model is a standard format for packaging machine learning models that can be used for various purposes, like model fine-tuning, model evaluation, and online serving. A Starwhale Model contains the model file, inference codes, configuration files, and any other files required to run the model.

Create a Starwhale Model​

There are two ways to create a Starwhale Model: by swcli or by Python SDK.

Create a Starwhale Model by swcli​

To create a Starwhale Model by swcli, you need to define a model.yaml, which describes some required information about the model package, and run the following command:

swcli model build . --model-yaml /path/to/model.yaml

For more information about the command and model.yaml, see the swcli reference. model.yaml is optional for model building.

Create a Starwhale Model by Python SDK​

from starwhale import model, predict

@predict
def predict_img(data):
...

model.build(name="mnist", modules=[predict_img])

Model Management​

Model Management by swcli​

CommandDescription
swcli model listList all Starwhale Models in a project
swcli model infoShow detail information about a Starwhale Model
swcli model copyCopy a Starwhale Model to another location
swcli model removeRemove a Starwhale Model
swcli model recoverRecover a previously removed Starwhale Model

Model Management by WebUI​

Model History​

Starwhale Models are versioned. The general rules about versions are described in Resource versioning in Starwhale.

Model History Management by swcli​

CommandDescription
swcli model historyList all versions of a Starwhale Model
swcli model infoShow detail information about a Starwhale Model version
swcli model diffCompare two versions of a Starwhale model
swcli model copyCopy a Starwhale Model version to a new one
swcli model removeRemove a Starwhale Model version
swcli model recoverRecover a previously removed Starwhale Model version

Model Evaluation​

Model Evaluation by swcli​

CommandDescription
swcli model runCreate an evaluation with a Starwhale Model

The Storage Format​

The Starwhale Model is a tarball file that contains the source directory.