Repository navigation
[RunInference] Load updated models in the ONNX and XGBoost model handlers - #41389
Conversation
There was a problem hiding this comment.
📋 Review Summary
This PR fixes #41384 by implementing update_model_path on OnnxModelHandlerNumpy and XGBoostModelHandler, enabling side-input model updates via model_metadata_pcoll (such as WatchFilePattern), and populating PredictionResult.model_id in OnnxModelHandlerNumpy.run_inference. The implementation is clean, consistent with existing ModelHandler implementations (such as SklearnModelHandlerNumpy and TFModelHandlerNumpy), and well-covered by unit and pipeline tests.
🔍 General Feedback
- Defining
update_model_pathon theXGBoostModelHandlerbase class cleanly propagates model refresh support to all XGBoost handler variants (Numpy,Pandas,SciPy, andDatatable). - The added unit tests (
test_update_model_path,test_update_model_path_without_path_keeps_model) and end-to-end pipeline test (test_pipeline_updates_model_from_side_input) thoroughly verify both model reloading andmodel_idpropagation.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
|
Assigning reviewers: R: @damccorm for label python. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
|
Reminder, please take a look at this pr: @damccorm |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #41389 +/- ##
============================================
- Coverage 58.05% 58.05% -0.01%
Complexity 2842 2842
============================================
Files 1210 1210
Lines 173310 173314 +4
Branches 2329 2329
============================================
- Hits 100617 100615 -2
- Misses 69978 69987 +9
+ Partials 2715 2712 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
# Conflicts: # CHANGES.md
Fixes #41384
OnnxModelHandlerNumpyandXGBoostModelHandlerdidn't implementupdate_model_path, so whenRunInferencegot a newModelMetadataonmodel_metadata_pcoll(for example fromWatchFilePattern),load_model()reloaded the originalmodel_uri/model_stateand the pipeline kept using the old model without an error. Both handlers now update the path, as the PyTorch, sklearn, TensorFlow and HuggingFace handlers already do. The update is on theXGBoostModelHandlerbase class, so the Numpy, Pandas, SciPy and Datatable handlers all get it. ONNX predictions now also setmodel_id, which was alwaysNone.Testing:
test_pipeline_updates_model_from_side_inputstarts on model a (y = 2x + 0.5) and sends model b (y = 5x + 0.5) on the side input. On master it gets4.5withmodel_id=None; with the fix it gets10.5withmodel_idset to model b.test_update_model_pathtests for ONNX and XGBoost fail on master and pass with the fix.model_idto be set.onnx_inference_test.py(TensorFlow tests not run locally): 12 passed, 1 skipped.xgboost_inference_test.py,sklearn_inference_test.pyandbase_test.py: 177 passed, 4 skipped.R: @jrmccluskey