Skip to content

Commit

Permalink
Add FAQ on how to change the LR scheduler (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
bittremieux authored Feb 14, 2024
1 parent c3d2bba commit dae8392
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@ To include new PTMs in Casanovo, you need to:
It is unfortunately not possible to finetune a pre-trained Casanovo model to add new types of PTMs.
Instead, such a model must be trained from scratch.

**How can I change the learning rate schedule used during training?**

By default, Casanovo uses a learning rate schedule that combines linear warm up followed by a cosine wave shaped decay (as implemented in `CosineWarmupScheduler` in `casanovo/denovo/model.py`) during training.
To use a different learning rate schedule, you can specify an alternative learning rate scheduler as follows (in the `lr_scheduler` variable in function `Spec2Pep.configure_optimizers` in `casanovo/denovo/model.py`):

```
lr_scheduler = torch.optim.lr_scheduler.LinearLR(optimizer, total_iters=self.warmup_iters)
```

You can use any of the scheduler classes available in [`torch.optim.lr_scheduler`](https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate) or implement your custom learning rate schedule similar to `CosineWarmupScheduler`.

## Miscellaneous

**How can I generate a precision–coverage curve?**
Expand Down

0 comments on commit dae8392

Please sign in to comment.