Quick Start (Model Developers)

As a Model Developer, you can manage models, datasets, train jobs & inference jobs on Rafiki. This guide only highlights the key methods available to manage models.

To learn about how to manage datasets, train jobs & inference jobs, go to Quick Start (Application Developers).

This guide assumes that you have access to a running instance of Rafiki Admin at <rafiki_host>:<admin_port> and Rafiki Web Admin at <rafiki_host>:<web_admin_port>.

To learn more about what else you can do on Rafiki, explore the methods of rafiki.client.Client

Installing the client

  1. Install Python 3.6 such that the python and pip point to the correct installation of Python (see Installing Python)

  2. Clone the project at https://github.com/nginyc/rafiki (e.g. with Git)

  3. Within the project’s root folder, install Rafiki’s client-side Python dependencies by running:

    pip install -r ./rafiki/requirements.txt
    

Initializing the client

Example:

from rafiki.client import Client
client = Client(admin_host='localhost', admin_port=3000)
client.login(email='model_developer@rafiki', password='rafiki')

Creating models

To create a model, you’ll need to submit a model class that conforms to the specification by rafiki.model.BaseModel, written in a single Python file. The model’s implementation should conform to a specific task (see Supported Tasks).

Refer to the parameters of rafiki.client.Client.create_model() for configuring how your model runs on Rafiki, and refer to Model Development Guide to understand more about how to write & test models for Rafiki.

Example:

client.create_model(
    name='TfFeedForward',
    task='IMAGE_CLASSIFICATION',
    model_file_path='examples/models/image_classification/TfFeedForward.py',
    model_class='TfFeedForward',
    dependencies={ 'tensorflow': '1.12.0' }
)

client.create_model(
    name='SkDt',
    task='IMAGE_CLASSIFICATION',
    model_file_path='examples/models/image_classification/SkDt.py',
    model_class='SkDt',
    dependencies={ 'scikit-learn': '0.20.0' }
)

Listing available models by task

Example:

client.get_available_models(task='IMAGE_CLASSIFICATION')

Output:

[{'access_right': 'PRIVATE',
 'datetime_created': 'Mon, 17 Dec 2018 07:06:03 GMT',
 'dependencies': {'tensorflow': '1.12.0'},
 'id': '45df3f34-53d7-4fb8-a7c2-55391ea10030',
 'name': 'TfFeedForward',
 'task': 'IMAGE_CLASSIFICATION',
 'user_id': 'fb5671f1-c673-40e7-b53a-9208eb1ccc50'},
 {'access_right': 'PRIVATE',
 'datetime_created': 'Mon, 17 Dec 2018 07:06:03 GMT',
 'dependencies': {'scikit-learn': '0.20.0'},
 'id': 'd0ea96ce-478b-4167-8a84-eb36ae631235',
 'name': 'SkDt',
 'task': 'IMAGE_CLASSIFICATION',
 'user_id': 'fb5671f1-c673-40e7-b53a-9208eb1ccc50'}]

Deleting a model

Example:

client.delete_model('fb5671f1-c673-40e7-b53a-9208eb1ccc50')