To numpy array - #142
Merged
Merged
Conversation
marcelluethi
approved these changes
Aug 7, 2026
marcelluethi
left a comment
Contributor
There was a problem hiding this comment.
That looks good to me.
Collaborator
Author
|
Should be merged after #141 |
benikm91
force-pushed
the
to-numpy-array
branch
from
August 10, 2026 10:13
2447962 to
3ce0d24
Compare
benikm91
force-pushed
the
to-numpy-array
branch
from
August 12, 2026 06:58
3ce0d24 to
cac2028
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
toPyTree and fromPyTree are good for casting a TensorTree to a Python tree for execution of operations.
However, when serializing a tensor tree to disc (e.g., TensorTreeFormat.Pickle), the function fails for a TensorTree with a Random.Key. Instead of a custom logic in TensorTreeFormat.Pickle I propose adding a toNumpyTree and fromNumPyTree for serialization.
Key needs custom logic to be cast from DimWit/JAX to Numpy. We may could put that into TensorTreeFormat.Pickle
toHost, however this is a more general solution if we need it elsewhere or if other special cases appear.FYI: I tried storing a checkpoint and restarting from it. With same data samples the exact same train trajectory was followed, so the key write/read works successfully :)