karthik-0306 opened a new pull request, #41389:
URL: https://github.com/apache/beam/pull/41389

   Fixes #41384
   
   `OnnxModelHandlerNumpy` and `XGBoostModelHandler` didn't implement 
`update_model_path`, so when `RunInference` got a new `ModelMetadata` on 
`model_metadata_pcoll` (for example from `WatchFilePattern`), `load_model()` 
reloaded the original `model_uri` / `model_state` and 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 the `XGBoostModelHandler` base class, so the Numpy, Pandas, SciPy and 
Datatable handlers all get it. ONNX predictions now also set `model_id`, which 
was always `None`.
   
   Testing:
   - `test_pipeline_updates_model_from_side_input` starts on model a (y = 2x + 
0.5) and sends model b (y = 5x + 0.5) on the side input. On master it gets 
`4.5` with `model_id=None`; with the fix it gets `10.5` with `model_id` set to 
model b.
   - The new `test_update_model_path` tests for ONNX and XGBoost fail on master 
and pass with the fix.
   - Three existing ONNX tests now expect `model_id` to be set.
   - `onnx_inference_test.py` (TensorFlow tests not run locally): 12 passed, 1 
skipped. `xgboost_inference_test.py`, `sklearn_inference_test.py` and 
`base_test.py`: 177 passed, 4 skipped.
   - yapf and ruff are clean on the touched files. CHANGES.md updated.
   
   R: @jrmccluskey
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

  • [PR] [RunInference] Load updat... karthik-0306 (via GitHub) via github

Reply via email to