Skip to content

Commit

Permalink
Merge branch 'main' into tyler/monkeypatch-qwen2vl
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-romero authored Sep 7, 2024
2 parents 929f30c + 638b310 commit cf90fdd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/liger_kernel/transformers/layer_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ def __init__(self, hidden_size, eps=1e-6, bias=False, init_fn="ones"):
"ones",
"zeros",
], f"init_fn must be either 'ones' or 'zeros', got {init_fn}"
self.hidden_size = hidden_size
self.eps = eps
self.weight = nn.Parameter(
torch.ones(hidden_size) if init_fn == "ones" else torch.zeros(hidden_size)
)
Expand All @@ -23,3 +25,6 @@ def forward(self, hidden_states):
return LigerLayerNormFunction.apply(
hidden_states, self.weight, self.bias, self.variance_epsilon
)

def extra_repr(self):
return f"{self.hidden_size}, eps={self.eps}"
3 changes: 3 additions & 0 deletions src/liger_kernel/transformers/rms_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ def forward(self, hidden_states):
self.offset,
self.casting_mode,
)

def extra_repr(self):
return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}, offset={self.offset}"
6 changes: 3 additions & 3 deletions src/liger_kernel/triton/monkey_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ def apply_liger_triton_cache_manager():
Experimental feature to get around transient FileNotFoundError in triton compilation.
For more details please see https://github.com/triton-lang/triton/pull/4295
"""
os.environ["TRITON_CACHE_MANAGER"] = (
"liger_kernel.triton.monkey_patch:LigerTritonFileCacheManager"
)
os.environ[
"TRITON_CACHE_MANAGER"
] = "liger_kernel.triton.monkey_patch:LigerTritonFileCacheManager"

0 comments on commit cf90fdd

Please sign in to comment.