Skip to content

This feature is currently in Preview.

Register a model

Once you are satisfied with a trained model, you can register it in the Snowflake Model Registry under a database, schema, and name of your choice. Registered models are versioned and can be retrieved later for inference.

There are two ways to register a model:

  • Register a model immediately after training it in the current workflow.
  • Load a model that was trained in an earlier workflow and register it.

After calling gnn.fit(), call gnn.register_model() on the same GNN instance:

gnn = GNN(
exp_database="EXPERIMENTS_DB",
exp_schema="EXPERIMENTS_SC",
graph=gnn_graph,
property_transformer=pt,
train=Train,
validation=Val,
task_type="regression",
)
gnn.fit()
gnn.register_model(
model_database="PRODUCTION_DB",
model_schema="MODEL_REGISTRY",
model_name="my_dataset_model",
version_name="v1",
comment="First baseline model",
)

The arguments to register_model() are:

  • model_database and model_schema — the Snowflake database and schema where the model will be registered.
  • model_name — the model name under which the model will be registered in.
  • version_name — the version label for this registration. Use it to track multiple versions of the same model_name.
  • comment — a free-text description stored alongside the registered model.

The RelationalAI Native App must have permission to create models in model_database.model_schema. As a reminder, to grant the required permissions, run:

-- Grant access to required database and schema
GRANT USAGE ON DATABASE <DATABASE> TO APPLICATION RELATIONALAI;
GRANT USAGE ON SCHEMA <DATABASE>.<SCHEMA> TO APPLICATION RELATIONALAI;
-- Allow registering trained models
GRANT CREATE MODEL ON SCHEMA <DATABASE>.<SCHEMA> TO APPLICATION RELATIONALAI;

To register a model from an earlier training run, instantiate a GNN with the run’s model_run_id, call gnn.load() to retrieve the model, and then call gnn.register_model():

gnn = GNN(
exp_database="EXPERIMENTS_DB",
exp_schema="EXPERIMENTS_SC",
model_run_id="<model_run_id>",
source_concept=SourceConcept,
task_type="regression",
)
gnn.load()
gnn.register_model(
model_database="PRODUCTION_DB",
model_schema="MODEL_REGISTRY",
model_name="my_dataset_model",
version_name="v2",
comment="Ready for production",
)

The model_run_id value is the job ID of the original training run — the same identifier printed in the training logs and shown in the run in Snowflake Experiment Tracking (as the suffix in RUN_<job_id>, or under model_run_id in the run details). Also see Monitor training.

For the full list of valid and invalid GNN method-call sequences, see Understand GNN workflows.