Skip to content

Synchronise with devel#77

Merged
lohedges merged 66 commits into
mainfrom
sync_devel
May 5, 2026
Merged

Synchronise with devel#77
lohedges merged 66 commits into
mainfrom
sync_devel

Conversation

@lohedges

@lohedges lohedges commented May 5, 2026

Copy link
Copy Markdown
Contributor

This PR brings the latest updates from devel into main.

kzinovjev and others added 30 commits September 13, 2025 19:05
# Conflicts:
#	bin/emle-analyze
#	emle/_analyzer.py
# Conflicts:
#	emle/models/_emle.py
#	emle/models/_mace.py
kzinovjev and others added 27 commits April 12, 2026 14:12
PyTorch 2.6 changed the default of torch.load's weights_only argument
from False to True. Models containing e3nn objects (EnergyEMLEMACE) cannot
be loaded with weights_only=True. Pass weights_only=False explicitly in
both MACEEMLE and MACEEMLEJoint _load_mace_model static methods.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…on block

Under PyTorch >= 2.6, torch.load defaults to weights_only=True, which rejects
e3nn's constants.pt because it contains a slice object.  This caused the
emle_mace import inside the try/except block to fail with UnpicklingError rather
than ImportError, so the bare 'except ImportError' silently swallowed the error
but left EnergyEMLEMACE unregistered.

Fix by:
- Calling _torch.serialization.add_safe_globals([slice]) before the import so
  e3nn can load its constants.pt under PyTorch 2.6+.
- Broadening the handler to 'except Exception' so any unexpected import failure
  is still caught rather than propagating.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…MACEEMLEJoint

TorchScript-compiled models (class RecursiveScriptModule) expose the original
class name via model.original_name but cannot be instantiated directly, and
their ModuleList submodules do not support negative indexing, making config
extraction via attribute introspection impossible.

Changes in both MACEEMLE and MACEEMLEJoint.__init__:
- Short-circuit already-compiled models: append source_model.to(dtype) directly
  and skip the extract-config / rebuild / recompile pipeline entirely.
- Use getattr(model, "original_name", ...) for EnergyEMLEMACE dispatch so that
  compiled checkpoints (where __class__.__name__ is "RecursiveScriptModule") are
  still correctly identified.
- When reconstructing an uncompiled EnergyEMLEMACE model from config, use the
  EnergyEMLEMACE class explicitly rather than source_model.__class__ (which
  would be RecursiveScriptModule for compiled inputs that bypass short-circuit).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Renames the backend string from 'maceemle' to 'emle-mace' in
EMLECalculator, the supported backends list, and emle-analyze.
Also removes a duplicate dead-code elif branch for the old name in
emle-analyze.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lohedges lohedges added the enhancement New feature or request label May 5, 2026
@lohedges lohedges merged commit 33ace00 into main May 5, 2026
4 checks passed
@lohedges lohedges deleted the sync_devel branch May 5, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants