Using Predictors
Machine Learning on Device
NatML provides extensive infrastructure for making on-device predictions with predictors.
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>
" }If a
format
is not specified, then it is inferred from the platform
.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 modified 1yr ago