Convert
HFAMPLIFYImporter
Bases: ModelConnector[AutoModel, BionemoLightningModule]
Converts a Hugging Face AMPLIFY model to a NeMo AMPLIFY model.
Source code in bionemo/amplify/convert.py
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 |
|
config
property
Returns the transformed AMPLIFY config given the model tag.
tokenizer
property
We just have the one tokenizer for AMPLIFY.
apply(output_path)
Applies the transformation.
Source code in bionemo/amplify/convert.py
41 42 43 44 45 46 47 48 49 |
|
convert_state(source, target)
Converting HF state dict to NeMo state dict.
Source code in bionemo/amplify/convert.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
init()
Initialize the converted model.
Source code in bionemo/amplify/convert.py
37 38 39 |
|
SwiGLU
Bases: Module
Mock SwiGLU module.
This module is a mock implementation of the SwiGLU module that is only used to ensure we can load weight matrices correctly from the huggingface checkpoint without installing xformers in the framework container.
Source code in bionemo/amplify/convert.py
158 159 160 161 162 163 164 165 166 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 |
|
__init__(in_features, hidden_features, out_features=None, bias=True, *, _pack_weights=True)
Create a SwiGLU module.
Source code in bionemo/amplify/convert.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|
maybe_mock_xformers()
Optionally mock the xformers library to import amplify without the dependency.
Source code in bionemo/amplify/convert.py
196 197 198 199 200 201 202 203 204 |
|