[D] Modern best coding practices for Pytorch (for research)? : r/MachineLearning
Beginners -> /r/mlquestions or /r/learnmachinelearning , AGI -> /r/singularity, career advices -> /r/cscareerquestions, datasets -> r/datasets Hi all, I've been using Pytorch since 2019, and it has changed a lot in that time (especially since huggingface). Are there any modern guides/style-docs/example-repos you would recommend? For example, are namedtensors a good/common practice? Is Pytorch Lightning recommended? What are the best config management tools these days? How often do you use torch.script or torch.compile? I really like the torchcfm library (it does flow matching) as an example of something modern and nontrivial that is none the less implemented in an extremely clean and well-organized way. I think there's a real need for something akin to namedtensors, in the sense that reading regular pytorch code often doesn't give clear indications about what the meaning or shape of tensors is expected to be. At the same time, though, I think the lack of enthusiastic adoption suggests
I really like the torchcfm library (it does flow matching) as an example of something modern and nontrivial that is none the less implemented in an extremely clean and well-organized way. I think there's a real need for something akin to namedtensors, in the sense that reading regular pytorch code often doesn't give clear indications about what the meaning or shape of tensors is expected to be. At the same time, though, I think the lack of enthusiastic adoption suggests that namedtensors don't really solve that problem; I think people have found it a lot easier to just remember various…
related reading
- Making Deep Learning go Brrrr From First Principleshorace.io
- PyTorch internals : ezyang's blogblog.ezyang.com
- A friendly introduction to machine learning compilers and optimizershuyenchip.com
- A Recipe for Training Neural Networkskarpathy.github.io
- State of torch.compile for training (August 2025) : ezyang's blogblog.ezyang.com
- PyTorch in One Hour: From Tensors to Training Neural Networks on Multiple GPUssebastianraschka.com
- ⚡ Migrating from PTL - Composerdocs.mosaicml.com
- LightningModule - PyTorch Lightning 2.6.1 documentationlightning.ai
- A Recipe for Training Neural Networkskarpathy.github.io
- Tensor Considered Harmfulnlp.seas.harvard.edu
- UW PLSE | How does torch.compile work?uwplse.org
- Get Startedpytorch.org