MySQL AI User Guide
The
ML_MODEL_UNLOAD
routine unloads a model from AutoML. Review
ML_MODEL_UNLOAD
parameter descriptions.
Review the following
You can verify what models are currently loaded with the
ML_MODEL_ACTIVE
routine before and after unloading the model.
Verify what models are currently loaded with the
ML_MODEL_ACTIVE
routine.
mysql> CALL sys.ML_MODEL_ACTIVE('all', @model_info);
Select the session variable created to view all loaded models.
mysql> SELECT JSON_PRETTY(@model_info);
+-----------------------------------------------------------+
| JSON_PRETTY(@model_info) |
+-----------------------------------------------------------+
| [
{
"total model size(bytes)": 50209
},
{
"user1": [
{
"recommendation_use_case": {
"format": "HWMLv2.0",
"model_size(byte)": 15609
}
},
{
"recommendation_use_case2": {
"format": "HWMLv2.0",
"model_size(byte)": 8766
}
},
{
"recommendation_use_case3": {
"format": "HWMLv2.0",
"model_size(byte)": 8402
}
},
{
"recommendation_use_case4": {
"format": "HWMLv2.0",
"model_size(byte)": 17432
}
}
]
}
] |
+-----------------------------------------------------------+
1 row in set (0.0411 sec)
Refer to the appropriate model handle to unload. Alternatively, use the session variable for the model handle.
The following example unloads a model by using the model handle:
mysql> CALL sys.ML_MODEL_UNLOAD('recommendation_use_case');
Where:
recommendation_use_case
is the
model handle.
The following example unloads a model by using the session variable for the model handle:
mysql> CALL sys.ML_MODEL_UNLOAD(@recommendation_model);
Where:
@recommendation_model
is the
assigned session variable for the model handle.
Run
ML_MODEL_ACTIVE
again to confirm the model is successfully unloaded
mysql>CALL sys.ML_MODEL_ACTIVE('all', @model_info);
mysql>SELECT JSON_PRETTY(@model_info);
+-----------------------------------------------------------+ | JSON_PRETTY(@model_info) | +-----------------------------------------------------------+ | [ { "total model size(bytes)": 34600 }, { "user1": [ { "recommendation_use_case2": { "format": "HWMLv2.0", "model_size(byte)": 8766 } }, { "recommendation_use_case3": { "format": "HWMLv2.0", "model_size(byte)": 8402 } }, { "recommendation_use_case4": { "format": "HWMLv2.0", "model_size(byte)": 17432 } } ] } ] | +-----------------------------------------------------------+ 1 row in set (0.0411 sec)
The list of loaded models shows the model is unloaded.
Review how to Create a Machine Learning Model.
Review Machine Learning Use Cases to create machine learning models with sample datasets.