computational-cell-analytics / micro-sam

Segment Anything for Microscopy
https://computational-cell-analytics.github.io/micro-sam/
MIT License
311 stars 35 forks source link

Add LoRA Implementation #611

Closed anwai98 closed 2 weeks ago

anwai98 commented 2 weeks ago

@constantinpape Thanks for all the suggestions. I thought about all your feedback ,and imcorporated them now in a much more flexible design. Let me know if I missed something or you spot some more room for improvement. Thanks!

anwai98 commented 2 weeks ago

@constantinpape Thanks for the feedback. I've updated the PEFT_Sam block as mentioned, so that it is now independent of any assumptions to update parts of the backbone, and instead the self.peft_module will be responsible of doing this from now on (i.e. the surgery class provided by the user to handle everything for the attention blocks).

I also added a simple test for the PEFT_Sam class.

Let me know how things look now. Thanks!

anwai98 commented 2 weeks ago

To add, looks like tests at test_bioimageio/test_model_export.py are failing for some reason.

anwai98 commented 2 weeks ago

Hi @constantinpape, this PR is GTG from my side now. Thanks!