Skip to content
Merged
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
6 changes: 2 additions & 4 deletions optimum/habana/transformers/models/llama/modeling_llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@

try:
from habana_frameworks.torch.hpex.normalization import FusedRMSNorm as FusedRMSNorm

has_fused_rms_norm = True
except ImportError:
has_fused_rms_norm = False
print("Not using HPU fused kernel for RMSNorm")
FusedRMSNorm = None

try:
from habana_frameworks.torch.hpex.kernels import FusedSDPA
Expand Down Expand Up @@ -71,7 +69,7 @@ def gaudi_llama_rmsnorm_forward(self, hidden_states):
The only differences are:
- override RMSNorm with Habana fused RMSNorm
"""
if hidden_states.device.type == "hpu" and has_fused_rms_norm:
if hidden_states.device.type == "hpu" and FusedRMSNorm:
# mixed dtypes are not good for FusedRMSNorm, both inputs need to have same dtype
if hidden_states.dtype != self.weight.dtype:
orig_dtype = hidden_states.dtype
Expand Down