The `check` action, part of the 'Analytic Store Scoring' action set, validates an ONNX (Open Neural Network Exchange) model. This is a crucial preliminary step to ensure the model is well-formed, structurally sound, and compatible with SAS Viya before it is uploaded or used for scoring tasks. The action verifies the integrity of the ONNX file, confirming that it adheres to the standard format.
| Parameter | Description |
|---|---|
| onnx | Specifies the binary large object (BLOB) that contains the ONNX model to be validated. This is typically a reference to a CAS table containing the model data. |
To use the `check` action, the ONNX model must first be available in CAS as a binary large object. The following DATA step reads an ONNX file from a server-accessible path and loads its binary content into a CAS table. This table can then be referenced by the `check` action.
| 1 | /* This example assumes the ONNX file is accessible from the CAS server */ |
| 2 | DATA casuser.onnx_model_blob (copies=0); |
| 3 | LENGTH onnx_model 8; |
| 4 | INFILE "/path/to/your/model.onnx" recfm=f lrecl=256; |
| 5 | INPUT onnx_model 8.; |
| 6 | RUN; |
| 7 | |
| 8 | PROC CAS; |
| 9 | TABLE.promote / name="onnx_model_blob" caslib="casuser"; |
| 10 | RUN; |
This example demonstrates the fundamental use of the `check` action. It points to a CAS table containing the ONNX model's binary data to perform the validation.
| 1 | |
| 2 | PROC CAS; |
| 3 | astore.check / onnx={TABLE={caslib='casuser', name='onnx_model_blob'}}; |
| 4 | |
| 5 | RUN; |
| 6 |
This example shows how to execute the `check` action and store the outcome in a CASL variable named 'validationResult'. Printing this variable allows for programmatic inspection of the validation status. A successful check is a prerequisite for using the model with other actions like `score` or `upload`.
| 1 | |
| 2 | PROC CAS; |
| 3 | astore.check RESULT=validationResult / onnx={TABLE={caslib='casuser', name='onnx_model_blob'}}; |
| 4 | PRINT validationResult; |
| 5 | |
| 6 | RUN; |
| 7 |
A manufacturing company deploys ONNX models to edge devices for detecting machine anomalies. Before deployment, the MLOps pipeline validates the structural integrity of the 'v2....
A major bank uses a deep neural network for real-time fraud scoring. The model file is significantly large (several hundred MBs). The test ensures that the `check` action can ha...
During the transfer of a Credit Risk model from the training environment to the production CAS server, the file was corrupted (truncated). The pipeline must detect this invalid ...