Skip to content
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

Caformer finetuning. Adapter/LoRa? #7

Open
kacwin opened this issue Jan 10, 2023 · 5 comments
Open

Caformer finetuning. Adapter/LoRa? #7

kacwin opened this issue Jan 10, 2023 · 5 comments

Comments

@kacwin
Copy link

kacwin commented Jan 10, 2023

Hey,
great job with this repo. Caformer with 100M parameters is really powerful, though I am struggling with the finetuning due to hardware limitations. Did you already make experiments with something like adapter finetuning or LoRA? At first glance, the code looks like one would need to rewrite a lot for this.

@yuweihao
Copy link
Collaborator

Hi @kacwin ,

Many thanks for your attention. I did not conduct experiments with adapter finetuning or LoRA. For hardware limitations, since all models in the paper do not use Batch Norm, we can set --grad-accum-steps.

@kacwin
Copy link
Author

kacwin commented Jan 12, 2023

Thanks for the info,
using gradient accumulation would be kind of a last resort; there simply is too much data. I will try some LoRA experiments in the near future, can give an update on that if you want.

@yuweihao
Copy link
Collaborator

Many thanks!

@kacwin
Copy link
Author

kacwin commented Feb 13, 2023

Hello,
we did some experiments with LoRa finetuning.

  • We started with Caformer_b36_384 and did linear probing (freezing the network aside from the mlp head) on a classification task with domain shift ---> accuracy ~30%
  • We repeated the experiment with a full finetuning ---> accuracy ~65%
  • Lastly, we implemented parallel LoRa layers for all linear layers in Caformer. We then froze the original linear weights and only trained the LoRa layers as well as the Conv2d layers (in the downsampling stages and in the SepConv blocks). This left us with 10M trainable parameters, compared to 100M parameters at full finetuning ---> accuracy 61%

So with a fraction of trainable parameters, we achieved similar results. However, training time/GPU space sadly did not decrease that much (maybe factor 0.66). I think there is some potential here :)

@yuweihao
Copy link
Collaborator

Thanks for sharing valuable experiment results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants