[TPU] Support single and multi-host TPUs on GKE (#7613)
This commit is contained in:
@@ -123,7 +123,10 @@ class PallasAttentionBackendImpl(AttentionImpl):
|
||||
raise NotImplementedError("TPU version must be 4 or higher.")
|
||||
|
||||
self.megacore_mode = None
|
||||
tpu_type = torch_xla.tpu.get_tpu_env()["TYPE"].lower()
|
||||
tpu_env = torch_xla.tpu.get_tpu_env()
|
||||
tpu_type = tpu_env.get("TYPE") or tpu_env.get("ACCELERATOR_TYPE")
|
||||
tpu_type = tpu_type.lower()
|
||||
|
||||
if "lite" not in tpu_type:
|
||||
if self.num_kv_heads % 2 == 0:
|
||||
self.megacore_mode = "kv_head"
|
||||
|
||||
Reference in New Issue
Block a user