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

initial working jaxtyping serializing/deserializing #576

Merged
merged 5 commits into from
Aug 2, 2024

Conversation

pablovela5620
Copy link
Contributor

@pablovela5620 pablovela5620 commented Jul 26, 2024

Jaxtyping serialization/deserializing working along with type checking with beartype #572 . This allows one to use jaxtyping when serializing/deserializing and check both the dtype and the shape. Let me know if this direction makes sense!

The code changes in `serde/numpy.py` modify the `is_numpy_jaxtyping` function to handle a `TypeError` exception. This change ensures that if a `TypeError` occurs when trying to determine if a type is a numpy jaxtyping, the function will return `False` instead of raising an error.
Copy link

codecov bot commented Jul 27, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 90.86%. Comparing base (f882338) to head (2a012c1).
Report is 29 commits behind head on main.

Files Patch % Lines
serde/numpy.py 73.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #576      +/-   ##
==========================================
- Coverage   91.04%   90.86%   -0.18%     
==========================================
  Files          13       13              
  Lines        1942     1971      +29     
  Branches      437      440       +3     
==========================================
+ Hits         1768     1791      +23     
- Misses        117      122       +5     
- Partials       57       58       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pablovela5620
Copy link
Contributor Author

Hi @yukinarit,

I've implemented initial support for jaxtyping serialization/deserialization and all tests are passing. Before I proceed with adding specific tests for jaxtyping, could you please review the current implementation and let me know if you're happy with the direction? Any feedback would be greatly appreciated!

Copy link
Owner

@yukinarit yukinarit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR basically looks good to me.

But I am not a numpy/jaxtyping user. @kmsquire It would be great if you can take a look and give us feedback 🙏

pyproject.toml Show resolved Hide resolved
serde/numpy.py Outdated Show resolved Hide resolved
@yukinarit yukinarit requested a review from kmsquire July 29, 2024 12:54
@pablovela5620
Copy link
Contributor Author

Made jaxtyping an optional dep and addressed your typ comment!

@pablovela5620
Copy link
Contributor Author

Added tests in! Let me know if there's anything else you'd like me to add/fix @yukinarit @kmsquire, otherwise I also think this is probably good to merge

@yukinarit yukinarit added the enhancement New feature or request label Aug 2, 2024
Copy link
Owner

@yukinarit yukinarit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! LGTM!

@yukinarit yukinarit merged commit 129e030 into yukinarit:main Aug 2, 2024
6 of 8 checks passed
@yukinarit
Copy link
Owner

@pablovela5620 Is there anything you want to add before publishing v0.20.0?

@pablovela5620
Copy link
Contributor Author

Nope, this looks good! Thanks

github-actions bot pushed a commit that referenced this pull request Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants