Train
train_model(experiment_name, experiment_dir, config, data_module, n_steps_train, metric_tracker=None, tokenizer=get_tokenizer(), peft=None, _use_rich_model_summary=True)
Trains a BioNeMo ESM2 model using PyTorch Lightning.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_name
|
str
|
The name of the experiment. |
required |
experiment_dir
|
Path
|
The directory where the experiment will be saved. |
required |
config
|
ESM2GenericConfig
|
The configuration for the ESM2 model. |
required |
data_module
|
LightningDataModule
|
The data module for training and validation. |
required |
n_steps_train
|
int
|
The number of training steps. |
required |
metric_tracker
|
Callback | None
|
Optional callback to track metrics |
None
|
tokenizer
|
BioNeMoESMTokenizer
|
The tokenizer to use. Defaults to |
get_tokenizer()
|
peft
|
PEFT | None
|
The PEFT (Parameter-Efficient Fine-Tuning) module. Defaults to None. |
None
|
_use_rich_model_summary
|
bool
|
Whether to use the RichModelSummary callback, omitted in our test suite until https://nvbugspro.nvidia.com/bug/4959776 is resolved. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
Path
|
A tuple containing the path to the saved checkpoint, a MetricTracker |
Callback | None
|
object, and the PyTorch Lightning Trainer object. |
Source code in bionemo/esm2/model/finetune/train.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|