Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/fairchem/core/units/mlip_unit/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,12 @@ def _lazy_init(self, data: AtomicData) -> None:
# The model's scalars are fixed at inference, so this skips dynamo's
# TensorifyScalarRestartAnalysis retrace during compile.
torch._dynamo.config.specialize_float = True
# The model uses custom autograd.Functions, which AOTAutogradCache
# refuses to cache unless this is set, so without it the largest
# graph is re-compiled from scratch on every process start.
import torch._functorch.config as _functorch_config

_functorch_config.autograd_cache_allow_custom_autograd_functions = True
self.model = torch.compile(self.model, dynamic=True)

self.lazy_model_intialized = True
Expand Down