Using Predictors

Machine Learning on Device

NatML provides extensive infrastructure for making on-device predictions with predictors.

Users are billed a flat monthly subscription for Edge predictor usage. View our pricing plans.

Creating a Session

mutation {
    # Create a prediction session.
    createSession (input: CreateSessionInput!): Session!
}

The first step in making a prediction is creating a Session. The session provides the model graph, along with supplementary data needed to make predictions. The mutation requires an input argument:

input CreateSessionInput {
    # Predictor tag.
    tag: String!
    # Device platform.
    platform: Platform!
    # Desired graph format for session predictor
    format: GraphFormat
    # Application bundle identifier.
    bundle: ID
    # NatML client framework.
    framework: Framework
    # Device model.
    device: String
}

The createSession mutation requires specifying an authorization header populated with your NatML access key:

{ "Authorization": "Bearer <HUB_ACCESS_KEY>" }

See the Inspecting the Platform section of the Session type for more information on the platform.

See the Using the Predictor section of the Predictor type for more information on the framework.

If a format is not specified, then it is inferred from the platform.

Fetching the Model Graph

type Session {
    # Session graph data.
    graph: URL
}

See the Fetching the Model Graph section of the Session type. Once the graph is fetched, you can then create an on-device inference session with NatML SDK for your development framework.

You can cache the model graph on-device, but note that a specific model graph is only ever guaranteed to work on the exact device that created the Session.

Last updated