diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml
index 3b646efa..a9bcf896 100644
--- a/.github/workflows/screenshots.yml
+++ b/.github/workflows/screenshots.yml
@@ -11,15 +11,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Set up Python
- uses: actions/setup-python@v3
+ uses: actions/setup-python@v4
+ with:
+ python-version: "3.10"
- name: Install your custom tools
- run: pip install .
+ run: |
+ python -m pip install --upgrade pip
+ pip install .
- name: Generate terminal images with rich-codex
uses: ewels/rich-codex@v1
diff --git a/casanovo/casanovo.py b/casanovo/casanovo.py
index 992cf566..0a1c3618 100644
--- a/casanovo/casanovo.py
+++ b/casanovo/casanovo.py
@@ -133,7 +133,7 @@ def sequence(
to sequence peptides.
"""
output = setup_logging(output, verbosity)
- config = setup_model(model, config, output, False)
+ config, model = setup_model(model, config, output, False)
with ModelRunner(config, model) as runner:
logger.info("Sequencing peptides from:")
for peak_file in peak_path:
@@ -164,7 +164,7 @@ def evaluate(
such as those provided by MassIVE-KB.
"""
output = setup_logging(output, verbosity)
- config = setup_model(model, config, output, False)
+ config, model = setup_model(model, config, output, False)
with ModelRunner(config, model) as runner:
logger.info("Sequencing and evaluating peptides from:")
for peak_file in annotated_peak_path:
@@ -207,7 +207,7 @@ def train(
provided by MassIVE-KB, from which to train a new Casnovo model.
"""
output = setup_logging(output, verbosity)
- config = setup_model(model, config, output, True)
+ config, model = setup_model(model, config, output, True)
with ModelRunner(config, model) as runner:
logger.info("Training a model from:")
for peak_file in train_peak_path:
@@ -378,7 +378,7 @@ def setup_model(
for key, value in config.items():
logger.debug("%s = %s", str(key), str(value))
- return config
+ return config, model
def _get_model_weights() -> str:
diff --git a/casanovo/denovo/model_runner.py b/casanovo/denovo/model_runner.py
index 852860d3..e16f4d5b 100644
--- a/casanovo/denovo/model_runner.py
+++ b/casanovo/denovo/model_runner.py
@@ -5,6 +5,7 @@
import os
import tempfile
import uuid
+import warnings
from pathlib import Path
from typing import Iterable, List, Optional, Union
@@ -217,6 +218,7 @@ def initialize_model(self, train: bool) -> None:
max_charge=self.config.max_charge,
precursor_mass_tol=self.config.precursor_mass_tol,
isotope_error_range=self.config.isotope_error_range,
+ min_peptide_len=self.config.min_peptide_len,
n_beams=self.config.n_beams,
top_match=self.config.top_match,
n_log=self.config.n_log,
@@ -229,6 +231,24 @@ def initialize_model(self, train: bool) -> None:
calculate_precision=self.config.calculate_precision,
)
+ # Reconfigurable non-architecture related parameters for a loaded model
+ loaded_model_params = dict(
+ max_length=self.config.max_length,
+ precursor_mass_tol=self.config.precursor_mass_tol,
+ isotope_error_range=self.config.isotope_error_range,
+ n_beams=self.config.n_beams,
+ min_peptide_len=self.config.min_peptide_len,
+ top_match=self.config.top_match,
+ n_log=self.config.n_log,
+ tb_summarywriter=self.config.tb_summarywriter,
+ warmup_iters=self.config.warmup_iters,
+ max_iters=self.config.max_iters,
+ lr=self.config.learning_rate,
+ weight_decay=self.config.weight_decay,
+ out_writer=self.writer,
+ calculate_precision=self.config.calculate_precision,
+ )
+
from_scratch = (
self.config.train_from_scratch,
self.model_filename is None,
@@ -247,20 +267,38 @@ def initialize_model(self, train: bool) -> None:
)
raise FileNotFoundError("Could not find the model weights file")
- # First try loading model details from the weithgs file,
- # otherwise use the provided configuration.
+ # First try loading model details from the weights file, otherwise use
+ # the provided configuration.
device = torch.empty(1).device # Use the default device.
try:
self.model = Spec2Pep.load_from_checkpoint(
- self.model_filename,
- map_location=device,
+ self.model_filename, map_location=device, **loaded_model_params
)
- except RuntimeError:
- self.model = Spec2Pep.load_from_checkpoint(
- self.model_filename,
- map_location=device,
- **model_params,
+
+ architecture_params = set(model_params.keys()) - set(
+ loaded_model_params.keys()
)
+ for param in architecture_params:
+ if model_params[param] != self.model.hparams[param]:
+ warnings.warn(
+ f"Mismatching {param} parameter in "
+ f"model checkpoint ({self.model.hparams[param]}) "
+ f"vs config file ({model_params[param]}); "
+ "using the checkpoint."
+ )
+ except RuntimeError:
+ # This only doesn't work if the weights are from an older version
+ try:
+ self.model = Spec2Pep.load_from_checkpoint(
+ self.model_filename,
+ map_location=device,
+ **model_params,
+ )
+ except RuntimeError:
+ raise RuntimeError(
+ "Weights file incompatible with the current version of "
+ "Casanovo. "
+ )
def initialize_data_module(
self,
diff --git a/docs/images/configure-help.svg b/docs/images/configure-help.svg
index fc4e6305..d5dd7aa8 100644
--- a/docs/images/configure-help.svg
+++ b/docs/images/configure-help.svg
@@ -19,62 +19,63 @@
font-weight: 700;
}
- .terminal-241098124-matrix {
+ .terminal-2285289330-matrix {
font-family: Fira Code, monospace;
font-size: 20px;
line-height: 24.4px;
font-variant-east-asian: full-width;
}
- .terminal-241098124-title {
+ .terminal-2285289330-title {
font-size: 18px;
font-weight: bold;
font-family: arial;
}
- .terminal-241098124-r1 { fill: #c5c8c6 }
-.terminal-241098124-r2 { fill: #c5c8c6;font-weight: bold }
-.terminal-241098124-r3 { fill: #d0b344;font-weight: bold }
-.terminal-241098124-r4 { fill: #68a0b3;font-weight: bold }
-.terminal-241098124-r5 { fill: #868887 }
-.terminal-241098124-r6 { fill: #98a84b;font-weight: bold }
+ .terminal-2285289330-r1 { fill: #c5c8c6 }
+.terminal-2285289330-r2 { fill: #d0b344 }
+.terminal-2285289330-r3 { fill: #c5c8c6;font-weight: bold }
+.terminal-2285289330-r4 { fill: #68a0b3;font-weight: bold }
+.terminal-2285289330-r5 { fill: #868887 }
+.terminal-2285289330-r6 { fill: #98a84b;font-weight: bold }
+.terminal-2285289330-r7 { fill: #d0b344;font-weight: bold }
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -86,21 +87,21 @@
-
+
-
- $ casanovo configure --help
-
-Usage: casanovo configure [OPTIONS]
-
- Generate a Casanovo configuration file to customize.
- The casanovo configuration file is in the YAML format.
-
-╭─ Options ────────────────────────────────────────────────────────────────────╮
-│--output-oFILE The output configuration file. │
-│--help-h Show this message and exit. │
-╰──────────────────────────────────────────────────────────────────────────────╯
-
+
+ $ casanovo configure --help
+
+Usage:casanovo configure [OPTIONS]
+
+ Generate a Casanovo configuration file to customize.
+ The casanovo configuration file is in the YAML format.
+
+╭─ Options ────────────────────────────────────────────────────────────────────╮
+│--output-oFILE The output configuration file. │
+│--help-h Show this message and exit. │
+╰──────────────────────────────────────────────────────────────────────────────╯
+
diff --git a/docs/images/evaluate-help.svg b/docs/images/evaluate-help.svg
index d4832c98..e220664b 100644
--- a/docs/images/evaluate-help.svg
+++ b/docs/images/evaluate-help.svg
@@ -19,107 +19,108 @@
font-weight: 700;
}
- .terminal-1106939395-matrix {
+ .terminal-1788431117-matrix {
font-family: Fira Code, monospace;
font-size: 20px;
line-height: 24.4px;
font-variant-east-asian: full-width;
}
- .terminal-1106939395-title {
+ .terminal-1788431117-title {
font-size: 18px;
font-weight: bold;
font-family: arial;
}
- .terminal-1106939395-r1 { fill: #c5c8c6 }
-.terminal-1106939395-r2 { fill: #c5c8c6;font-weight: bold }
-.terminal-1106939395-r3 { fill: #d0b344;font-weight: bold }
-.terminal-1106939395-r4 { fill: #68a0b3;font-weight: bold }
-.terminal-1106939395-r5 { fill: #868887 }
-.terminal-1106939395-r6 { fill: #cc555a }
-.terminal-1106939395-r7 { fill: #8a4346 }
-.terminal-1106939395-r8 { fill: #98a84b;font-weight: bold }
-.terminal-1106939395-r9 { fill: #8d7b39;font-weight: bold }
+ .terminal-1788431117-r1 { fill: #c5c8c6 }
+.terminal-1788431117-r2 { fill: #d0b344 }
+.terminal-1788431117-r3 { fill: #c5c8c6;font-weight: bold }
+.terminal-1788431117-r4 { fill: #68a0b3;font-weight: bold }
+.terminal-1788431117-r5 { fill: #868887 }
+.terminal-1788431117-r6 { fill: #cc555a }
+.terminal-1788431117-r7 { fill: #d0b344;font-weight: bold }
+.terminal-1788431117-r8 { fill: #8a4346 }
+.terminal-1788431117-r9 { fill: #98a84b;font-weight: bold }
+.terminal-1788431117-r10 { fill: #8d7b39;font-weight: bold }
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -131,35 +132,35 @@
-
+
-
- $ casanovo evaluate --help
-
-Usage: casanovo evaluate [OPTIONS] ANNOTATED_PEAK_PATH...
-
- Evaluate de novo peptide sequencing performance.
- ANNOTATED_PEAK_PATH must be one or more annoated MGF files, such as those
- provided by MassIVE-KB.
-
-╭─ Arguments ──────────────────────────────────────────────────────────────────╮
-│*ANNOTATED_PEAK_PATHFILE[required]│
-╰──────────────────────────────────────────────────────────────────────────────╯
-╭─ Options ────────────────────────────────────────────────────────────────────╮
-│--model-mFILE The model weights (.ckpt file). │
-│ If not provided, Casanovo will │
-│ try to download the latest │
-│ release. │
-│--output-oFILE The mzTab file to which results │
-│ will be written. │
-│--config-cFILE The YAML configuration file │
-│ overriding the default options. │
-│--verbosity-v[debug|info|warning|error] Set the verbosity of console │
-│ logging messages. Log files are │
-│ always set to 'debug'. │
-│--help-h Show this message and exit. │
-╰──────────────────────────────────────────────────────────────────────────────╯
-
+
+ $ casanovo evaluate --help
+
+Usage:casanovo evaluate [OPTIONS] ANNOTATED_PEAK_PATH...
+
+ Evaluate de novo peptide sequencing performance.
+ ANNOTATED_PEAK_PATH must be one or more annoated MGF files, such as those
+ provided by MassIVE-KB.
+
+╭─ Arguments ──────────────────────────────────────────────────────────────────╮
+│* ANNOTATED_PEAK_PATH FILE[required]│
+╰──────────────────────────────────────────────────────────────────────────────╯
+╭─ Options ────────────────────────────────────────────────────────────────────╮
+│--model-mFILE The model weights (.ckpt file). │
+│ If not provided, Casanovo will │
+│ try to download the latest │
+│ release. │
+│--output-oFILE The mzTab file to which results │
+│ will be written. │
+│--config-cFILE The YAML configuration file │
+│ overriding the default options. │
+│--verbosity-v[debug|info|warning|error] Set the verbosity of console │
+│ logging messages. Log files are │
+│ always set to 'debug'. │
+│--help-h Show this message and exit. │
+╰──────────────────────────────────────────────────────────────────────────────╯
+
diff --git a/docs/images/help.svg b/docs/images/help.svg
index 72d06a85..42180a3f 100644
--- a/docs/images/help.svg
+++ b/docs/images/help.svg
@@ -19,132 +19,133 @@
font-weight: 700;
}
- .terminal-2334127528-matrix {
+ .terminal-2243088900-matrix {
font-family: Fira Code, monospace;
font-size: 20px;
line-height: 24.4px;
font-variant-east-asian: full-width;
}
- .terminal-2334127528-title {
+ .terminal-2243088900-title {
font-size: 18px;
font-weight: bold;
font-family: arial;
}
- .terminal-2334127528-r1 { fill: #c5c8c6 }
-.terminal-2334127528-r2 { fill: #c5c8c6;font-weight: bold }
-.terminal-2334127528-r3 { fill: #d0b344;font-weight: bold }
-.terminal-2334127528-r4 { fill: #68a0b3;font-weight: bold }
-.terminal-2334127528-r5 { fill: #1984e9 }
-.terminal-2334127528-r6 { fill: #868887 }
-.terminal-2334127528-r7 { fill: #98a84b;font-weight: bold }
+ .terminal-2243088900-r1 { fill: #c5c8c6 }
+.terminal-2243088900-r2 { fill: #d0b344 }
+.terminal-2243088900-r3 { fill: #c5c8c6;font-weight: bold }
+.terminal-2243088900-r4 { fill: #68a0b3;font-weight: bold }
+.terminal-2243088900-r5 { fill: #d0b344;font-weight: bold }
+.terminal-2243088900-r6 { fill: #608ab1;text-decoration: underline; }
+.terminal-2243088900-r7 { fill: #868887 }
+.terminal-2243088900-r8 { fill: #98a84b;font-weight: bold }
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -156,44 +157,44 @@
-
+
-
- $ casanovo --help
-
-Usage: casanovo [OPTIONS] COMMAND [ARGS]...
-
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ Casanovo ║
- ╚════════════════════════════════════════════════════════════════════════════╝
- Casanovo de novo sequences peptides from tandem mass spectra using a
- Transformer model. Casanovo currently supports mzML, mzXML, and MGF files for
- de novo sequencing and annotated MGF files, such as those from MassIVE-KB, for
- training new models.
-
- Links:
-
- • Documentation: https://casanovo.readthedocs.io
- • Official code repository: https://github.com/Noble-Lab/casanovo
-
- If you use Casanovo in your work, please cite:
-
- • Yilmaz, M., Fondrie, W. E., Bittremieux, W., Oh, S. & Noble, W. S. De novo
-mass spectrometry peptide sequencing with a transformer model. Proceedings
-of the 39th International Conference on Machine Learning - ICML '22 (2022)
-doi:10.1101/2022.02.07.479481.
-
-╭─ Options ────────────────────────────────────────────────────────────────────╮
-│--help-h Show this message and exit. │
-╰──────────────────────────────────────────────────────────────────────────────╯
-╭─ Commands ───────────────────────────────────────────────────────────────────╮
-│configure Generate a Casanovo configuration file to customize. │
-│evaluate Evaluate de novo peptide sequencing performance. │
-│sequence De novo sequence peptides from tandem mass spectra. │
-│train Train a Casanovo model on your own data. │
-│version Get the Casanovo version information │
-╰──────────────────────────────────────────────────────────────────────────────╯
-
+
+ $ casanovo --help
+
+Usage:casanovo [OPTIONS] COMMAND [ARGS]...
+
+ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
+ ┃ Casanovo ┃
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
+ Casanovo de novo sequences peptides from tandem mass spectra using a
+ Transformer model. Casanovo currently supports mzML, mzXML, and MGF files for
+ de novo sequencing and annotated MGF files, such as those from MassIVE-KB, for
+ training new models.
+
+ Links:
+
+ • Documentation: https://casanovo.readthedocs.io
+ • Official code repository: https://github.com/Noble-Lab/casanovo
+
+ If you use Casanovo in your work, please cite:
+
+ • Yilmaz, M., Fondrie, W. E., Bittremieux, W., Oh, S. & Noble, W. S. De novo
+mass spectrometry peptide sequencing with a transformer model. Proceedings
+of the 39th International Conference on Machine Learning - ICML '22 (2022)
+doi:10.1101/2022.02.07.479481.
+
+╭─ Options ────────────────────────────────────────────────────────────────────╮
+│--help-h Show this message and exit. │
+╰──────────────────────────────────────────────────────────────────────────────╯
+╭─ Commands ───────────────────────────────────────────────────────────────────╮
+│configure Generate a Casanovo configuration file to customize. │
+│evaluate Evaluate de novo peptide sequencing performance. │
+│sequence De novo sequence peptides from tandem mass spectra. │
+│train Train a Casanovo model on your own data. │
+│version Get the Casanovo version information │
+╰──────────────────────────────────────────────────────────────────────────────╯
+
diff --git a/docs/images/sequence-help.svg b/docs/images/sequence-help.svg
index 01b002fd..d493e2b2 100644
--- a/docs/images/sequence-help.svg
+++ b/docs/images/sequence-help.svg
@@ -19,107 +19,108 @@
font-weight: 700;
}
- .terminal-485984700-matrix {
+ .terminal-2396407494-matrix {
font-family: Fira Code, monospace;
font-size: 20px;
line-height: 24.4px;
font-variant-east-asian: full-width;
}
- .terminal-485984700-title {
+ .terminal-2396407494-title {
font-size: 18px;
font-weight: bold;
font-family: arial;
}
- .terminal-485984700-r1 { fill: #c5c8c6 }
-.terminal-485984700-r2 { fill: #c5c8c6;font-weight: bold }
-.terminal-485984700-r3 { fill: #d0b344;font-weight: bold }
-.terminal-485984700-r4 { fill: #68a0b3;font-weight: bold }
-.terminal-485984700-r5 { fill: #868887 }
-.terminal-485984700-r6 { fill: #cc555a }
-.terminal-485984700-r7 { fill: #8a4346 }
-.terminal-485984700-r8 { fill: #98a84b;font-weight: bold }
-.terminal-485984700-r9 { fill: #8d7b39;font-weight: bold }
+ .terminal-2396407494-r1 { fill: #c5c8c6 }
+.terminal-2396407494-r2 { fill: #d0b344 }
+.terminal-2396407494-r3 { fill: #c5c8c6;font-weight: bold }
+.terminal-2396407494-r4 { fill: #68a0b3;font-weight: bold }
+.terminal-2396407494-r5 { fill: #868887 }
+.terminal-2396407494-r6 { fill: #cc555a }
+.terminal-2396407494-r7 { fill: #d0b344;font-weight: bold }
+.terminal-2396407494-r8 { fill: #8a4346 }
+.terminal-2396407494-r9 { fill: #98a84b;font-weight: bold }
+.terminal-2396407494-r10 { fill: #8d7b39;font-weight: bold }
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -131,35 +132,35 @@
-
+
-
- $ casanovo sequence --help
-
-Usage: casanovo sequence [OPTIONS] PEAK_PATH...
-
- De novo sequence peptides from tandem mass spectra.
- PEAK_PATH must be one or more mzMl, mzXML, or MGF files from which to sequence
- peptides.
-
-╭─ Arguments ──────────────────────────────────────────────────────────────────╮
-│*PEAK_PATHFILE[required]│
-╰──────────────────────────────────────────────────────────────────────────────╯
-╭─ Options ────────────────────────────────────────────────────────────────────╮
-│--model-mFILE The model weights (.ckpt file). │
-│ If not provided, Casanovo will │
-│ try to download the latest │
-│ release. │
-│--output-oFILE The mzTab file to which results │
-│ will be written. │
-│--config-cFILE The YAML configuration file │
-│ overriding the default options. │
-│--verbosity-v[debug|info|warning|error] Set the verbosity of console │
-│ logging messages. Log files are │
-│ always set to 'debug'. │
-│--help-h Show this message and exit. │
-╰──────────────────────────────────────────────────────────────────────────────╯
-
+
+ $ casanovo sequence --help
+
+Usage:casanovo sequence [OPTIONS] PEAK_PATH...
+
+ De novo sequence peptides from tandem mass spectra.
+ PEAK_PATH must be one or more mzMl, mzXML, or MGF files from which to sequence
+ peptides.
+
+╭─ Arguments ──────────────────────────────────────────────────────────────────╮
+│* PEAK_PATH FILE[required]│
+╰──────────────────────────────────────────────────────────────────────────────╯
+╭─ Options ────────────────────────────────────────────────────────────────────╮
+│--model-mFILE The model weights (.ckpt file). │
+│ If not provided, Casanovo will │
+│ try to download the latest │
+│ release. │
+│--output-oFILE The mzTab file to which results │
+│ will be written. │
+│--config-cFILE The YAML configuration file │
+│ overriding the default options. │
+│--verbosity-v[debug|info|warning|error] Set the verbosity of console │
+│ logging messages. Log files are │
+│ always set to 'debug'. │
+│--help-h Show this message and exit. │
+╰──────────────────────────────────────────────────────────────────────────────╯
+
diff --git a/docs/images/train-help.svg b/docs/images/train-help.svg
index e70940ed..82c30122 100644
--- a/docs/images/train-help.svg
+++ b/docs/images/train-help.svg
@@ -19,146 +19,147 @@
font-weight: 700;
}
- .terminal-889313671-matrix {
+ .terminal-3340932753-matrix {
font-family: Fira Code, monospace;
font-size: 20px;
line-height: 24.4px;
font-variant-east-asian: full-width;
}
- .terminal-889313671-title {
+ .terminal-3340932753-title {
font-size: 18px;
font-weight: bold;
font-family: arial;
}
- .terminal-889313671-r1 { fill: #c5c8c6 }
-.terminal-889313671-r2 { fill: #c5c8c6;font-weight: bold }
-.terminal-889313671-r3 { fill: #d0b344;font-weight: bold }
-.terminal-889313671-r4 { fill: #68a0b3;font-weight: bold }
-.terminal-889313671-r5 { fill: #868887 }
-.terminal-889313671-r6 { fill: #cc555a }
-.terminal-889313671-r7 { fill: #8a4346 }
-.terminal-889313671-r8 { fill: #98a84b;font-weight: bold }
-.terminal-889313671-r9 { fill: #8d7b39;font-weight: bold }
+ .terminal-3340932753-r1 { fill: #c5c8c6 }
+.terminal-3340932753-r2 { fill: #d0b344 }
+.terminal-3340932753-r3 { fill: #c5c8c6;font-weight: bold }
+.terminal-3340932753-r4 { fill: #68a0b3;font-weight: bold }
+.terminal-3340932753-r5 { fill: #868887 }
+.terminal-3340932753-r6 { fill: #cc555a }
+.terminal-3340932753-r7 { fill: #d0b344;font-weight: bold }
+.terminal-3340932753-r8 { fill: #8a4346 }
+.terminal-3340932753-r9 { fill: #98a84b;font-weight: bold }
+.terminal-3340932753-r10 { fill: #8d7b39;font-weight: bold }
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -170,48 +171,48 @@
-
+
-
- $ casanovo train --help
-
-Usage: casanovo train [OPTIONS] TRAIN_PEAK_PATH...
-
- Train a Casanovo model on your own data.
- TRAIN_PEAK_PATH must be one or more annoated MGF files, such as those provided
- by MassIVE-KB, from which to train a new Casnovo model.
-
-╭─ Arguments ──────────────────────────────────────────────────────────────────╮
-│*TRAIN_PEAK_PATHFILE[required]│
-╰──────────────────────────────────────────────────────────────────────────────╯
-╭─ Options ────────────────────────────────────────────────────────────────────╮
-│*--validation_peak_pa…-pFILE An annotated MGF file │
-│ for validation, like │
-│ from MassIVE-KB. Use │
-│ this option multiple │
-│ times to specify │
-│ multiple files. │
-│[required] │
-│--model-mFILE The model weights │
-│ (.ckpt file). If not │
-│ provided, Casanovo │
-│ will try to download │
-│ the latest release. │
-│--output-oFILE The mzTab file to │
-│ which results will be │
-│ written. │
-│--config-cFILE The YAML configuration │
-│ file overriding the │
-│ default options. │
-│--verbosity-v[debug|info|warning|er Set the verbosity of │
-│ror] console logging │
-│ messages. Log files │
-│ are always set to │
-│ 'debug'. │
-│--help-h Show this message and │
-│ exit. │
-╰──────────────────────────────────────────────────────────────────────────────╯
-
+
+ $ casanovo train --help
+
+Usage:casanovo train [OPTIONS] TRAIN_PEAK_PATH...
+
+ Train a Casanovo model on your own data.
+ TRAIN_PEAK_PATH must be one or more annoated MGF files, such as those provided
+ by MassIVE-KB, from which to train a new Casnovo model.
+
+╭─ Arguments ──────────────────────────────────────────────────────────────────╮
+│* TRAIN_PEAK_PATH FILE[required]│
+╰──────────────────────────────────────────────────────────────────────────────╯
+╭─ Options ────────────────────────────────────────────────────────────────────╮
+│*--validation_peak_pa…-pFILE An annotated MGF file │
+│ for validation, like │
+│ from MassIVE-KB. Use │
+│ this option multiple │
+│ times to specify │
+│ multiple files. │
+│[required] │
+│--model-mFILE The model weights │
+│ (.ckpt file). If not │
+│ provided, Casanovo │
+│ will try to download │
+│ the latest release. │
+│--output-oFILE The mzTab file to │
+│ which results will be │
+│ written. │
+│--config-cFILE The YAML configuration │
+│ file overriding the │
+│ default options. │
+│--verbosity-v[debug|info|warning|er Set the verbosity of │
+│ror] console logging │
+│ messages. Log files │
+│ are always set to │
+│ 'debug'. │
+│--help-h Show this message and │
+│ exit. │
+╰──────────────────────────────────────────────────────────────────────────────╯
+
diff --git a/tests/unit_tests/test_runner.py b/tests/unit_tests/test_runner.py
index 663e3b3b..6be91831 100644
--- a/tests/unit_tests/test_runner.py
+++ b/tests/unit_tests/test_runner.py
@@ -56,6 +56,8 @@ def test_save_and_load_weights(tmp_path, mgf_small, tiny_config):
# Try changing model arch:
other_config = Config(tiny_config)
other_config.n_layers = 50 # lol
+ other_config.n_beams = 12
+ other_config.max_iters = 2
with torch.device("meta"):
# Now load the weights into a new model
# The device should be meta for all the weights.
@@ -64,6 +66,8 @@ def test_save_and_load_weights(tmp_path, mgf_small, tiny_config):
obs_layers = runner.model.encoder.transformer_encoder.num_layers
assert obs_layers == 1 # Match the original arch.
+ assert runner.model.n_beams == 12 # Match the config
+ assert runner.model.max_iters == 2 # Match the config
assert next(runner.model.parameters()).device == torch.device("meta")
# If the Trainer correctly moves the weights to the accelerator,