Lightning-AI / Lightning-AI/lightning-thunder
Dtype mismatch with LitGPT and autocast
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 121
- PR merge metrics
- No merged PRs in 30d
Description
## 🐛 Bug
### To Reproduce
```python
import thunder
from thunder.tests.litgpt_model import GPT
import torch
device = torch.device("cuda")
with device:
model = GPT.from_name("llama2-like")
x = torch.randint(0, 100, (2, 5))
model = thunder.jit(model)
with torch.autocast("cuda", torch.float16):
model(x)
print("Good!")
```
I believe the problem is in this `cat`
https://github.com/Lightning-AI/lightning-thunder/blob/main/thunder/tests/lit_gpt_model.py#L484
Where `q_roped` is in `float32` and the non-roped bits in `float16`
cc @crcrpar
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with thunder/tests/lit_gpt_model.py around line 484, where the reported torch.cat combines q_roped with the non-roped values. Run the provided LitGPT reproduction under torch.autocast("cuda", torch.float16) and inspect the operand dtypes and resulting failure. Done means the reproduction completes and the relevant behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- compilers, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100