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
15 changes: 4 additions & 11 deletions examples/models/llama/static_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)
from executorch.examples.models.llama.lora import LoRALinear
from executorch.examples.models.llama.model_args import ModelArgs
from executorch.examples.models.llama.norm import ScalelessRMSNorm

Check warning on line 18 in examples/models/llama/static_attention.py

View workflow job for this annotation

GitHub Actions / lintrunner

FLAKE8 F401

'executorch.examples.models.llama.norm.ScalelessRMSNorm' imported but unused See https://www.flake8rules.com/rules/F401.html.
from executorch.examples.models.llama.rope import Rope


Expand Down Expand Up @@ -898,18 +898,11 @@

def _init_qk_norms(self, config: ModelArgs, is_kv_shared_layer: bool) -> None:
if self.use_qk_norm:
if getattr(config, "qk_norm_affine", True):
self.q_norm = torch.nn.RMSNorm(self.head_dim, config.norm_eps)
if is_kv_shared_layer:
self.k_norm = nn.Identity()
else:
self.k_norm = torch.nn.RMSNorm(self.head_dim, config.norm_eps)
self.q_norm = torch.nn.RMSNorm(self.head_dim, config.norm_eps)
if is_kv_shared_layer:
self.k_norm = nn.Identity()
else:
self.q_norm = ScalelessRMSNorm(self.head_dim, eps=config.norm_eps)
if is_kv_shared_layer:
self.k_norm = nn.Identity()
else:
self.k_norm = ScalelessRMSNorm(self.head_dim, eps=config.norm_eps)
self.k_norm = torch.nn.RMSNorm(self.head_dim, config.norm_eps)
else:
self.q_norm = torch.nn.Identity()
self.k_norm = torch.nn.Identity()
Expand Down
Loading