MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / repartition

Method repartition

SwissArmyTransformer/sat/model/transformer.py:115–118  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

113 return HOOKS_DEFAULT['attention_forward'](self, hidden_states, mask, **kw_args)
114
115 def repartition(self):
116 world_size = get_model_parallel_world_size()
117 self.num_attention_heads_per_partition = divide(self.num_attention_heads, world_size)
118 self.hidden_size_per_partition = self.hidden_size_per_attention_head * self.num_attention_heads_per_partition
119
120class CrossAttention(torch.nn.Module):
121 """Parallel cross-attention layer for Transformer"""

Callers

nothing calls this directly

Calls 2

divideFunction · 0.90

Tested by

no test coverage detected