[Bugfix] Fix sync_and_slice_intermediate_tensors (#21537)

Signed-off-by: Rui Qiao <ruisearch42@gmail.com>
This commit is contained in:
Rui Qiao 2025-07-25 17:07:58 -07:00 committed by GitHub
parent 2eddd437ba
commit cea96a0156
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1270,7 +1270,7 @@ class GPUModelRunner(LoRAModelRunnerMixin, KVConnectorModelRunnerMixin):
if sync_self:
assert intermediate_tensors is not None
for k, v in intermediate_tensors.items():
is_scattered = "residual" and is_residual_scattered
is_scattered = k == "residual" and is_residual_scattered
copy_len = num_tokens // tp if is_scattered else \
num_tokens
self.intermediate_tensors[k][:copy_len].copy_(