Skip to content

[Bug]: OnnxModelHandlerNumpy and XGBoostModelHandler ignore model updates from model_metadata_pcoll #41384

Done

Description

@karthik-0306

What happened?

OnnxModelHandlerNumpy (onnx_inference.py) and XGBoostModelHandler (xgboost_inference.py) don't override ModelHandler.update_model_path, which is a no-op in the base class. When RunInference gets a new ModelMetadata on model_metadata_pcoll (for example from WatchFilePattern), _RunInferenceDoFn._load_model calls update_model_path(new_path) and then load_model(), which reloads the original model_uri / model_state. The pipeline keeps using the old model, with no error or warning, and caches it under the new model's tag.

Repro: two LinearRegression models converted with skl2onnx, a.onnx (y = x) and b.onnx (y = 100x):

side = p | 'side' >> beam.Create([ModelMetadata(model_id='b.onnx', model_name='b')])
_ = (p | beam.Create([np.array([2.0], dtype=np.float32)])
       | RunInference(OnnxModelHandlerNumpy('a.onnx'), model_metadata_pcoll=side))

The prediction is 2.0 (model a). The same pipeline with SklearnModelHandlerNumpy and pickled models returns 200.0 with model_id set to b.pkl. The ONNX results also have model_id=None, because run_inference doesn't pass model_id to _convert_to_result.

The PyTorch, sklearn, TensorFlow and HuggingFace handlers implement update_model_path. Side-input model updates (#25200) and the ONNX handler (#24911) were merged a week apart in February 2023, and the XGBoost handler (#24965) a month later.

Expected: after the side input emits b.onnx, RunInference uses model b, as it does for the sklearn handler. I plan to add update_model_path to both handlers and set model_id on the ONNX results.

Version: master at b791929 (2.79.0.dev).

Issue Priority

Priority: 2 (default / most bugs should be filed as P2)

Issue Components

  • Component: Python SDK
  • Component: Java SDK
  • Component: Go SDK
  • Component: Typescript SDK
  • Component: IO connector
  • Component: Beam YAML
  • Component: Beam examples
  • Component: Beam playground
  • Component: Beam katas
  • Component: Website
  • Component: Infrastructure
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Prism Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner

Activity

  1. karthik-0306 commented on Nov 16, 2026

    @karthik-0306
    ContributorAuthor

    .take-issue

  2. added this to the 2.79.0 Release milestone on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions