Callbacks
PredictionWriter
Bases: BasePredictionWriter
, Callback
A callback that writes predictions to disk at specified intervals during training.
Source code in bionemo/llm/utils/callbacks.py
31 32 33 34 35 36 37 38 39 40 41 42 43 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 |
|
__init__(output_dir, write_interval)
Initializes the callback.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_dir
|
str | PathLike
|
The directory where predictions will be written. |
required |
write_interval
|
IntervalT
|
The interval at which predictions will be written. (batch, epoch) |
required |
Source code in bionemo/llm/utils/callbacks.py
34 35 36 37 38 39 40 41 42 43 |
|
write_on_batch_end(trainer, pl_module, prediction, batch_indices, batch, batch_idx, dataloader_idx)
Writes predictions to disk at the end of each batch.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trainer
|
Trainer
|
The Trainer instance. |
required |
pl_module
|
LightningModule
|
The LightningModule instance. |
required |
prediction
|
Any
|
The prediction made by the model. |
required |
batch_indices
|
Sequence[int]
|
The indices of the batch. |
required |
batch
|
Any
|
The batch data. |
required |
batch_idx
|
int
|
The index of the batch. |
required |
dataloader_idx
|
int
|
The index of the dataloader. |
required |
Source code in bionemo/llm/utils/callbacks.py
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 |
|
write_on_epoch_end(trainer, pl_module, predictions, batch_indices)
Writes predictions to disk at the end of each epoch.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trainer
|
Trainer
|
The Trainer instance. |
required |
pl_module
|
LightningModule
|
The LightningModule instance. |
required |
predictions
|
Any
|
The predictions made by the model. |
required |
batch_indices
|
Sequence[int]
|
The indices of the batch. |
required |
Source code in bionemo/llm/utils/callbacks.py
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 |
|