Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

313 save final model #340

Merged
merged 11 commits into from
Jun 28, 2024
9 changes: 9 additions & 0 deletions casanovo/denovo/model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ def train(
self.loaders.val_dataloader(),
)

# Always save final model weights at the end of training
if self.config.model_save_folder_path is not None:
bittremieux marked this conversation as resolved.
Show resolved Hide resolved
self.trainer.save_checkpoint(
os.path.join(
bittremieux marked this conversation as resolved.
Show resolved Hide resolved
self.config.model_save_folder_path,
f"train-run-final-{self.trainer.current_epoch}.ckpt",
bittremieux marked this conversation as resolved.
Show resolved Hide resolved
)
)

def evaluate(self, peak_path: Iterable[str]) -> None:
"""Evaluate peptide sequence preditions from a trained Casanovo model.

Expand Down
Loading