| 363 | |
| 364 | |
| 365 | class AllPool(PoolingMethod): |
| 366 | def get_supported_tasks(self) -> Set[PoolingTask]: |
| 367 | return {"encode"} |
| 368 | |
| 369 | def forward_all( |
| 370 | self, |
| 371 | hidden_states: paddle.Tensor, |
| 372 | pooling_cursor: PoolingCursor, |
| 373 | ) -> Union[list[paddle.Tensor], paddle.Tensor]: |
| 374 | |
| 375 | assert not pooling_cursor.is_partial_prefill(), "partial prefill not supported with ALL pooling" |
| 376 | hidden_states_lst = list(hidden_states.split(pooling_cursor.num_scheduled_tokens_cpu.tolist())) |
| 377 | |
| 378 | return [hidden_states_lst[i] for i in pooling_cursor.index] |
| 379 | |
| 380 | |
| 381 | class MeanPool(PoolingMethod): |
no outgoing calls