[Bugfix] Fix: Fix multi loras with tp >=2 and LRU cache (#20873)
Signed-off-by: charent <19562666+charent@users.noreply.github.com>
This commit is contained in:
+5
-3
@@ -682,12 +682,14 @@ class MergedColumnParallelLinearWithLoRA(ColumnParallelLinearWithLoRA):
|
||||
def slice_lora_b(
|
||||
self, lora_b: list[Union[torch.Tensor, None]]
|
||||
) -> list[Union[torch.Tensor, None]]:
|
||||
sliced_lora_b = [None] * self.n_slices
|
||||
for i, (shard_id, shard_size) in enumerate(
|
||||
zip(self.output_ids, self.output_slices)):
|
||||
if (lora_b_i := lora_b[i]) is not None:
|
||||
lora_b[i] = lora_b_i[:, shard_size * shard_id:shard_size *
|
||||
(shard_id + 1)]
|
||||
return lora_b
|
||||
sliced_lora_b[i] = lora_b_i[:,
|
||||
shard_size * shard_id:shard_size *
|
||||
(shard_id + 1)]
|
||||
return sliced_lora_b
|
||||
|
||||
def slice_bias(
|
||||
self, bias: list[Union[torch.Tensor,
|
||||
|
||||
Reference in New Issue
Block a user