Repository navigation
[RunInference] Pass the device to a custom inference_fn in HuggingFaceModelHandlerTensor - #41086
Conversation
There was a problem hiding this comment.
📋 Review Summary
This PR fixes a bug in HuggingFaceModelHandlerTensor.run_inference where inference_args was passed twice instead of passing self._device as the third argument to custom inference_fn callbacks. The change aligns the implementation with the TensorInferenceFn signature and HuggingFaceModelHandlerKeyedTensor, and includes a regression unit test.
🔍 General Feedback
- The fix is clean, minimal, and well-tested.
CHANGES.mdis appropriately updated.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
|
Assigning reviewers: R: @jrmccluskey 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). |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41086 +/- ##
============================================
- Coverage 59.25% 58.54% -0.71%
+ Complexity 4894 2277 -2617
============================================
Files 1461 1132 -329
Lines 186046 169707 -16339
Branches 3648 1485 -2163
============================================
- Hits 110244 99362 -10882
+ Misses 72445 67801 -4644
+ Partials 3357 2544 -813
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:
|
…erence-fn-device # Conflicts: # CHANGES.md
Fixes #41085
HuggingFaceModelHandlerTensor.run_inferencecalled a custominference_fnwith(batch, model, inference_args, inference_args, model_id).TensorInferenceFnis(batch, model, device, inference_args, model_id)and the keyed handler already passesself._device, so custom functions received theinference_argsdict asdevice. This passesself._device.Added a regression test whose
inference_fnrecords thedeviceandinference_argsit receives. It fails on master ({'add': True} != 'CPU') and passes with the fix;huggingface_inference_test.py: 20 passed. yapf and ruff are clean on the touched files. CHANGES.md updated.R: @jrmccluskey