A Ruby deep learning library powered by LibTorch, providing a PyTorch-like API for Ruby developers.
Torch.rb is a deep learning library for Ruby that provides a PyTorch-like API, powered by LibTorch. It allows Ruby developers to perform tensor computations, build neural networks, and leverage GPU acceleration for machine learning tasks directly within Ruby applications.
Ruby developers and data scientists who want to implement deep learning models without leaving the Ruby ecosystem, especially those familiar with PyTorch's API.
It offers a seamless bridge between Ruby and PyTorch's performance, with an idiomatic Ruby API, GPU support, and compatibility with PyTorch tutorials and models.
Deep learning for Ruby, powered by LibTorch
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Leverages LibTorch, PyTorch's C++ backend, for efficient tensor computations and GPU acceleration, matching PyTorch's core performance.
Adapts PyTorch's API to Ruby conventions, using methods like add! for in-place operations and tensor? for boolean checks, making it intuitive for Ruby developers.
Supports CUDA on Linux and Metal Performance Shaders on Apple silicon, enabling faster training on compatible hardware, as detailed in the performance section.
Allows easy conversion between Torch tensors and Numo arrays with x.numo and Torch.from_numo, facilitating integration with Ruby's scientific computing stack.
Users can follow PyTorch tutorials and convert code to Ruby, as noted in the API section, reducing the learning curve for those familiar with PyTorch.
Excludes Windows support entirely, limiting its use to Linux and Mac environments, which is a significant barrier for some development teams.
Requires manual download of LibTorch and compilation of extensions, taking 5-10 minutes and potentially causing setup errors, as highlighted in the installation instructions.
While companion gems exist, the overall deep learning ecosystem in Ruby is smaller, with fewer community resources and pre-trained models compared to Python's PyTorch.
Loading models saved in Python requires extra steps to convert parameters due to bugs in LibTorch, adding friction to cross-language workflows, as admitted in the saving and loading section.