Skip to content

Serialization#142

Merged
pluflou merged 5 commits intolume-science:mainfrom
bhardwaj-gopika:main
Feb 20, 2026
Merged

Serialization#142
pluflou merged 5 commits intolume-science:mainfrom
bhardwaj-gopika:main

Conversation

@bhardwaj-gopika
Copy link
Contributor

@bhardwaj-gopika bhardwaj-gopika commented Feb 17, 2026

This pull request adds full serialization and deserialization capabilities to the LUMETorchModel wrapper class, enabling models to be saved to and loaded from YAML configuration files.

from lume_torch.base import LUMETorch, LUMETorchModel
from lume_torch.models import TorchModel
model = TorchModel("model_config.yaml")
ltmodel = LUMETorchModel(model)
ltmodel.dump("my_lume_torch_model.yaml")
loaded_model = LUMETorchModel.from_file("my_lume_torch_model.yaml")
loaded_model.set({"ACCL:LI25:1:ADES": 6260.0})
print(loaded_model.get(loaded_model.torch_model.output_names))
{'hxr_pulse_intensity': tensor(1.5391, dtype=torch.float64)}

@bhardwaj-gopika bhardwaj-gopika marked this pull request as ready for review February 18, 2026 22:42
Copy link
Collaborator

@roussel-ryan roussel-ryan 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, @pluflou can also review. One thing to consider is that soon^(TM) we will add serialization / deserialization logic to the LUMEModel base class, which should handle a lot of this logic, so be prepared to move a lot of this to lume-base when the time is right

@roussel-ryan roussel-ryan requested a review from pluflou February 20, 2026 17:45
@pluflou
Copy link
Collaborator

pluflou commented Feb 20, 2026

Looks good to me as well.

@pluflou pluflou merged commit 5c14976 into lume-science:main Feb 20, 2026
7 checks passed
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.

3 participants