Infer esm2
get_parser()
Return the cli parser for this tool.
Source code in bionemo/esm2/scripts/infer_esm2.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
|
infer_esm2_entrypoint()
Entrypoint for running inference on a geneformer checkpoint and data.
Source code in bionemo/esm2/scripts/infer_esm2.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
infer_model(data_path, checkpoint_path, results_path, min_seq_length=1024, include_hiddens=False, include_embeddings=False, include_logits=False, include_input_ids=False, micro_batch_size=64, precision='bf16-mixed', tensor_model_parallel_size=1, pipeline_model_parallel_size=1, devices=1, num_nodes=1, prediction_interval='epoch', config_class=ESM2Config)
Runs inference on a BioNeMo ESM2 model using PyTorch Lightning.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_path
|
Path
|
Path to the input data. |
required |
checkpoint_path
|
Path
|
Path to the model checkpoint. |
required |
results_path
|
Path
|
Path to save the inference results. |
required |
min_seq_length
|
int
|
minimum sequence length to be padded. This should be at least equal to the length of largest sequence in the dataset |
1024
|
include_hiddens
|
bool
|
Whether to include hidden states in the output. Defaults to False. |
False
|
include_embeddings
|
bool
|
Whether to include embeddings in the output. Defaults to False. |
False
|
include_logits
|
(bool, Optional)
|
Whether to include token logits in the output. Defaults to False. |
False
|
include_input_ids
|
(bool, Optional)
|
Whether to include input_ids in the output. Defaults to False. |
False
|
micro_batch_size
|
int
|
Micro batch size for inference. Defaults to 64. |
64
|
precision
|
PrecisionTypes
|
Precision type for inference. Defaults to "bf16-mixed". |
'bf16-mixed'
|
tensor_model_parallel_size
|
int
|
Tensor model parallel size for distributed inference. Defaults to 1. |
1
|
pipeline_model_parallel_size
|
int
|
Pipeline model parallel size for distributed inference. Defaults to 1. |
1
|
devices
|
int
|
Number of devices to use for inference. Defaults to 1. |
1
|
num_nodes
|
int
|
Number of nodes to use for distributed inference. Defaults to 1. |
1
|
prediction_interval
|
IntervalT
|
Intervals to write predict method output into disck for DDP inference. Defaults to epoch. |
'epoch'
|
config_class
|
Type[BioBertConfig]
|
The config class for configuring the model using checkpoint provided |
ESM2Config
|
Source code in bionemo/esm2/scripts/infer_esm2.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 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 |
|