Last active
May 30, 2023 10:26
-
-
Save rekalantar/ee86617125f15a97e1660d544e2807e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # load the pretrained weights for finetuning | |
| model = SamModel.from_pretrained("facebook/sam-vit-base") | |
| # make sure we only compute gradients for mask decoder (encoder weights are frozen) | |
| for name, param in model.named_parameters(): | |
| if name.startswith("vision_encoder") or name.startswith("prompt_encoder"): | |
| param.requires_grad_(False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment