Skip to content

Commit

Permalink
[TPU] Skip creating empty tensor (vllm-project#7630)
Browse files Browse the repository at this point in the history
  • Loading branch information
WoosukKwon authored Aug 17, 2024
1 parent bbf55c4 commit ce14335
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vllm/worker/tpu_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,10 @@ def _make_src_to_dst(
mapping: List[Tuple[int, int]],
src_device: Union[torch.device, str],
dst_device: Union[torch.device, str],
) -> Tuple[torch.Tensor, torch.Tensor]:
) -> Optional[Tuple[torch.Tensor, torch.Tensor]]:
if not mapping:
return None

src_indices = [i for i, _ in mapping]
dst_indices = [i for _, i in mapping]
src_indices = torch.tensor(src_indices,
Expand Down

0 comments on commit ce14335

Please sign in to comment.