Skip to content

Commit 43ccc05

Browse files
committed
Review compliance 2
1 parent 11e5615 commit 43ccc05

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/transformers/generation/continuous_batching/cache.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ def __init__(
166166

167167
# Check if the KV heads are part of the TP plan. If they are not, the cache does not need plan for TP.
168168
# TODO: this is fragile. If your model fails to TP properly because of this, please open an issue.
169-
kv_is_tp = "layers.*.self_attn.k_proj" in config.tp_plan and "layers.*.self_attn.v_proj" in config.tp_plan
169+
tp_plan = getattr(config, "tp_plan", {})
170+
kv_is_tp = "layers.*.self_attn.k_proj" in tp_plan and "layers.*.self_attn.v_proj" in tp_plan
170171

171172
# If the KV heads are TP'ed, each KV head is dispatched to a different GPU, so the effective number of KV heads
172173
# per GPU is simply divided by the TP size

src/transformers/generation/continuous_batching/distributed.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def __init__(self, device_mesh: DeviceMesh | None) -> None:
6060
self.dp_size = self.world_size // self.tp_size
6161

6262
def infer_if_tp_driver(self) -> bool:
63-
"""Infer if the current process is the TP driver."""
6463
return self.tp_local_rank == 0
6564

6665
def destroy_cpu_comm_group(self) -> None:

0 commit comments

Comments
 (0)