Model commands

Model commands allow you to manage machine learning models in the Snowflake Model Registry.

You can create and manage models in Python using the Snowpark Model Registry API.

Model commands

Model version commands

Model methods

You can call or invoke methods of a model using the model_name!method_name(...) syntax. The methods available on a model are determined by the underlying Python model class. For example, many types of models use a method named predict for inference.

To invoke a method of the default version of a model, use the syntax shown here, passing arguments to the method, if any, between the parentheses, and providing the name of the table containing the inference data in the FROM clause.

SELECT <model_name>!<method_name>(...) FROM <table_name>;
Copy

To invoke a method of a specific version of a model, first create an alias to the specific version of the model using WITH, then invoke the desired method through the alias.

WITH <model_version_alias> AS MODEL <model_name> VERSION <version_or_alias_name>
    SELECT <model_version_alias>!<method_name>(...) FROM <table_name>;
Copy

For example, to call the latest version of a model through the LAST alias:

WITH latest AS MODEL my_model VERSION LAST
    SELECT latest!predict(...) FROM my_table;
Copy
Language: English