Lightning-AI / Lightning-AI/pytorch-lightning
Precision output conversion in Lite wrappers
@Atharva-Phatak is already working on this.
Since Oct 18, 2022.
- Dominant language
- Python
- Stars
- 31.4k
- Forks
- 3.8k
- Avg merge
- 6d 7h
- Merged PRs (30d)
- 6
Description
## 🚀 Feature
Discussion: Should the forward of LightningLite's `_LiteModule` wrapper convert the outputs back to default precision?
https://github.com/Lightning-AI/lightning/blob/a3258391416c8f96c05c044562f9ad7f6880733b/src/lightning_lite/wrappers.py#L115-L118
### Motivation
Original motivation was to have a precision-agnostic module wrapper such that user does not need to convert outputs when switching to different precision backends. However, on the other hand it takes away control from the user.
### Pitch
A) Keep as is (convert output to default type)
B) Convert it back to the type the input had (here, input refers to the input of the wrapper, NOT the inner module)
C) Do nothing. Return the output as it was returned by the inner forward
### Additional context
Raised in https://github.com/Lightning-AI/lightning/pull/14792#discussion_r977698959
______________________________________________________________________
#### If you enjoy Lightning, check out our other projects! ⚡
- [**Metrics**](https://github.com/Lightning-AI/metrics): Machine learning metrics for distributed, scalable PyTorch applications.
- [**Lite**](https://pytorch-lightning.readthedocs.io/en/latest/starter/lightning_lite.html): enables pure PyTorch users to scale their existing code on any kind of device while retaining full control over their own loops and optimization logic.
- [**Flash**](https://github.com/Lightning-AI/lightning-flash): The fastest way to get a Lightning baseline! A collection of tasks for fast prototyping, baselining, fine-tuning, and solving problems with deep learning.
- [**Bolts**](https://github.com/Lightning-AI/lightning-bolts): Pretrained SOTA Deep Learning models, callbacks, and more for research and production with PyTorch Lightning and PyTorch.
- [**Lightning Transformers**](https://github.com/Lightning-AI/lightning-transformers): Flexible interface for high-performance research using SOTA Transformers leveraging PyTorch Lightning, Transformers, and Hydra.
Contributor guide
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.
Assessment
This issue has not been assessed yet.