tiny-dream  by symisc

Header-only C++ library for Stable Diffusion inference

Created 2 years ago
265 stars

Top 96.6% on SourcePulse

GitHubView on GitHub
Project Summary

Tiny Dream is a header-only, dependency-free C++ implementation of Stable Diffusion, designed for efficient CPU inference with a low memory footprint (1.7-5.5 GB RAM). It targets developers needing to embed AI image generation capabilities into existing C++ applications without requiring specific GPU hardware.

How It Works

Tiny Dream leverages C++17 for its implementation, focusing on CPU efficiency through TBB threading and SSE/AVX vectorization. It uses the ncnn tensor library as its default backend, with plans to migrate to lighter libraries like SOD or GGML for further CPU performance optimization. The library is designed for straightforward integration, requiring only two header files (tinydream.hpp and stb_image_write.h) and pre-trained models.

Quick Start & Requirements

  • Install/Run: Compile with a C++17 compiler (GCC 7+, Clang, MSVC) and link against ncnn. Example command: g++ -o tinydream boilerplate.cpp -funsafe-math-optimizations -Ofast -flto=auto -funroll-all-loops -pipe -march=native -std=c++17 -Wall -Wextra pkg-config --cflags --libs ncnn -lstdc++ -pthread -Wl -flto -fopt-info-vec-optimized
  • Prerequisites: C++17 compiler, ncnn library, pre-trained models (2GB+).
  • Resources: Requires 1.7-5.5 GB RAM.
  • Docs: Official Documentation

Highlighted Details

  • Header-only, dependency-free (except stb_image_write.h).
  • Supports Real-ESRGAN upscaling.
  • Features "Words Priority" for prompt weighting and output metadata linking.
  • Can generate 512x512 or 2048x2048 images.

Maintenance & Community

  • Developed by PixLab / Symisc Systems.
  • Roadmap includes GUI, WebAssembly, and alternative format outputs.
  • Related projects include SOD (Computer Vision), FACEIO (Facial Authentication), and UnQLite (Database).

Licensing & Compatibility

  • License is not explicitly stated in the README, but PixLab projects are typically proprietary or have custom licensing. Further clarification is needed for commercial use.

Limitations & Caveats

The README does not explicitly state the license, which is crucial for commercial adoption. The project currently relies on ncnn, with plans to switch to potentially less mature libraries (SOD, GGML), which might introduce compatibility or stability changes.

Health Check
Last Commit

1 year ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
0 stars in the last 30 days

Explore Similar Projects

Starred by Chaoyu Yang Chaoyu Yang(Founder of Bento), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
3 more.

nunchaku by nunchaku-tech

1.9%
3k
High-performance 4-bit diffusion model inference engine
Created 10 months ago
Updated 2 days ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems") and Ying Sheng Ying Sheng(Coauthor of SGLang).

fastllm by ztxz16

0.4%
4k
High-performance C++ LLM inference library
Created 2 years ago
Updated 1 week ago
Starred by François Chollet François Chollet(Author of Keras; Cofounder of Ndea, ARC Prize), Chaoyu Yang Chaoyu Yang(Founder of Bento), and
13 more.

neon by NervanaSystems

0%
4k
Deep learning framework (discontinued)
Created 11 years ago
Updated 4 years ago
Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Jiayi Pan Jiayi Pan(Author of SWE-Gym; MTS at xAI), and
34 more.

flash-attention by Dao-AILab

0.6%
20k
Fast, memory-efficient attention implementation
Created 3 years ago
Updated 1 day ago
Feedback? Help us improve.