Models

Models are an essential part of Neurodeploy — they are the containers for the persisted pre-trained AI models that will be deployed and will allow you to generate your predictions. On this page, we’ll dive into the different models endpoints you can use to manage models programmatically. We'll look at how to query, create, update, and delete models.

The AI models model

The AI models model contains all the information about the AI model that you pre-trained. Models can be pre-trained using Scikit-learn, TensorFlow or Pytorch. They can be persisted using H5, Joblib or Pickle.

Properties

  • Name
    model_name
    Type
    string
    Description

    Unique identifier for the model (accross all our clients).

  • Name
    is_public
    Type
    boolean
    Description

    Boolean to identify if a model can be accessible without using any key.

  • Name
    library
    Type
    string
    Description

    The library used to train the AI model. Possible values : Scikit-learn, TensorFlow, Pytorch.

  • Name
    filetype
    Type
    string
    Description

    The type of persistence used for the file. Possible values : H5, Pickle, Joblib.

  • Name
    updated_at
    Type
    timestamp
    Description

    Timestamp of when the model was last used by the predict endpoint. user.

  • Name
    created_at
    Type
    timestamp
    Description

    Timestamp of when the model was created.

  • Name
    deleted_at
    Type
    timestamp
    Description

    TODO Timestamp of when the model was archived.


GET/ml-models

List all ML models

This endpoint allows you to retrieve a paginated list of all your ML models. By default, a maximum of ten models are shown per page.

Optional attributes

  • Name
    limit
    Type
    integer
    Description

    Limit the number of models returned.

  • Name
    deleted
    Type
    boolean
    Description

    Only show models that have deleted_at different than null.

  • Name
    used
    Type
    boolean
    Description

    Only show models that have last_used_at different than null.

Request

GET
/ml-models
curl --location 'https://user-api.neurodeploy.com/ml-models' \
--header 'Authorization: Bearer BEARER_TOKEN'
  -d limit=10

Response

{
"models": [
    {
        "filetype": "h5",
        "library": "tensorflow",
        "created_at": "2023-05-02T07:27:06.739805",
        "is_public": false,
        "updated_at": "2023-05-10T20:39:39.325670",
        "model_name": "abc"
    },
    {
        "filetype": "h5",
        "library": "tensorflow",
        "created_at": "2023-05-11T05:10:13.916465",
        "is_public": true,
        "updated_at": "2023-05-11T05:16:49.739782",
        "model_name": "xyz"
    }
]
}

PUT/ml-models/

Update ML Model details or Create a new Model

This endpoint allows you to update some details of an ML model.

Through the sdk the deploy function also allows you to deploy a model directly by the persisted file or by the trained model.
We deploy the model that was trained above using the neuro.deploy command, providing it with a model name of our choosing. This command will send our model to the Neurodeploy infrastructure and make it accessible over the internet. With this single command, we have deployed our machine learning model!

Required attributes

  • Name
    lib
    Type
    string
    Description

    The library used to train the AI model. Possible values : Scikit-learn, TensorFlow, Pytorch

  • Name
    filetype
    Type
    string
    Description

    The type of persistence used for the file. Possible values : H5, Pickle, Joblib

  • Name
    is_public
    Type
    boolean
    Description

    Boolean to identify if a model can be accessible without using any key.

Request

PUT
/ml-models/model_name
curl --location --request PUT 'https://user-api.{{domain_name}}/ml-models/{{model_name}}?lib=tensorflow&filetype=h5&is_public=true' \
--header 'Authorization: Bearer BEARER_TOKEN'

Response success

{
"model_name": "scikit_learn_open_dataset_iris_2",
"model_type": "scikit-learn",
"persistence_type": "joblib",
"uploaded_at": "2023-03-28T03:54:22+00:00"
}

Response additional actions

{
"message": "Please upload your tensorflow h5 model to complete the process.",
"url": "https://neurodeploy-staging-us-east-1.s3.amazonaws.com/",
"fields": {
    "x-amz-meta-username": "lousydropout",
    "x-amz-meta-model_name": "abc",
    "x-amz-meta-lib": "tensorflow",
    "x-amz-meta-filetype": "h5",
    "Content-Type": "model/h5",
    "key": "a52df0c8-843a-48f9-b2fb-726f3a727945",
    "AWSAccessKeyId": "ASIAWWJYOSALBH4EQXHE",
    "x-amz-security-token": "IQoJb3JpZ2luX2VjEKn//////////wEaCXVzLWVhc3QtMSJGMEQCIF1SDuA70n0Cf5oitUu2xhwYMlp9HIeL+mn02HPvjB2zAiBzmuqzSed9wSCxlrqa/VmRsGdCGNi3vqFOkVTnLLIQ7CqUAwjC//////////8BEAAaDDQ2MDIxNjc2NjQ4NiIM3IyH6q+m/m7ohSV6KugCs3GICzF35xtPJGHYqPQaU3e8MhLmR0e4GA8HB8jgPXD/8QdJSpmezb8yWWglEJq7PzwI++2NZYXaJoDnzfPhY9fYHvWYXhZ8uUeZNsC2tCYSRCU6MItFpB8CNN74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TYrTHZ4RHM5c2xWQkJ5cCtmMTJJRm1jYmd6VythY1RtY2lVWHd4L2dmZG1IY3ZpOUd3dVk5NVcwYW05ellzN1lmcDhMSDFyM2xMaHdnZVpyWGhpTjkvTlVZbDA9In1dfQ==",
    "signature": "0FWgS0LJ2oyLFbZkmFEyAbFpTsk="
}
}

GET/ml-models/model-name

Get ML Model details

This endpoint allows you to retrieve an ML model by providing the ML model name. Refer to the list at the top of this page to see which properties are included with model objects.

Request

GET
/ml-models/model_name'
curl --location 'https://user-api.neurodeploy.com/ml-models/abc' \
--header 'Authorization: Bearer BEARER_TOKEN'

Response

{
"filetype": "h5",
"library": "tensorflow",
"created_at": "2023-05-02T07:27:06.739805",
"updated_at": "2023-05-12T16:55:25.577078",
"model_name": "abc"
}

DELETE/ml-models/{{model_name}}

Delete an ML model

This endpoint allows you to delete your ML model in Neurodeploy. Note: This will permanently delete the model and all its predictions if stores — archive it instead if you want to be able to restore it later.

Request

DELETE
/ml-models/{{model_name}}
curl --location --request DELETE 'https://user-api.neurodeploy.com/ml-models/my_model_name' \
--header 'Authorization: Bearer BEARER_TOKEN'

Response

{
  "message": "deleted model my_model_name"
}