h2o-llmstudio icon indicating copy to clipboard operation
h2o-llmstudio copied to clipboard

Using both LORA and FSDP results in error

Open shridharsamantaroy opened this issue 2 years ago • 2 comments

🐛 Bug

Setting both LORA and FSDP options to true while fine tuning results in

ValueError: FlatParameter requires uniform dtype but got torch.float16 and torch.float32

To Reproduce

Run an experiment with the OASST data set (https://www.kaggle.com/code/philippsinger/openassistant-conversations-dataset-oasst1?scriptVersionId=126228752) with both LORA and FSDP turned on

I have also attached the experiment configuration and logs logs_osst-example-fsdp.zip

shridharsamantaroy avatar May 05 '23 17:05 shridharsamantaroy

I have same errors .Did you solve it?

moseshu avatar May 19 '23 05:05 moseshu

Thank you for bringing up this issue!

The occurrence of the ValueError can be attributed to selecting float16 as the Backbone Dtype. This could be fixed by changing the data type to float32. Yet, another issue arises: ValueError: FlatParameter requires uniform requires_grad, which seems to be a bug in the torch library (see here).

Therefore, it appears that FSDP is currently incompatible with LORA. I'll monitor this issue and push a fix once available (or this will be fixed in peft/torch libraries, ideally).

maxjeblick avatar May 19 '23 07:05 maxjeblick