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

This commit is contained in:
Jee Li
2024-05-01 12:18:14 +08:00
committed by GitHub
parent c3845d82dc
commit d6f4bd7cdd
9 changed files with 87 additions and 0 deletions

View File

@@ -105,6 +105,14 @@ class VocabParallelEmbedding(torch.nn.Module):
output = tensor_model_parallel_all_reduce(output_parallel)
return output
def extra_repr(self) -> str:
s = f"num_embeddings={self.num_embeddings_per_partition}"
s += f", embedding_dim={self.embedding_dim}"
s += f", org_vocab_size={self.org_vocab_size}"
s += f', num_embeddings_padded={self.num_embeddings_padded}'
s += f', tp_size={self.tp_size}'
return s
class ParallelLMHead(VocabParallelEmbedding):
"""Parallelized LM head.