Equimo 0.4.0a2__tar.gz → 0.4.0a3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {equimo-0.4.0a2/src/Equimo.egg-info → equimo-0.4.0a3}/PKG-INFO +1 -1
- {equimo-0.4.0a2 → equimo-0.4.0a3}/pyproject.toml +1 -1
- {equimo-0.4.0a2 → equimo-0.4.0a3/src/Equimo.egg-info}/PKG-INFO +1 -1
- equimo-0.4.0a3/src/equimo/__init__.py +1 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/layers/attention.py +9 -4
- equimo-0.4.0a2/src/equimo/__init__.py +0 -1
- {equimo-0.4.0a2 → equimo-0.4.0a3}/LICENSE.md +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/README.md +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/setup.cfg +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/Equimo.egg-info/SOURCES.txt +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/Equimo.egg-info/dependency_links.txt +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/Equimo.egg-info/requires.txt +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/Equimo.egg-info/top_level.txt +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/conversion/__init__.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/conversion/utils.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/experimental/__init__.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/experimental/text.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/io.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/layers/__init__.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/layers/activation.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/layers/convolution.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/layers/downsample.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/layers/dropout.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/layers/ffn.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/layers/generic.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/layers/mamba.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/layers/norm.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/layers/patch.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/layers/posemb.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/layers/sharing.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/layers/squeeze_excite.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/models/__init__.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/models/emamodel.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/models/fastervit.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/models/lowformer.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/models/mlla.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/models/partialformer.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/models/reduceformer.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/models/shvit.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/models/vit.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/models/vssd.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/ops/scan.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/src/equimo/utils.py +0 -0
- {equimo-0.4.0a2 → equimo-0.4.0a3}/tests/test_models.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.0-alpha.3"
|
|
@@ -97,7 +97,7 @@ class Attention(eqx.Module):
|
|
|
97
97
|
attn = jnp.where(mask == 0, jnp.finfo(attn.dtype).min, attn)
|
|
98
98
|
|
|
99
99
|
attn = jax.nn.softmax(attn, axis=-1)
|
|
100
|
-
attn = self.attn_drop(attn, inference=
|
|
100
|
+
attn = self.attn_drop(attn, inference=infeoence, key=key1)
|
|
101
101
|
|
|
102
102
|
x = jnp.einsum("hqk,hkd->hqd", attn, v)
|
|
103
103
|
x = rearrange(x, "h s d -> s (h d)")
|
|
@@ -1591,6 +1591,7 @@ class RFAttention(eqx.Module):
|
|
|
1591
1591
|
qkv: eqx.nn.Conv2d
|
|
1592
1592
|
aggreg: list[eqx.nn.Conv2d]
|
|
1593
1593
|
proj: SingleConvBlock
|
|
1594
|
+
proj_drop: eqx.nn.Dropout
|
|
1594
1595
|
|
|
1595
1596
|
def __init__(
|
|
1596
1597
|
self,
|
|
@@ -1604,6 +1605,7 @@ class RFAttention(eqx.Module):
|
|
|
1604
1605
|
scales: Sequence[int] = (5,),
|
|
1605
1606
|
use_bias: bool = False,
|
|
1606
1607
|
kernel_func: Callable = jax.nn.relu,
|
|
1608
|
+
proj_drop: float = 0.0,
|
|
1607
1609
|
# TODO: Benchmark against LN, RMSN, NsLN
|
|
1608
1610
|
norm_layer: eqx.Module = eqx.nn.GroupNorm,
|
|
1609
1611
|
norm_kwargs: dict = {},
|
|
@@ -1649,12 +1651,14 @@ class RFAttention(eqx.Module):
|
|
|
1649
1651
|
key=key_proj,
|
|
1650
1652
|
)
|
|
1651
1653
|
|
|
1654
|
+
self.proj_drop = eqx.nn.Dropout(proj_drop)
|
|
1655
|
+
|
|
1652
1656
|
def __call__(
|
|
1653
1657
|
self,
|
|
1654
|
-
x: Float[Array, "
|
|
1658
|
+
x: Float[Array, "dim height width"],
|
|
1655
1659
|
key: PRNGKeyArray,
|
|
1656
1660
|
inference: Optional[bool] = None,
|
|
1657
|
-
) -> Float[Array, "
|
|
1661
|
+
) -> Float[Array, "dim height width"]:
|
|
1658
1662
|
qkv_base = self.qkv(x)
|
|
1659
1663
|
|
|
1660
1664
|
aggregated_qkvs = [op(qkv_base) for op in self.aggreg]
|
|
@@ -1671,12 +1675,13 @@ class RFAttention(eqx.Module):
|
|
|
1671
1675
|
k = self.kernel_func(k)
|
|
1672
1676
|
|
|
1673
1677
|
sum_k = jnp.sum(k, axis=(-1, -2), keepdims=True)
|
|
1674
|
-
sum_v = jnp.sum(v, axis=(-1, -2), keepdims=True)
|
|
1678
|
+
sum_v = jnp.sum(v * sum_k, axis=(-1, -2), keepdims=True)
|
|
1675
1679
|
sum_kv = jnp.sum(k * sum_v, axis=(-1, -2), keepdims=True)
|
|
1676
1680
|
sum_q = jnp.sum(q, axis=0, keepdims=True)
|
|
1677
1681
|
|
|
1678
1682
|
out = (q * sum_kv) / (sum_q * sum_k + self.eps)
|
|
1679
1683
|
out = self.proj(out)
|
|
1684
|
+
out = self.proj_drop(out, inference=inference, key=key)
|
|
1680
1685
|
|
|
1681
1686
|
return out
|
|
1682
1687
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.4.0-alpha.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|