Crates.io | rsllm |
lib.rs | rsllm |
version | 0.6.2 |
source | src |
created_at | 2024-03-17 21:22:58.599641 |
updated_at | 2024-05-09 00:23:20.981623 |
description | Rust AI Stream Analyzer Twitch Bot |
homepage | https://github.com/groovybits/rsllm/wiki |
repository | https://github.com/groovybits/rsllm |
max_upload_size | |
id | 1176828 |
size | 853,853 |
RsLLM is AI pipeline 100% in Rust for Transformer/Tensor code that is leveraging the Candle framework from Huggingface. It represents a systems programming language approach to AI model interaction and stream analysis. It can run locally on GPUs, it is focused on support of MacOS devices equipped with M1/M2/M3 ARM GPUs. This AI pipeline is designed for developers and researchers aiming to integrate local large language models (LLMs) with Rust, bypassing the need for external dependencies and Python code for chatbots and other AI programs. At its core, RsLLM emphasizes the utilization of local LLMs for generating text, images, and speech within a Rust environment, offering a robust suite of features for real-time data stream analysis and AI-driven content creation. RsLLM can run a Twitch channell chat bot and NDI video/audio with generated Stable Diffusion images and TTS Speech output through software compatible with NDI. You can setup OBS to take the NDI feed and setup your Twitch channel then have a full chatting and speaking/image generating customizable Twitch channel. Fully AI driven, you can automate a Twitch Streamer somewhat. Also you can analyze MpegTS streams or OS System stats too, if desired you can combine the two and have chat users comment and query the stream analyzing it effectively.
Candle, a project by Huggingface, offers Rust-native LLMs like Mistral and Gemma, optimized for Metal GPUs on MacOS. This integration facilitates local execution of LLMs, ensuring high performance and low latency in AI model interactions.
While RsLLM's primary focus is on running local LLMs, it also provides support for the OpenAI API, enabling users to leverage external AI models when necessary. This feature ensures versatility and broad applicability in various AI-driven projects using custom models.
RsLLM excels in analyzing real-time data streams and generating AI-driven content, including text, images, and speech. It aims to create a dynamic interaction model where voice inputs can be converted into text commands for the LLM, and the generated outputs can be streamed back as voice or visual content.
Clone the Repository:
git clone https://github.com/groovybits/rsllm.git
Navigate to the Project Directory:
cd rsllm
Compile with Metal GPU Support and NDI SDK support:
./scripts/compile.sh # Script handles NDI SDK dependency and DYLD_LIBRARY_PATH
.env.example
to .env
and customize the settings, including the OpenAI API key if intending to use external AI models.RsLLM is designed to facilitate a wide range of AI-driven operations, from generating text-based content to analyzing network streams and processing visual and audio inputs. Advanced features like NDI audio output and voice-to-text input processing are in development, aiming to enhance the interactive capabilities of the toolkit.
Use the scripts in the ./scripts directory.
./scripts/compile.sh # Build RsLLM
./scripts/twitch.sh # Full command line shown for most features
./scripts/mpeg_analyzer.sh # Experimental MpegTS Analyzer mode (WIP)
./scripts/mpeg_poetry.sh # Fun poetry about MpegTS Broadcasting with stream input prompt injection
./scripts/system_health.sh # System health status from OS Stats prompt injection
Running with Candle and OS Stats for AI System Analysis:
cargo run --release --features fonts,ndi,mps,metavoice,audioplayer -- \
--candle_llm gemma \
--model-id "2b-it" \
--max-tokens 800 \
--temperature 0.8 \
--ai-os-stats \
--sd-image \
--ndi-images \
--ndi-audio \
--system-prompt "You create image prompts from OS system stats health state." \
--query "How is my system doing? Create a report on the system health as visual image descriptions."
RsLLM is enhancing its output capabilities to include NDI (Network Device Interface) support for images and TTS (Text-to-Speech) audio, facilitating high-quality, low-latency video streaming over IP networks.
--features ndi
to the Cargo build command to include NDI support in your build.scripts/compile.sh
, which will retrieve the libndi.dylib that works best for MacOS.cargo --features=ndi
, set the DYLD_LIBRARY_PATH
environment variable:export DYLD_LIBRARY_PATH=`pwd`:$DYLD_LIBRARY_PATH
huggingface-cli login
to authenticate.Candle, our core Rust framework for LLM interaction, now includes MetaVoice, a groundbreaking Text-to-Speech (TTS) technology. As this feature improves, it will enable pure Rust-based LLM, TTI (Text-to-Image), and TTS functionalities, seamlessly integrated with Metal GPU optimizations for MacOS.
RsLLM's mission is to research and explore the implementation of a versatile, high-performance toolkit for AI-driven content creation and analysis on MacOS, leveraging the full potential of Metal GPUs and Rust's efficiency.
Contributions are warmly welcomed, especially in areas such as feature development, performance optimization, and documentation. Your expertise can significantly enhance the toolkit's capabilities and user experience.
This project is licensed under the MIT License. See the LICENSE file for detailed information.
Chris Kennedy, leading the development of innovative AI solutions with the MacOS Metal GPU Rust LLM Toolkit. February 2024.
We are committed to pushing the boundaries of AI integration with Video Technology and Multimodal input/output on MacOS Arm CPUs in pure Rust, ensuring media developers and researchers have access to powerful, efficient, and versatile tools for their AI-driven projects.