You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And I modified the line 163 from dX = torch.matmul(DW_f, upW.t(), out = X) to dX = torch.matmul(DW_f, upW.t()).to(X.dtype) ; the line 291 from dX = torch.matmul(dQ, QW.t(), out = X) to dX = torch.matmul(dQ, QW.t()).to(X.dtype)
That worked! The only potentially relevant difference in our code I could see (with untrained eyes) is that I was using the "paged_adamw_8bit" optimizer from a prior qlora notebook, and you used the "adamw_8bit" optimizer. I assume that was the issue,
changed the title [-]RuntimeError: expected out tensor to have dtyoe c10::Half, but got float instead[/-][+]Paged_adam8_bit has casting issues[/+]on Dec 15, 2023
Activity
danielhanchen commentedon Dec 11, 2023
@qy1026 oh are u using
torch.cuda.amp.autocast? So in HF's trainer did u pass in eitherfp16 = Trueorbf16 = True(if it supports it)You can do that, except memory usage might balloon a bit. If it works, then thats good.
discordianbelle commentedon Dec 15, 2023
I'm a little less code inclined, and I'm struggling with this. I put together a Colab, and If I pass fp16=True or not I get this same error.
If I wanted to implement this fix myself and use it in Colab, would I have to fork the repo and clone my fork?
danielhanchen commentedon Dec 15, 2023
@discordianbelle let me try out
vicuna-7b-v1.5to see if I can reproduce the error. If I can, I'll push a fix, and it should be fixed by tomorrow!qy1026 commentedon Dec 15, 2023
I've already used
dtype=torch.float16inFastLlamaModel.from_pretrained()function.danielhanchen commentedon Dec 15, 2023
@discordianbelle @qy1026 I just tried vicuna and it works in Colab: https://colab.research.google.com/drive/1_wC2tjQ0_uiVkZlFr1br5m-PnLwnDXc-?usp=sharing
Maybe reinstalling Unsloth or updating it could make it work?
discordianbelle commentedon Dec 15, 2023
That worked! The only potentially relevant difference in our code I could see (with untrained eyes) is that I was using the "paged_adamw_8bit" optimizer from a prior qlora notebook, and you used the "adamw_8bit" optimizer. I assume that was the issue,
Thank you so much!
danielhanchen commentedon Dec 15, 2023
@discordianbelle oh wait thats weird - let me check up on
paged_adamw_8bit- all optimizers should work - so I'll get back to you.[-]RuntimeError: expected out tensor to have dtyoe c10::Half, but got float instead[/-][+]Paged_adam8_bit has casting issues[/+]danielhanchen commentedon Dec 16, 2023
Ok that's very weird - I just tried
paged_adamw_8bitan it seems to work? Could the issue maybe be fixed after updating Unsloth?danielhanchen commentedon Dec 25, 2023
Closing now since
paged_adamw_8bitworks fine on my trialsSaving Utils (unslothai#26)
Saving Utils (unslothai#26)
Saving Utils (unslothai#26)
Merge pull request unslothai#26 from unslothai/fix/fix-existing-route…
[Bug] AMD NPU: Qwen3.5 Q4NX exports fail to load in FastFlowLM (unslo…