r/pytorch • • 4d ago

torchtest2

I've released a small open-source library: torchtest2. Hopefully, it'll be useful to anyone building custom neural network models.

torchtest2 runs checks like:

  • whether every parameter gets a gradient;
  • whether the output depends on all inputs;
  • whether samples don't leak or mix across the batch.

Overall, I hope it saves you hours of wasted GPU time by catching "silent bugs" that don't raise runtime errors.

I'd love to hear your thoughts and feedback—and bug reports or pull requests would be even better😊

📄 Article: https://arxiv.org/abs/2611.23273
📦 PyPI: https://pypi.org/project/torchtest2/ (pip install torchtest2)
💻 Code: https://github.com/Hrehory/torchtest2 (Apache 2.0)

5 Upvotes

3 comments sorted by

1

u/KatzSubtilis 4d ago

I really liked what you did there, because you grasp the core pain point of working with NNs: the very fact that setting up a training loop and a model architecture is almost impossible to fully abstract away, making it a manual engineering task that's much more prone to bugs than traditional ML.

I'm currently facing the same issue from the opposite perspective, as I'm building a library of composable utilities for training and serving with PyTorch. I'll definitely give your solution a try as an end-of-training callback in my project. Thanks for sharing!

1

u/ggwardys 4d ago

You're welcome! Fingers crossed for your project!

1

u/AnoProgrammer 4d ago

Great definitely going to check it out.