Peft
ESM2LoRA
Bases: LoRA
LoRA for the BioNeMo2 ESM Model.
Source code in bionemo/esm2/model/finetune/peft.py
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 |
|
__call__(model)
This method is called when the object is called as a function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Module
|
The input model. |
required |
Returns:
Type | Description |
---|---|
Module
|
The modified model. |
Source code in bionemo/esm2/model/finetune/peft.py
40 41 42 43 44 45 46 47 48 49 50 51 |
|
selective_freeze(m, name=None, prefix=None)
Freezes specific modules in the given model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
m
|
Module
|
The model to selectively freeze. |
required |
name
|
str
|
The name of the module to freeze. Valid values are "encoder" and "embedding". |
None
|
prefix
|
str
|
The prefix of the module to freeze. |
None
|
Returns:
Type | Description |
---|---|
nn.Module: The modified model with the specified modules frozen. |
See Also
nemo.collections.llm.fn.mixin.FNMixin
Source code in bionemo/esm2/model/finetune/peft.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|