-
Notifications
You must be signed in to change notification settings - Fork 143
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
Add PaliGemma LoRA #464
Add PaliGemma LoRA #464
Conversation
|
@@ -1,4 +1,4 @@ | |||
transformers>=4.36.0,<4.38.0 | |||
transformers>=4.36.0 |
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 remember pinning the version due to: #355
Not sure if never versions of transformers solve the problem, but if yes, probably lower-bound should be bumped
|
||
self.processor = AutoProcessor.from_pretrained(self.cache_dir) | ||
|
||
|
||
if __name__ == "__main__": |
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 know that not part of the change - but is that needed?
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.
sorry, is what needed? the main? no, it was just for testing, we can remove
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.
yeah, main
@@ -150,6 +161,36 @@ def download_model_artefacts_from_s3(self) -> None: | |||
raise NotImplementedError() | |||
|
|||
|
|||
class LoRAPaliGemma(PaliGemma): |
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.
Could you post a docs example + description on LoRA model?
I guess this class is needed to be able to load LoRA-fine-tuned models from hf hub as people are posting those, but what about our platform? PaliGemma is RoboflowInferenceModel
, but it seems that we don't load weights from our hosting - which may be the indication that this is kind of "core" model?
Also - is that always required to have HF token - or maybe we could rely on their auth?
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 can write up something more detailed but the short answer is this
- LoRA is a technique to train a small "diff" from some base model A
- This PR assumes that users will deploy the LoRA (the diff) to Roboflow, but in order to use it, they will need to download the base model A from huggingface
- This doesn't reduce the amount of data transferred on the first LoRA loaded, but will significantly reduce data transfer on subsequent LoRA loads -- from 6GB for a fully finetuned model, to only 28MB for a new LoRA
- This will also reduce our storage needs because we don't need to host 6GB for each fine tune, just 28MB for each LoRA
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.
So to be clear, we are loading weights from our hosting
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.
Also - is that always required to have HF token - or maybe we could rely on their auth?
I'm not sure I understand this question
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.
from previous answers I see that HF tokens will be required, at least sometimes
I have tested this implementation and successfully trained a model with LoRA. |
Fine, as long as we resolve this #464 (comment) we are free to merge, I believe that would only take testing CogVLM and probably setting |
Regarding question 2 form here |
@probicheaux - how we plan to move on with this? |
@PawelPeczek-Roboflow sorry, I've been super busy. Just fixed the get_model thing by pushing a new model_conversion param that adds |
Description
Add in class that can perform inference using LoRAs
Type of change
Please delete options that are not relevant.
How has this change been tested, please provide a testcase or example of how you tested the change?
Locally
Any specific deployment considerations
n/a
Docs