Skip to content

Commit

Permalink
feat: added scalar regression constructor method
Browse files Browse the repository at this point in the history
  • Loading branch information
laserkelvin committed May 15, 2024
1 parent aeed809 commit 24b2043
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions matsciml/interfaces/ase/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,14 @@ def from_pretrained_gradfree_task(
raise FileNotFoundError(f"Checkpoint file not found; passed {ckpt_path}")
task = GradFreeForceRegressionTask.load_from_checkpoint(ckpt_path)
return cls(task, *args, **kwargs)

@classmethod
def from_pretrained_scalar_task(
cls, ckpt_path: str | Path, *args, **kwargs
) -> MatSciMLCalculator:
if isinstance(ckpt_path, str):
ckpt_path = Path(ckpt_path)
if not ckpt_path.exists():
raise FileNotFoundError(f"Checkpoint file not found; passed {ckpt_path}")
task = ScalarRegressionTask.load_from_checkpoint(ckpt_path)
return cls(task, *args, **kwargs)

0 comments on commit 24b2043

Please sign in to comment.