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
10 changes: 9 additions & 1 deletion flax/nnx/variablelib.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from jax._src.state.types import AbstractRef
import jax.experimental
from jax.experimental import hijax as hjx
import jax.extend as jex
import jax.tree_util as jtu
import treescope # type: ignore[import-untyped]

Expand Down Expand Up @@ -286,7 +287,14 @@ def normalize(self):
leaf_types = tuple(a.normalize() for a in self.leaf_avals)
return VariableQDD(leaf_types, self.treedef, self.var_type)

class VariableEffect(jax.core.Effect): ...
try:
# JAX v0.10.0 and newer.
Effect: type = jex.core.Effect
except AttributeError:
# JAX v0.9.2 and older.
Effect = jax.core.Effect

class VariableEffect(Effect): ...


variable_effect = VariableEffect()
Expand Down
Loading