Skip to content

Conversation

@medha-14
Copy link
Contributor

@medha-14 medha-14 commented Jun 12, 2025

Description

PR to serialise and deserialise custom models

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #)

Important checks:

Please confirm the following before marking the PR as ready for review:

  • No style issues: nox -s pre-commit
  • All tests pass: nox -s tests
  • The documentation builds: nox -s doctests
  • Code is commented for hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@medha-14 medha-14 requested a review from a team as a code owner June 12, 2025 09:17
@medha-14 medha-14 marked this pull request as draft June 12, 2025 09:23
@codecov
Copy link

codecov bot commented Jun 12, 2025

Codecov Report

❌ Patch coverage is 99.22179% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.86%. Comparing base (e154fec) to head (9db6435).
⚠️ Report is 161 commits behind head on develop.

Files with missing lines Patch % Lines
src/pybamm/expression_tree/operations/serialise.py 99.21% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5056      +/-   ##
===========================================
- Coverage    98.86%   98.86%   -0.01%     
===========================================
  Files          320      320              
  Lines        26568    26825     +257     
===========================================
+ Hits         26266    26520     +254     
- Misses         302      305       +3     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@medha-14 medha-14 marked this pull request as ready for review July 2, 2025 17:14
@medha-14
Copy link
Contributor Author

medha-14 commented Jul 2, 2025

I’ve added an example notebook to demonstrate how the functionality works. I’d appreciate any suggestions for improvements or refinements you might have.

Copy link
Member

@agriyakhetarpal agriyakhetarpal left a comment

Choose a reason for hiding this comment

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

Thank you! We are getting closer. Could you please add a CHANGELOG entry and give this PR a more descriptive title, now that we know its scope?

I've left some suggestions related to the tests, that should be addressed (better error matching + better ways to organise saving/deleting files across tests)

Also, I had a question about the structure of the JSON. Right now, we have it as:

{
  "schema_version": "1.0",
  "pybamm_version": 25.6
  "name": "MyModel",
  "rhs": [], # something
  "algebraic": [], # something
  "initial_conditions": [], # something
  # ...
}

Would it be better organised if we were to have it as

{
  "schema_version": "1.0",
  "pybamm_version": 25.6
  model: {
  "name": "MyModel",
  "rhs": [], # something
  "algebraic": [], # something
  "initial_conditions": [], # something
  # ...
  }
}

i.e., have it nested, so that the schema version, the PyBaMM version, and the model are at one level and the model's attributes are one level deeper?

Saransh-cpp
Saransh-cpp previously approved these changes Jul 30, 2025
Copy link
Member

@Saransh-cpp Saransh-cpp left a comment

Choose a reason for hiding this comment

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

This looks good to me now! Should be ready to merge once Agriya's comment above is resolved.

@medha-14 medha-14 changed the title [GSOC 2025] Third Party Model Dispatching [GSOC 2025] Saving and Loading Custom Models Aug 5, 2025
@medha-14
Copy link
Contributor Author

medha-14 commented Aug 5, 2025

I have addressed all the reviews. Please review and let me know if any further changes are needed.

Copy link
Member

@agriyakhetarpal agriyakhetarpal left a comment

Choose a reason for hiding this comment

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

Great work! I only have some nits and one functional change to request.

Copy link
Member

@Saransh-cpp Saransh-cpp left a comment

Choose a reason for hiding this comment

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

Should be ready to merge once @valentinsulzer approves it 🚀

@agriyakhetarpal
Copy link
Member

Hmm, I'm unsure if the macOS-3.10 test failure is related. Just re-triggered it...

@valentinsulzer valentinsulzer merged commit 69bb924 into pybamm-team:develop Aug 21, 2025
22 checks passed
@agriyakhetarpal agriyakhetarpal changed the title [GSOC 2025] Saving and Loading Custom Models [GSoC 2025] Saving and Loading Custom Models Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSoC 2025 Items being done as part of GSoC 2025

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants