Commit f2860fa
authored
use utils._convert_to_result for huggingface_inference (#36593)
* fix(huggingface_inference): use utils._convert_to_result for batch processing
The internal _convert_to_result function was incorrectly handling batches with multiple elements by wrapping predictions in a list. This caused all predictions to be grouped into a single result. Replace it with utils._convert_to_result which properly processes each element in the batch individually.
Added test case to verify correct batch processing behavior.
* test(huggingface): add batched examples test for tf inference
Add test case to verify batch processing with tensorflow examples in huggingface inference1 parent ef07e40 commit f2860fa
File tree
2 files changed
+29
-17
lines changed- sdks/python/apache_beam/ml/inference
2 files changed
+29
-17
lines changedLines changed: 1 addition & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
563 | 563 | | |
564 | 564 | | |
565 | 565 | | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | 566 | | |
577 | 567 | | |
578 | 568 | | |
| |||
715 | 705 | | |
716 | 706 | | |
717 | 707 | | |
718 | | - | |
| 708 | + | |
719 | 709 | | |
720 | 710 | | |
721 | 711 | | |
| |||
Lines changed: 28 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
130 | 152 | | |
131 | 153 | | |
132 | 154 | | |
| |||
0 commit comments