Most machine learning (ML) and deep learning (DL) libraries are dominated by the Python ecosystem. But with the rapid growth of Flutter and Dart, thereβs a clear need for native Dart ML tools.
Thatβs why I built ml_transformer β a lightweight, modular, and extensible machine learning & neural network library written entirely in Dart.
π Key Features
Transformer Architecture β Pre-LN block, Multi-Head Attention, FeedForward, LayerNorm, Rotary Positional Encoding (RoPE).
Core Layers β Embedding, Linear, LayerNorm, Attention, TransformerBlock.
Mini Training Engine β Autograd + AdamW optimizer for tiny training loops.
Quantization Helpers β int8, int4, int2, fp16, bf16.
ONNX Bridge β JSON-based import/export (protobuf support planned).
RNN Family β RNN, LSTM, GRU with batched forward.
Dataset & Batch API β Easy dataset loading & batching.
Callbacks & Monitoring β EarlyStopping, History.
FFI Acceleration β Native performance examples with NumPy references.
Unit Testing β Verified with NumPy integration and strong test coverage.
MIT Licensed β Fully open-source and free to use.
π― Why Dart for ML?
Flutter-first integration β Run ML pipelines directly in your apps.
Lightweight β Smaller footprint compared to heavy Python-based stacks.
Educational β Great for learning Transformer and RNN internals.
Prototyping β Build and test small-scale models quickly.
π Who Can Use It?
π§βπ Students β Explore neural networks in a new language.
π¨βπ» Developers β Add ML pipelines directly into Flutter projects.
π¬ Researchers β Use as a minimalist sandbox for experiments.
π Entrepreneurs β Quickly validate ideas with ML-enabled prototypes.
π¦ Installation
Add it to your pubspec.yaml:
dependencies:
ml_transformer: ^1.0.0
π Resources
π¦ Pub.dev package
π Score & Metrics
π» GitHub Repository
π¬ Closing Thoughts
This is just the beginning. ml_transformer is not intended to replace big ML frameworks β but to open the door for Dart/Flutter developers to experiment with ML natively.
Iβd love to hear your feedback, contributions, and ideas to make it even better π
π Try it out, fork it, and letβs push ML in Dart forward together!
Top comments (0)