keras-nlp icon indicating copy to clipboard operation
keras-nlp copied to clipboard

Any plans for QLora?

Open asmith26 opened this issue 1 year ago • 2 comments

Hi there! keras-nlp supports Lora, e.g. from https://ai.google.dev/gemma/docs/lora_tuning

...
gemma_lm.backbone.enable_lora(rank=4)
...

Just wondering are there any plans to implement QLora finetuning, to help make finetuning even more accessible on smaller GPUs? https://arxiv.org/abs/2305.14314 https://huggingface.co/blog/4bit-transformers-bitsandbytes

Many thanks for any help, and this lib!

asmith26 avatar Mar 31 '24 11:03 asmith26

Yes actually! We are currently working or rolling out some support for quantization generally and quantize lora.

We will work on some actual docs for this soon, but for now you can check out the qlora.py in the description of this PR to see what we are working on -> https://github.com/keras-team/keras/pull/19356/

I believe the 4 bit normal float from the qlora paper is not currently available, but int8 quantized weights layered in with lora should be good to go.

Early days on the feature, so any feedback appreciated as we build it out.

mattdangerw avatar Apr 01 '24 23:04 mattdangerw

This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.

github-actions[bot] avatar Apr 16 '24 01:04 github-actions[bot]

Guide on this incoming...

https://github.com/keras-team/keras-io/pull/1889

mattdangerw avatar Jul 19 '24 17:07 mattdangerw

Hi @asmith26,

Could you please confirm if this issue is resolved for you with the above comment ? Please feel free to close the issue if it is resolved ?

Thank you.

Gopi-Uppari avatar Sep 30 '24 05:09 Gopi-Uppari

Have got this working https://keras.io/examples/keras_recipes/parameter_efficient_finetuning_of_gemma_with_lora_and_qlora/#qlora-finetuning

Many thanks again!

asmith26 avatar Oct 15 '24 18:10 asmith26