-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Api cleanup #648
Api cleanup #648
Conversation
I went ahead and cleaned up the function signatures related to both LoRA and 3D models. |
Also, I created a new submodule |
|
||
|
||
def get_3d_sam_model( | ||
def get_sam_3d_model( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed these names to match the order of sam_3d
we use everywhere else, cc @lufre1
# unclear how batches are handled | ||
def forward(self, batched_input, multimask_output, image_size) -> torch.Tensor: | ||
return self._forward_train(batched_input, multimask_output, image_size) | ||
def forward( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use_lora: bool = False, | ||
rank: Optional[int] = None, | ||
lora_rank: Optional[int] = None, | ||
lora_kwargs: Optional[Dict] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the use_lora
, since it is redundant with rank = None
and renamed rank
-> lora_rank
to have a more explicit name.
I added lora_kwargs
, so that we can also customize the PEFT SAM layers from here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me as well 🤝
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @constantinpape for the refactoring. This is GTG from my side.
Let's merge this once you think this is ready.
(PS. I was thinking if TrainableSAM
is adapted with PEFT_Sam
now as the test case seems to me that it is build in two stages: get_sam_model
+ PEFT_Sam
, where it could be done in one-stage with lora_rank
, but that's really minor and I can also take care of it later once we look at the LoRA experiments)
Thanks for checking everyone, I will go ahead and merge! |
Clean up interfaces related to 3d models and PEFT
No description provided.