-
Notifications
You must be signed in to change notification settings - Fork 0
ModelObjects
peder2911 edited this page Jan 11, 2022
·
6 revisions
The viewser toolkit also includes functions for storing and retrieving model objects. This is used to support production runs, to avoid having to retrain model objects. In addition, storage and retrieval of model objects could be used to share objects with other viewsers or between different computers.
There is a CLI interface that is useful for exploring and downloading currently available objects. The relevant commands are:
# Show list of names of currently available models
viewser model list
# Show metadata associated with model object
viewser model inspect $NAME
# Download model object to a pickle-file
viewser model download $NAME
For scripting, several commands are made available by the views_runs
package:
from datetime import datetime
from views_runs.storage import store, retrieve, list, fetch_metadata
my_model = ...
metadata = {"author": "testuser", "training_date": datetime.now()}
# Store a model object
store("my-model", my_model, metadata)
# Fetch a model object
another_model = fetch("another_model")
# Show list of available models
list()
# Fetch metadata associated with model
assert fetch_metadata("my-model") == metadata