Skip to content

Issues setting trainable parameters in LoRA adapter #2217

Answered by BenjaminBossan
anferico asked this question in Q&A
Discussion options

You must be logged in to vote

Okay, so IIUC, the core of the problem is that you would like to treat other_param the same as the other modules_to_save but it doesn't work as modules_to_save can only target modules but not parameters.

In theory, you can just manually set the requires_grad argument on this parameter, e.g. model.base_model.model.other_param.requires_grad = True. Then this parameter should train. However, when you then call model.save_pretrained, it will not be included in the checkpoint. Therefore, you would have to save it separately and also load it separately.

The reason why we cannot simply allow modules_to_save to work on nn.Parameters is that we cannot control how they're being used by the model. W…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@anferico
Comment options

@BenjaminBossan
Comment options

@anferico
Comment options

Answer selected by anferico
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants