Skip to main content

Apply API

info

In this section we re-use the datalayer variable db without further explanation. Read more about how to build it here and what it is here.

AI functionality in SuperDuperDB revolves around creating AI models, and configuring them to interact with data via the datalayer.

There are many decisions to be made and configured; for this SuperDuperDB provides the Component abstraction.

The typical process is:

1. Create a component

Build your components, potentially including other subcomponents.

from superduperdb import <ComponentClass>

component = <ComponentClass>(
'identifier',
**kwargs # can include other components
)

2. Apply the component to the datalayer

"Applying" the component the db datalayer, also applies all sub-components. So only 1 call is needed.

db.apply(component)

3. Reload the component (if necessary)

The .apply command saves everything necessary to reload the component in the SuperDuperDB system.

reloaded = db.load('type_id', 'identifier')   # `type_id`

4. Export the component (to share/ migrate)

The .export command saves the entirety of the component's parameters, inline code and artifacts in a directory:

component.export('my_component')

The directory structure looks like this. It contains the meta-data of the component as well as a "mini-artifact-store". Together these items make the export completely portable.

my_component
|_component.json // meta-data and imports of component
|_blobs // directory of blobs used in the component
| |_234374364783643764
| |_574759874238947320
|_files // directory of files used in the component
|_182372983721897389
|_982378978978978798

You can read about the serialization mechanism here.

Read more