From 3b107f72d3cf5917179d6a5c1dbf9c5d0ce3d206 Mon Sep 17 00:00:00 2001 From: Shyue Ping Ong Date: Mon, 27 Nov 2023 12:54:46 -0800 Subject: [PATCH] Add hubconf.py. --- README.md | 2 +- hubconf.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 hubconf.py diff --git a/README.md b/README.md index 0d029011..1a2068d9 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ # Materials Graph Library matgl -## Official Documentation [:books:] +## Official Documentation diff --git a/hubconf.py b/hubconf.py new file mode 100644 index 00000000..a99fd304 --- /dev/null +++ b/hubconf.py @@ -0,0 +1,18 @@ +"""Entrypoints for Pytorch Hub.""" +from __future__ import annotations + +dependencies = ["torch", "matgl"] + +import matgl # noqa + + +# resnet18 is the name of entrypoint +def m3gnet_universal_potential(version="MP-2021.2.8-DIRECT", **kwargs): + """M3GNet Universal Potential model. + + Args: + version (str): Defaults to "MP-2021.2.8-DIRECT". Other versions available. + **kwargs: Pass through to matgl.load_model. + """ + # Call the model, load pretrained weights + return matgl.load_model(f"M3GNet-{version}", **kwargs)