Skip to content

Commit

Permalink
Add warning + doc callout when encountering ri pickling errors (#32063)
Browse files Browse the repository at this point in the history
  • Loading branch information
damccorm authored Aug 7, 2024
1 parent ebba3bb commit 44a9942
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sdks/python/apache_beam/ml/inference/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,15 @@ def _run_inference(self, batch, inference_args):
except BaseException as e:
if self._metrics_collector:
self._metrics_collector.failed_batches_counter.inc()
if (e is pickle.PickleError and
self._model_handler.share_model_across_processes()):
raise TypeError(
'Pickling error encountered while running inference. '
'This may be caused by trying to send unpickleable '
'data to a model which is shared across processes. '
'For more information, see '
'https://beam.apache.org/documentation/ml/large-language-modeling/#pickling-errors' # pylint: disable=line-too-long
) from e
raise e
predictions = list(result_generator)

Expand Down

0 comments on commit 44a9942

Please sign in to comment.