[Misc]Add customized information for models (#4132)

This commit is contained in:
Jee Li
2024-04-30 21:18:14 -07:00
committed by GitHub
parent c3845d82dc
commit d6f4bd7cdd
9 changed files with 87 additions and 0 deletions
+7
View File
@@ -47,3 +47,10 @@ class Attention(nn.Module):
) -> torch.Tensor:
return self.impl.forward(query, key, value, kv_cache, attn_metadata,
kv_scale)
def extra_repr(self) -> str:
s = f"head_size={self.impl.head_size}" # type: ignore
s += f", num_heads={self.impl.num_heads}" # type: ignore
s += f", num_kv_heads={self.impl.num_kv_heads}" # type: ignore
s += f", scale={self.impl.scale}" # type: ignore
return s