Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jax): checkpoint I/O #4236

Merged
merged 18 commits into from
Oct 24, 2024
Prev Previous commit
Next Next commit
checkpoint
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
  • Loading branch information
njzjz committed Oct 21, 2024
commit 71a4b55138c50da3d5848f54eddf33a0f8ba2b32
5 changes: 4 additions & 1 deletion deepmd/jax/utils/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
from deepmd.jax.model.model import (
BaseModel,
)
from deepmd.jax.utils.network import (
ArrayAPIParam,
)


def deserialize_to_file(model_file: str, data: dict) -> None:
Expand Down Expand Up @@ -54,7 +57,7 @@ def deserialize_to_file(model_file: str, data: dict) -> None:
)
elif model_file.endswith(".jax"):
model = BaseModel.deserialize(data["model"])
state = nnx.state(model)
state = nnx.state(model, ArrayAPIParam)
nnx.display(state)
else:
raise ValueError("JAX backend only supports converting .pth file")