A pure Crystal machine learning library for building and training neural networks with CPU/GPU support and PyTorch compatibility.
SHAInet is a neural network library written in pure Crystal, designed for building and training machine learning models. It provides tools for creating various network architectures, supports both CPU and GPU computation, and includes features for handling large datasets and importing models from frameworks like PyTorch. The library aims to simplify neural network development while maintaining performance and flexibility.
Crystal developers and researchers interested in machine learning, especially those looking for a native Crystal solution for neural networks or needing GPU-accelerated model training within the Crystal ecosystem.
Developers choose SHAInet for its seamless integration with Crystal, offering a pure-Crystal implementation with optional GPU acceleration via CUDA. Its ability to import PyTorch and HuggingFace models provides interoperability, while features like streaming data support make it practical for real-world, large-scale applications.
SHAInet - a pure Crystal machine learning library
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Written entirely in Crystal, it offers a seamless experience for Crystal developers without cross-language overhead, as highlighted by its clean API and native shard installation.
Leverages CUDA with optional cuDNN integration for performance boosts, automatically detecting hardware and allowing optimized kernel builds, as detailed in the installation guide.
Supports importing models from PyTorch and HuggingFace via methods like `load_from_pt`, enabling reuse of existing models within the Crystal ecosystem.
Includes streaming data support with configurable chunking and shuffling, allowing training on large datasets without memory bottlenecks, as shown in the streaming example.
Offers multiple layer types, activation functions, and training algorithms (e.g., SGD, Adam), providing versatility for various neural network tasks, from XOR to transformers.
Crystal's smaller community means fewer third-party libraries, tutorials, and support resources compared to Python, which can hinder development and troubleshooting.
Enabling CUDA requires manual steps like setting LD_LIBRARY_PATH, compiling with flags, and kernel building, making setup error-prone and less user-friendly.
While it supports basics and transformers, it may lack cutting-edge optimizations or specialized layers found in mature frameworks like PyTorch, limiting state-of-the-art research.
The README is concise with basic examples, and with a small community, finding detailed guides or advanced use cases can be challenging for complex projects.