disable compilation py>=3.14

This commit is contained in:
Dario Coscia
2025-10-28 12:29:19 +01:00
committed by Giovanni Canali
parent 24d806b262
commit 64930c431f
3 changed files with 40 additions and 11 deletions

View File

@@ -71,9 +71,7 @@ class PINNInterface(SupervisedSolverInterface, metaclass=ABCMeta):
"""
# Override the compilation, compiling only for torch < 2.8, see
# related issue at https://github.com/mathLab/PINA/issues/621
if torch.__version__ < "2.8":
self.trainer.compile = True
else:
if torch.__version__ >= "2.8":
self.trainer.compile = False
warnings.warn(
"Compilation is disabled for torch >= 2.8. "

View File

@@ -174,11 +174,7 @@ class SolverInterface(lightning.pytorch.LightningModule, metaclass=ABCMeta):
:return: The result of the parent class ``setup`` method.
:rtype: Any
"""
if stage == "fit" and self.trainer.compile:
self._setup_compile()
if stage == "test" and (
self.trainer.compile and not self._is_compiled()
):
if self.trainer.compile and not self._is_compiled():
self._setup_compile()
return super().setup(stage)