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

Sudden nan values from the loss during LoRA training #186

Open
MH-Python opened this issue Dec 4, 2024 · 0 comments
Open

Sudden nan values from the loss during LoRA training #186

MH-Python opened this issue Dec 4, 2024 · 0 comments

Comments

@MH-Python
Copy link

Thank you for the nice compact work.
We have started recently to face an ambiguous error casing the loss to become nan during the training. After enabling anomaly detection " torch.autograd.set_detect_anomaly(True)"
We got this:

UserWarning: Error detected in MmBackward0. Traceback of forward call that caused the error:
...stacktrace...
.venv/lib/python3.10/site-packages/peft/tuners/lora/layer.py", line 569, in forward
result = result + lora_B(lora_A(dropout(x))) * scaling

...stacktrace...
return Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
RuntimeError: Function 'MmBackward0' returned nan values in its 1th output.

Could it be caused by some numerical instability (nan or inf)?

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

1 participant