Skip to content

Commit

Permalink
remove custom export function
Browse files Browse the repository at this point in the history
  • Loading branch information
PicoCentauri committed Oct 24, 2024
1 parent 47b3798 commit e60fbae
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 171 deletions.
7 changes: 0 additions & 7 deletions docs/src/dev-docs/utils/export.rst

This file was deleted.

4 changes: 2 additions & 2 deletions src/metatrain/experimental/alchemical_model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from metatensor.torch.atomistic import (
MetatensorAtomisticModel,
ModelCapabilities,
ModelMetadata,
ModelOutput,
NeighborListOptions,
System,
Expand All @@ -16,7 +17,6 @@
from ...utils.additive import ZBL
from ...utils.data.dataset import DatasetInfo
from ...utils.dtype import dtype_to_str
from ...utils.export import export
from .utils import systems_to_torch_alchemical_batch


Expand Down Expand Up @@ -184,7 +184,7 @@ def export(self) -> MetatensorAtomisticModel:
dtype=dtype_to_str(dtype),
)

return export(model=self, model_capabilities=capabilities)
return MetatensorAtomisticModel(self.eval(), ModelMetadata(), capabilities)

def set_composition_weights(
self,
Expand Down
4 changes: 2 additions & 2 deletions src/metatrain/experimental/gap/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from metatensor.torch.atomistic import (
MetatensorAtomisticModel,
ModelCapabilities,
ModelMetadata,
ModelOutput,
System,
)
Expand All @@ -22,7 +23,6 @@
from metatrain.utils.data.dataset import DatasetInfo

from ...utils.additive import ZBL, CompositionModel
from ...utils.export import export


class GAP(torch.nn.Module):
Expand Down Expand Up @@ -253,7 +253,7 @@ def export(self) -> MetatensorAtomisticModel:
self._subset_of_regressors.export_torch_script_model()
)

return export(model=self, model_capabilities=capabilities)
return MetatensorAtomisticModel(self.eval(), ModelMetadata(), capabilities)

def set_composition_weights(
self,
Expand Down
4 changes: 2 additions & 2 deletions src/metatrain/experimental/pet/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from metatensor.torch.atomistic import (
MetatensorAtomisticModel,
ModelCapabilities,
ModelMetadata,
ModelOutput,
NeighborListOptions,
System,
Expand All @@ -20,7 +21,6 @@

from ...utils.additive import ZBL
from ...utils.dtype import dtype_to_str
from ...utils.export import export
from .utils import systems_to_batch_dict


Expand Down Expand Up @@ -196,4 +196,4 @@ def export(self) -> MetatensorAtomisticModel:
supported_devices=["cpu", "cuda"], # and not __supported_devices__
dtype=dtype_to_str(dtype),
)
return export(model=self, model_capabilities=capabilities)
return MetatensorAtomisticModel(self.eval(), ModelMetadata(), capabilities)
4 changes: 2 additions & 2 deletions src/metatrain/experimental/soap_bpnn/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from metatensor.torch.atomistic import (
MetatensorAtomisticModel,
ModelCapabilities,
ModelMetadata,
ModelOutput,
System,
)
Expand All @@ -18,7 +19,6 @@

from ...utils.additive import ZBL, CompositionModel
from ...utils.dtype import dtype_to_str
from ...utils.export import export


class Identity(torch.nn.Module):
Expand Down Expand Up @@ -335,7 +335,7 @@ def export(self) -> MetatensorAtomisticModel:
dtype=dtype_to_str(dtype),
)

return export(model=self, model_capabilities=capabilities)
return MetatensorAtomisticModel(self.eval(), ModelMetadata(), capabilities)

def add_output(self, output_name: str) -> None:
"""Add a new output to the self."""
Expand Down
48 changes: 0 additions & 48 deletions src/metatrain/utils/export.py

This file was deleted.

107 changes: 0 additions & 107 deletions tests/utils/test_export.py

This file was deleted.

2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ extras = # architectures used in the package tests
soap-bpnn
pet
allowlist_externals = bash
#commands_pre = bash {toxinidir}/tests/resources/generate-outputs.sh
commands_pre = bash {toxinidir}/tests/resources/generate-outputs.sh
commands =
pytest \
--numprocesses=auto \
Expand Down

0 comments on commit e60fbae

Please sign in to comment.