pyspark - How to use input_example in MLFlow logged ONNX model in Databricks to make predictions? - Stack Overflow
I logged an ONNX model (converted from a pyspark model) in MLFlow like this:
with mlflow.start_run() as run:
mlflow.onnx.log_model(
onnx_model=my_onnx_model,
artifact_path="onnx_model",
input_example=input_example,
)
where input_example
is a Pandas dataframe that gets saved to artifacts.
On Databricks experiments page, I can see the model being logged along with input_example.json
that indeed contains the data I provided as input_example
while logging the model.
How to use that data now to make predictions for testing whether ONNX model was logged correctly or not? On model artifacts page in Databricks UI, I see:
from mlflow.models import validate_serving_input
model_uri = 'runs:/<some-model-id>/onnx_model'
# The logged model does not contain an input_example.
# Manually generate a serving payload to verify your model prior to deployment.
from mlflow.models import convert_input_example_to_serving_input
# Define INPUT_EXAMPLE via assignment with your own input example to the model
# A valid input example is a data instance suitable for pyfunc prediction
serving_payload = convert_input_example_to_serving_input(INPUT_EXAMPLE)
# Validate the serving payload works on the model
validate_serving_input(model_uri, serving_payload)
最新文章
- 谷歌的成功与失误:安卓迎变化眼镜前途未卜
- 安卓L最新曝光:可发挥64位计算特性!
- 全球PC销量创五年新低 硬件式微应用崛起
- 抓住“苹果”的尾巴,国产平板的突围之路
- regex - How do I force nginx basic authentication for files starting with a certain mask? - Stack Overflow
- python - DeltaTable map type - Stack Overflow
- reactjs - Why can't AWS Amplify find my components from a working version of my React App? - Stack Overflow
- azure active directory - Entra External Id: Include values provided by token requester in access token claims - Stack Overflow
- flutter - Uber category selection animation - Stack Overflow
- monit missing file in sys directory when restarting monit - Stack Overflow
- amazon web services - Virtualmin, Route53, and AssumeRole error when managing DNS from CLI - Stack Overflow
- c++ - inlining failed in call to ‘always_inline’ ‘vld1q_u16’ - cross compiling Node.js for armv6 - Stack Overflow
- windows - Significant 600 ms lag between TwinCAT 3 and Simulink using TCSymbol interface (TE1410). How can I reduce this latency
- jhipster - Jhispter cannot run - Stack Overflow
- angular - Infer types in callback chain based on `null` return as success Indicator - Stack Overflow
- javascript - onPointerOver and onPointerOut detect all child elements - Stack Overflow
- javascript - What are the benefits of Next.js Server Actions, and why should I use them instead of client-side API calls? - Stac