Replace Equinox PyTrees with normal dataclasses
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 349
- Forks
- 35
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 1
Description
Hi, I love the minimal nature of tinygp, but I am surprise it relies on a NN library such as Equinox. As far as I can tell, the only reason is due to the fact that the modules should be PyTrees, which equinox does nicely, but so does jax.
Since equinox requires jax>=0.4.38, the change would be trivial (compatibilty with jax<0.4.32 would be slightly more annoying).
It would go from:
import equinox as eqx
class GaussianProcess(eqx.Module):
...
to pure jax/python
from dataclasses import dataclass
from abc import ABC, abstract_method
@jax.tree_util.register_dataclass
@dataclass
class GaussianProcess(ABC):
...
but leaving jax as the only dependecy.
The only issue would be when the user inherits from a class, but a simple helper decorator like
def tinyclass(cls):
return jax.tree_util.register_dataclass(dataclass(cls))
would just result in
@tinygp.tinyclass
class SpectralMixture(tinygp.kernels.Kernel):
...
which is, afterall the jax approach.
If this is something you would interested I wouldn't mind doing a PR to keep tinygp...tiny :)
This was just a random observation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by auditing the repository for Equinox imports and PyTree-related class definitions, then compare the current supported JAX versions with JAX's dataclass registration approach. Determine whether inheritance and existing user-facing classes can be migrated without breaking behavior. Done means Equinox is no longer required while the library's PyTree behavior and stated JAX compatibility are preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100