Skip to content

Commit b766ef6

Browse files
committed
address #30
1 parent 4184e37 commit b766ef6

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "transfusion-pytorch"
3-
version = "0.6.4"
3+
version = "0.6.5"
44
description = "Transfusion in Pytorch"
55
authors = [
66
{ name = "Phil Wang", email = "lucidrains@gmail.com" }

transfusion_pytorch/transfusion.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ def default(v, d):
118118
def identity(t):
119119
return t
120120

121+
def always(val):
122+
def inner(*args, **kwargs):
123+
return val
124+
return inner
125+
121126
def first(it):
122127
return it[0]
123128

@@ -776,7 +781,7 @@ def __init__(
776781
nn.Linear(dim, heads),
777782
nn.Sigmoid(),
778783
Rearrange('b n h -> b h n 1') # add head dimension
779-
) if learned_value_residual_mix else (lambda _: 0.5)
784+
) if learned_value_residual_mix else always(0.5)
780785

781786
self.to_gates = nn.Sequential(
782787
nn.Linear(dim, heads, bias = False),

0 commit comments

Comments
 (0)