Skip to content

Commit

Permalink
Fix model loading. Add documentation to README.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyue Ping Ong committed Nov 27, 2023
1 parent 0e1022d commit f2d8ed9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,21 @@ import matgl
print(matgl.get_available_pretrained_models())
```

## Pytorch Hub

The pre-trained models are also available on Pytorch hub. To use these models, simply install matgl and use the
following commands:

```python
import torch
# To obtain a listing of models
torch.hub.list("materialsvirtuallab/matgl", force_reload=True)
# To load a model
model = torch.hub.load("materialsvirtuallab/matgl", 'm3gnet_universal_potential')
```

## Tutorials

We wrote [tutorials] on how to use MatGL. These were generated from [Jupyter notebooks]
Expand Down
2 changes: 1 addition & 1 deletion hubconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def m3gnet_universal_potential(version="MP-2021.2.8-DIRECT", **kwargs):
version (str): Defaults to "MP-2021.2.8-DIRECT". Other versions available.
**kwargs: Pass through to matgl.load_model.
"""
return matgl.load_model(f"M3GNet-{version}", **kwargs)
return matgl.load_model(f"M3GNet-{version}-PES", **kwargs)


def m3gnet_formation_energy(**kwargs):
Expand Down

0 comments on commit f2d8ed9

Please sign in to comment.