You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 29, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on May 29, 2026. It is now read-only.
馃悰[BUG]: DeepONetConstraint.from_numpy not compatible with IntegralLossNorm聽#195
I am trying to use loss=IntegralNormLoss() in the DeepONetConstraint.from_numpy constraint to set an integral continuity plane constraint for DeepONets. However, IntegralLossNorm expects a list of dictionaries for its invar and outvar, whereas DeepONetConstraint.from_numpy must be given dictionaries. I am not sure why there is this inconsistency. Perhaps you are not supposed to use IntegralLossNorm as the loss in the constraint?
It seems that there is a version of IntegralLossNorm._loss that uses dictionaries beneath the current version in the code, so perhaps there is an "if" statement missing or something simple like that. Using this code instead, my training script actually runs.
Error executing job with overrides: []
Traceback (most recent call last):
File "/home/ahal/GitRepos/MLCFD/pinn/pipe_bend/DeepONet_pipe_bend.py", line 732, in run
flow_slv.solve()
File "/home/ahal/env/modulus3.10/lib/python3.10/site-packages/modulus/sym/solver/solver.py", line 175, in solve
self._train_loop(sigterm_handler)
File "/home/ahal/env/modulus3.10/lib/python3.10/site-packages/modulus/sym/trainer.py", line 545, in _train_loop
loss, losses = self._cuda_graph_training_step(step)
File "/home/ahal/env/modulus3.10/lib/python3.10/site-packages/modulus/sym/trainer.py", line 726, in _cuda_graph_training_step
self.loss_static, self.losses_static = self.compute_gradients(
File "/home/ahal/env/modulus3.10/lib/python3.10/site-packages/modulus/sym/trainer.py", line 78, in adam_compute_gradients
losses_minibatch = self.compute_losses(step)
File "/home/ahal/env/modulus3.10/lib/python3.10/site-packages/modulus/sym/solver/solver.py", line 68, in compute_losses
return self.domain.compute_losses(step)
File "/home/ahal/env/modulus3.10/lib/python3.10/site-packages/modulus/sym/domain/domain.py", line 153, in compute_losses
for loss_key, value in constraint.loss(step).items():
File "/home/ahal/env/modulus3.10/lib/python3.10/site-packages/modulus/sym/domain/constraint/continuous.py", line 139, in loss
losses = self._loss(
File "/home/ahal/env/modulus3.10/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ahal/env/modulus3.10/lib/python3.10/site-packages/modulus/sym/loss/loss.py", line 172, in forward
return IntegralLossNorm._loss(
File "/home/ahal/env/modulus3.10/lib/python3.10/site-packages/modulus/sym/loss/loss.py", line 141, in _loss
losses = {key: 0 for key in list_pred_outvar[0].keys()}
KeyError: 0
Environment details
No response
Other/Misc.
Writing a minimal code example that reproduces this will require considerable work from my part. I have only provided the constraint I am setting. Hope you can find out the rest for yourself.
Closing as part of the archival of this repository. The key components have been upstreamed to NVIDIA/physicsnemo. Please refer to the v2.0 Migration Guide and feel free to re-open your issue there if it is still relevant.
Activity
loliverhennigh commentedon Jul 15, 2025
Hey @ahallback , Unfortunately the DeepONetConstraint does not support integral losses. Its a bit tricky to see how to get this working actually. If you want a bit more flexability with DeepONet you can look at the PhysicsNemo one as well https://github.com/NVIDIA/physicsnemo/blob/main/examples/cfd/darcy_physics_informed/darcy_physics_informed_deeponet.py.
ktangsali commentedon Apr 29, 2026
Closing as part of the archival of this repository. The key components have been upstreamed to NVIDIA/physicsnemo. Please refer to the v2.0 Migration Guide and feel free to re-open your issue there if it is still relevant.