Skip to content

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.

@theo-brown
Copy link
Contributor Author

Hi @hamelphi, sorry for the delay on this. I had a deadline that took priority for most of Apr/May!

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?

This process has unfortunately stagnated as our legal team are trying to work things out. I'm chivvying the appropriate people, but unfortunately I have no guarantees as to when it will be given the go-ahead. Contributing this model to fusion_surrogates is still very much on my wishlist, but I won't be able to give it any attention until I have confirmation that it will be sharable.

Closing for now, will reopen when we've made progress.

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