Models

See here for additional information regarding models.

class SpellClient.models
class ModelsService(client)

A class for managing Spell models.

get(name, version=None)

Get a model or model version.

Parameters
  • name (str) – model name

  • version (str) – optional model version. If this parameter is set, returns only the specified model version. Otherwise, returns all versions of the model.

Returns

A SpellModel object if version is None. A ModelVersion object otherwise.

Raises

ClientException – an error occured.

list()

List models.

Returns

A list of Model objects.

Raises

ClientException – an error occured.

new(name, resource, version=None, files=[], description=None)

Create a model version.

Parameters
  • name (str) – model name

  • resource (str) – path to a top-level resource, runs/168 for example.

  • files (list of str, optional) – specific files or folders within the run which should be included in the model artifact. By default, this parameter is left blank, and all files written to disk by the run are included in the model artifact. If this parameter is set, all files not included in files are excluded. Each entry should be a valid path from within the run. Example: checkpoints/checkpoint.pk.

  • version (str, optional) – the model version. By default, will auto-increment (e.g. v1, v2…).

  • description (str, optional) – an optional model description.

Returns

A Model object.

Raises

ClientException – an error occured.

rm(name, version=None)

Remove a model or model version.

Parameters
  • name (str) – model name

  • version (str, optional) – model version. By default, all versions of the model will be archived.

Raises

ClientException – an error occured.

Model

class Model

Object representing a Spell model.

id

model id

Type

int

name

model name

Type

str

creator

the model creator

Type

User

created_at

the model creation time

Type

datetime.datetime

model_versions

list of model versions for this model

Type

list of ModelVersion

ModelVersion

class ModelVersion

Object representing a Spell model version.

id

the model version id

Type

int

model_id

model id

Type

int

model_name

model name

Type

str

formatted_version

the model version

Type

str

creator

the model version creator

Type

User

created_at

the model version creation time

Type

datetime.datetime

resource

path to the top-level resource associated with this mode, for example runs/168

Type

str

files

specific files or folders within the run included in the model artifact. If set to empty list [], all files from the resource are included in the model, otherwise, only ones included in files are.

Type

list of str, optional

download(dest=None, quiet=False)

Download the model to disk.

Parameters
  • dest (str, optional) – the destination folder. By default, downloads to the current directory.

  • quiet (bool, optional) – enables or disables print-out. Helpful for interactive usage. Defaults to False.

Raises

ClientException – an error occured.