Skip to content

Commit

Permalink
v0.3.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
BowenD-UCB committed Feb 7, 2024
1 parent 5c42e56 commit 4831bbb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion chgnet/model/dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(
self.device = f"cuda:{cuda_devices_sorted_by_free_mem()[-1]}"

# Move the model to the specified device
self.model = (model or CHGNet.load()).to(self.device)
self.model = (model or CHGNet.load(verbose=False)).to(self.device)
self.model.graph_converter.set_isolated_atom_response(on_isolated_atoms)
self.stress_weight = stress_weight
print(f"CHGNet will run on {self.device}")
Expand Down
16 changes: 12 additions & 4 deletions chgnet/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,16 +669,23 @@ def from_file(cls, path, **kwargs) -> CHGNet:
return CHGNet.from_dict(state["model"], **kwargs)

@classmethod
def load(cls, model_name="0.3.0", use_device: str | None = None) -> CHGNet:
def load(
cls,
model_name="0.3.0",
use_device: str | None = None,
verbose: bool = True,
) -> CHGNet:
"""Load pretrained CHGNet model.
Args:
model_name (str, optional): Defaults to "0.3.0".
model_name (str, optional):
Default = "0.3.0".
use_device (str, optional): The device to be used for predictions,
either "cpu", "cuda", or "mps". If not specified, the default device is
automatically selected based on the available options.
Default = None
verbose (bool): whether to print model device information
Default = True
Raises:
ValueError: On unknown model_name.
"""
Expand Down Expand Up @@ -709,7 +716,8 @@ def load(cls, model_name="0.3.0", use_device: str | None = None) -> CHGNet:

# Move the model to the specified device
model = model.to(device)
print(f"CHGNet will run on {device}")
if verbose:
print(f"CHGNet will run on {device}")
return model


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "chgnet"
version = "0.3.3"
version = "0.3.4"
description = "Pretrained Universal Neural Network Potential for Charge-informed Atomistic Modeling"
authors = [{ name = "Bowen Deng", email = "[email protected]" }]
requires-python = ">=3.9"
Expand Down

0 comments on commit 4831bbb

Please sign in to comment.