Skip to content

Add UKAEA-TGLFNN network #11

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

theo-brown
Copy link
Contributor

@theo-brown theo-brown commented Mar 5, 2025

Adding a refactored version of the UKAEA-TGLFNN from google-deepmind/torax#477. I've tried to match the format of the model file to the qlknn model - feedback welcome!

Tasks:

  • Add model
  • Add tests
  • Add weights and test data (pending internal approval)

@hamelphi
Copy link
Collaborator

FYI, we have just renamed the library to fusion_surrogates, and this will cause import issues with your changes.

fusion_transport_surrogates -> fusion_surrogates

Apologies for the trouble.

@theo-brown
Copy link
Contributor Author

theo-brown commented Mar 21, 2025

This is complete pending the release of the model weights and/or data for testing. I could also plausibly add more unit tests.

@theo-brown theo-brown marked this pull request as ready for review March 21, 2025 17:32
@theo-brown theo-brown changed the title [WIP] Add UKAEA-TGLFNN network Add UKAEA-TGLFNN network Mar 21, 2025
Copy link
Collaborator

@hamelphi hamelphi left a comment

Choose a reason for hiding this comment

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

Apologies for the late review. I didn't set my Github notifications properly apparently. It should be fixed now, so I hope I can respond more quickly in the future.

@theo-brown
Copy link
Contributor Author

Thanks for the review @hamelphi. It was a bit of a half-baked PR because things were changing internally and we weren't sure about the methods we'd use for exporting/sharing these models. Things should be a bit more consistent now, following your comments!

@theo-brown theo-brown requested a review from hamelphi April 3, 2025 10:43
Copy link
Collaborator

@hamelphi hamelphi left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my comments.

What is missing:

  • Settling on the API for TGLFNNModel: Do we want a common class or protocol for onnx and pytorch? Up to you. I think it would make sense personally.
  • Clean up tests
  • Add model and test data.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please move the tests associated to these transforms outside from qlknn_model_test.py into transforms_test.py

efe_onnx_path: str,
efi_onnx_path: str,
pfi_onnx_path: str,
) -> "TGLFNNModel":
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove this type annotation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Now that the loaders are in different files, we should split these tests as well.

model = pytorch_model.PytorchTGLFNNModel(
config_path="models/1.0.1/config.yaml",
stats_path="models/1.0.1/stats.json",
efe_gb_checkpoint_path="models/1.0.1/regressor_efe_gb.pt",
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should add the model data and test data in this PR as well. My understanding is that you are waiting for the approval on your side before pushing the data. Is that correct?

@hamelphi
Copy link
Collaborator

FYI, I refactored the file structure to follow what you suggested in this PR. I added the __init__.py files and moved qlknn-specific code to a qlknn directory. You'll have one somewhat complex merge to do, but then it should be simpler for you to continue the work on this PR independently of refactors happening under the qlknn directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants