Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions server/text_generation_server/layers/layernorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ def load_layer_norm_no_bias(cls, prefix, weights, eps):
if SYSTEM == "cuda":
import dropout_layer_norm

major, _ = torch.cuda.get_device_capability()
is_blackwell = major > 9

class FastLayerNorm(nn.LayerNorm):
def forward(self, hidden_states, residual=None):
if hidden_states.shape[-1] > 8192:
if hidden_states.shape[-1] > 8192 or is_blackwell:
if residual is not None:
hidden_states += residual
residual = hidden_states
Expand Down Expand Up @@ -142,7 +145,7 @@ def forward(self, hidden_states, residual=None):
self.variance_epsilon,
)
return out, residual
elif hidden_states.shape[-1] > 8192:
elif hidden_states.shape[-1] > 8192 or is_blackwell:
if residual is not None:
hidden_states += residual
residual = hidden_states
Expand Down