Models are user-defined groups of resources within Spell which, taken as a whole, constitute a deployable model artifact. Spell model servers take models as input. Models are also exportable from Spell, making them suitable for external use as well.

Models are available on the Spell for Teams plan.

Creating models

A model assigns a name and a version to a set of resources. Once model files have been registered to SpellFS, either as the output of a run or as an upload, they can be bundled into a model using the spell model create command.

# create a model from a run
$ spell model create mymodel runs/1
# create a model from an upload
$ spell model create mymodel uploads/my_checkpoint.pth

By default, Spell will assign the model an incrementing version number (e.g. v1, v2, etc.), but a custom version string can be assigned using the --version flag. Note that an auto-incremented version number is still assigned if a custom version is given, and both the custom version string and the auto-incremented version number are valid identifiers for the model version.

$ spell model create --version proof-of-concept mymodel runs/1

If the resource contains files that are not relevant to the model, you can also specify the desired files contained within the model using the --file flag.

$ spell model create --file out/model.hd5 --file out/context.json mymodel runs/1

Models can also be created from the web. The easiest way to do this is to use the Create Model button on the Models page in the web console:

Model server create menu

Alternatively, to create a model from a completed run with output, use the Create Model entry in the drop down menu while browsing the run. Or, to create a model from an upload, use the drop down menu in the resource browser.

Listing models

List all models using the spell model command. This will list the model name, latest version, and other metadata about the model.

$ spell model
cifar          v1                7 days ago   ***
bert_squad     demo (v8)         11 days ago  ***
roberta_squad  v3                7 days ago   ***

You can view all the versions of a specific model using spell model describe.

$ spell model describe cifar
VERSION    RESOURCE    FILES                                                 CREATED     CREATOR
v1         runs/3      saved_models/keras_cifar10_trained_model.h5:model.h5  7 days ago  ***

This information and actions are also available in the Spell web console.

Deleting models

Models can be deleted using spell model rm, or using the Spell web console. You can choose whether to delete a specific version of the model, or the model as a whole.

Exporting models

Models can be exported from Spell to local disc using the CLI:

spell model download churn-prediction:v1

Alternatively, using the Python API:

import spell.client
client = spell.client.from_environment()

model = client.models.get("my-model", version=1)

To learn more the Spell Python client, refer to our Python Quickstart.