Skip to content

Cloudservercloudzoo

Classes

CloudServerCloudZoo

This class is responsible for managing and loading models from a cloud-based AI model zoo, for inference in the cloud. It handles model discovery, fetching model information, and loading models for use. Use loadModel() to instantiate and configure a model for use. Various utility functions are available to interact with the cloud zoo.

Functions

mergeWithSchema(schema, cloudParams)object

Hydrate cloudParams with defaults from schema. • Anything already in cloud stays untouched. • Anything missing is copied from schema and logged.

CloudServerCloudZoo

This class is responsible for managing and loading models from a cloud-based AI model zoo, for inference in the cloud. It handles model discovery, fetching model information, and loading models for use. Use loadModel() to instantiate and configure a model for use. Various utility functions are available to interact with the cloud zoo.

Kind: global class

new CloudServerCloudZoo([zooUrl], accessToken, [dummy])

Do not call this constructor, instead use the connect function of the dg_sdk class to create a CloudServerCloudZoo instance.

Param Type Default Description
[zooUrl] string "DEFAULT_CLOUD_URL"

Expected format: "https://[/]"

accessToken string

The access token for the cloud zoo.

[dummy] boolean false

Dummy zoo instance - only for system info call

Example (Usage:)

let zoo = await dg.connect('cloud', 'https://hub.degirum.com/degirum/public', secretToken);
let model = await zoo.loadModel('someModel', { max_q_len: 5, callback: someFunction });

cloudServerCloudZoo.loadModel(modelName, [options]) ⇒ Promise.<CloudServerModel>

Loads a model from the cloud zoo and prepares it for inference.

Kind: instance method of CloudServerCloudZoo
Returns: Promise.<CloudServerModel> -

The loaded model instance.

Param Type Default Description
modelName string

The name of the model to load.

[options] Object {}

Additional options for loading the model.

[options.max_q_len] number 10

The maximum length of the internal inference queue.

[options.callback] function

A callback function to handle inference results.

Example

let model = await zoo.loadModel('someModel', { inputCropPercentage: 0.5, callback: someFunction } );

cloudServerCloudZoo.systemInfo() ⇒ Promise.<Object>

Fetches system information from the cloud server.

Kind: instance method of CloudServerCloudZoo
Returns: Promise.<Object> -

The system information.


cloudServerCloudZoo.listModels() ⇒ Promise.<Object>

Lists all available models in the cloud zoo.

Kind: instance method of CloudServerCloudZoo
Returns: Promise.<Object> -

An object containing the available models and their params.


Example
let models = await zoo.listModels();
let modelNames = Object.keys(models);

cloudServerCloudZoo.getModelInfo(modelName) ⇒ Promise.<(Object|null)>

Gets the default model parameters for a specified model.

Kind: instance method of CloudServerCloudZoo
Returns: Promise.<(Object|null)> -

A promise that resolves to the default model parameters if found, or null if not found.

Param Type Description
modelName string

The name of the model to retrieve information for.

cloudServerCloudZoo.getModelLabels(modelName) ⇒ Promise.<Object>

Fetches the labels for a specific model from the cloud zoo. queries https://hub.degirum.com/zoo/v1/public/models/degirum/public/example_model/dictionary

Kind: instance method of CloudServerCloudZoo
Returns: Promise.<Object> -

The model's label dictionary.

Param Type Description
modelName string

The name of the model.

cloudServerCloudZoo.downloadModel(modelName) ⇒ Promise.<Blob>

Downloads a model from the cloud zoo. fetches from https://hub.degirum.com/zoo/v1/public/models/degirum/public/example_model

Kind: instance method of CloudServerCloudZoo
Returns: Promise.<Blob> -

The downloaded model as a Blob.

Param Type Description
modelName string

The name of the model to download.

cloudServerCloudZoo.getZoos(organization) ⇒ Promise.<Object>

Fetches the list of zoos for a given organization.

Kind: instance method of CloudServerCloudZoo
Returns: Promise.<Object> -

The list of zoos.

Param Type Description
organization string

The name of the organization.

mergeWithSchema(schema, cloudParams) ⇒ object

Hydrate cloudParams with defaults from schema. • Anything already in cloud stays untouched. • Anything missing is copied from schema and logged.

Kind: global function
Returns: object -

fully-hydrated parameter object

Param Type Description
schema object

– master defaults

cloudParams object

– sparse set returned by server