Replies: 2 comments 2 replies
-
Hi @anwai98 1- First, quantize your Vision Transformers with accelerate & bitsandbytes: https://huggingface.co/docs/accelerate/v0.29.3/en/usage_guides/quantization#bitsandbytes-integration to quantize it in 4-bit precision. You might leave the classification head un-quantized (that's what we do for LLMs) Hope this helps ! |
Beta Was this translation helpful? Give feedback.
-
Hi @younesbelkada, As always, things take longer than expected (one could argue this took wayyyyyyyyyyyyyyyy longer for me, apologies for coming back so late). I think I have a workflow prepared for me, however I am encountering an issue with exploding gradients right after the first backprop (no success in debugging it so far). Maybe you (or someone in the community) can help me with this (I'll outlike my workflow below, in case we spot the obvious issues already):
The first iteration with the forward pass works as expected (loss is computed, ~realistic float values -> and then right after backprop for the first iteration itself, I get NaN values for my loss). Any help would be appreciated. Thanks in advance! PS. I would be happy to share more details (here's the WIP branch computational-cell-analytics/micro-sam@dev...qlora) |
Beta Was this translation helpful? Give feedback.
-
Hi community,
Thanks to the huggingface team for this awesome repo 😉
I have a question: I would like to check out QLoRa on vision transformers. I found this gem which helps me to get a rough idea of how to integrate LoRa in computer vision models (haven't tested yet), and I see some hints here on quantization. Could someone guide me on how to integrate the two? (basically to achieve QLoRa-based finetuning for pretrained vision transformers).
(My best guess is both the config files (one for LoRa and/or one from the quantization library) come together in one place, I am a bit unsure of the right way to go ahead with this)
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions