Install FuseML and fuseml-core client
Follow the FuseML installation guide to install all necessary services, including fuseml-core
.
Install fuseml
binary to some place within your PATH so you do not need to execute it with the full path.
Set the value of FUSEML_SERVER_URL
, to point to the server URL:
export FUSEML_SERVER_URL=http://$(kubectl get VirtualService -n fuseml-core fuseml-core -o jsonpath="{.spec.hosts[0]}")
Assign the workflow to the codeset
fuseml workflow assign --name mlflow-e2e --codeset-name sklearn --codeset-project mlflow
Now that the Workflow is assigned to the Codeset, a new workflow run was created. To check the workflow run status, execute the following command:
fuseml workflow list-runs --name mlflow-e2e
This command shows you detailed information about workflows runs. You can also access the TEKTON_DASHBOARD_URL
to check all available workflow runs.
Once the running workflow reaches the Succeeded
state, a new FuseML application has been be created serving the trained model from the Codeset.
Use the prediction service
Check the available applications by running the following command:
fuseml application list
This should produce output similar to the following (notice the fake "example.io" domain here):
+---------------------------+-----------+----------------------------------------------+-------------------------------------------------------------------------------------------------------+--------------+
| NAME | TYPE | DESCRIPTION | URL | WORKFLOW |
+---------------------------+-----------+------------------------------------------------------+------------------------------------------------------------------------------------------------+------------+
| mlflow-sklearn-mlflow-e2e | predictor | Application generated by mlflow-e2e workflow | http://mlflow-sklearn-mlflow-e2e.fuseml-workloads.example.io/v2/models/mlflow-sklearn-mlflow-e2e/infer | mlflow-e2e |
+--------------------------------+-----------+-----------------------------------------+--------------------------------------------------------------------------------------------------------+------------+
Save the application URL in a variable for using in a later step:
PREDICTION_URL=$(fuseml application get -n mlflow-sklearn-mlflow-e2e --format json | jq -r ".url")
Take a look at the example data file from the examples repository, the prediction will be made according to the submitted data
:
> cat fuseml-examples/prediction/data-sklearn.json
{
"inputs": [
{
"name": "input-0",
"shape": [1, 11],
"datatype": "FP32",
"data": [
[12.8, 0.029, 0.48, 0.98, 6.2, 29, 7.33, 1.2, 0.39, 90, 0.86]
]
}
]
}
Now perform a request to $PREDICTION_URL
with the example data:
curl -d @fuseml-examples/prediction/data-sklearn.json $PREDICTION_URL
The output should look as follows, the prediction result is under outputs/data
:
{
"model_name": "mlflow-sklearn-mlflow-e2e",
"model_version": null,
"id": "44d5d037-052b-49b6-aace-1c5346a35004",
"parameters": null,
"outputs": [
{
"name": "predict",
"shape": [1],
"datatype": "FP32",
"parameters": null,
"data": [6.486344809506676]
}
]
}