## How C liberated the Memes Of Production How C liberated the Memes Of Production. by Christoph Lohmann <20h@r-36.net> ## In the Beginning: Tensorflow https://www.tensorflow.org/ * Required huge GPUs. * Required much time. * Was not easy to run everywhere. ## The Dark Times * Big companies held back AI. * Big companies told us, AI will always be only possible on their hardware. * Big companies told us, only their way is our way. ## Then came the Llama. https://www.theverge.com/2023/3/8/23629362/meta-ai-language-model-llama-leak-online-misuse Facebook/Meta's LLama model was leaked. Facebook/Meta decided to not take it down. Facebook/Meta decided to finally open source their model and regularily release it. But it all was made for Python, like Tensorflow. ## Then came C++ Llama. https://github.com/ggerganov/llama.cpp Inference of Meta's LLaMA model (and others) in pure C/C++ https://github.com/ggerganov/whisper.cpp High-performance inference of OpenAI's Whisper automatic speech recognition (ASR) model. ## Then came C. https://github.com/ggerganov/ggml http://ggml.ai/ The ggml way Minimal We like simplicity and aim to keep the codebase as small and as imple as possible Open Core The library and related projects are freely available under the MIT license. The development process is open and everyone is welcome to join. In the future we may choose to develop extensions that are licensed for commercial use Explore and have fun! We built ggml in the spirit of play. Contributors are encouraged to try crazy ideas, build wild demos, and push the edge of what’s possible ## ggml Written in C 16-bit float support Integer quantization support (4-bit, 5-bit, 8-bit, etc.) Automatic differentiation ADAM and L-BFGS optimizers Optimized for Apple Silicon On x86 architectures utilizes AVX / AVX2 intrinsics On ppc64 architectures utilizes VSX intrinsics No third-party dependencies Zero memory allocations during runtime ## gguf https://huggingface.co/docs/hub/gguf Hugging Face Hub supports all file formats, but has built-in features for GGUF format, a binary format that is optimized for quick loading and saving of models, making it highly efficient for inference purposes. GGUF is designed for use with GGML and other executors. GGUF was developed by @ggerganov who is also the developer of llama.cpp, a popular C/C++ LLM inference framework. Models initially developed in frameworks like PyTorch can be converted to GGUF format for use with those engines. ## Easy frontends. https://www.nomic.ai/gpt4all Run your GPT local in no time, everywhere. ## Stable Diffusion Followed Stable Difussion: https://github.com/CompVis/stable-diffusion A slow python inference for image generation. https://github.com/leejet/stable-diffusion.cpp > Plain C/C++ implementation based on ggml, working in the same way as llama.cpp ## The Revolution at Bitreich annna, how do I $someprompt? /home/annna/scm/ggml/build/bin/gpt-2 \ -m models/gpt-2-1558M/ggml-model.bin \ -t 8 ## The Revolution at Bitreich *::*::*) query=${text#**::} query=${query%%::*} annna-say -s "${server}" -c "${channel}" \ "$(stable-diffusion-emoji "${query}")" & stable-diffusion-emoji calls stable-diffusion ## The Revolution at Bitreich sdbase="/br/ai/stable-diffusion.cpp" sdcmd="${sdbase}/build/bin/sd -t 16 --steps 20 -s -1 -H 512 -W 512 \ --cfg-scale 8.0" sdmodel="${SD_MODEL:-${sdbase}/models/v2-1_768-nonema-pruned-ggml-model-f16.bin}" sdnegative='nipples, busty, nude, lowres, (worst quality, low quality, normal quality:2), cropped, infant, blur, haze, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, disfigured, deformed, body out of frame, bad anatomy, watermark, signature, cut off, low contrast, underexposed, overexposed, bad art, beginner, amateur, distorted face, blurry, draft, grainy, nsfw' outputf="${1}" shift 1 ${sdcmd} -m ${sdmodel} -o "${outputf}" -p "$@" -n "${sdnegative}" \ >/dev/null 2>&1 ## Generated Meme Count annna meme count (total on 2024-08-03: 22834) set log y 100000 +-----------------------------------------------------------------+ |+ + + + + + +| |+ total ***T*** TTTTTT +| |+ memes ###M### TMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +| 10000 |-emojis $$$E$$$ MMMMMMMMMMMMM +-| |filters %%%F%%% MMMMMM +| |+ MMM E +| 1000 |-+ MMM FFFFFFFFFFFFFFFFF +-| |+ MM FFFFFFFFFFF EEE +| |+ MMMMMM FFFFF E +| |+ MMMM FF EE +| 100 |-MMM FFF E +-| |MM F E +| |M FF $ +| 10 |M+ F E +-| |# +| |M +| |+ + + + + + +| 1 +-----------------------------------------------------------------+ 2018-12 2019-12 2020-12 2021-12 2022-12 2023-12 2024-12 ## The Revolution at Bitreich And that is just the beginning. When resources get cheaper, we can do: * Image modification * Image changing * Text2Video * Video modification Want to help? ## Thanks Thanks for Listening. Questions?