Documentation
Everything you need to build and run RustyLM locally.
1
Installation & Building
Clone the repository and build the binary using Cargo. Enable --features cuda for NVIDIA GPU acceleration.
Terminal
$ git clone https://github.com/Kem0wow/rustylm.git $ cd rustylm # CPU Only (SIMD Native) $ cargo build --release # CUDA GPU Accelerated $ cargo build --release --features cuda
2
CLI Commands & Flags
Run models directly from Hugging Face model directories containing config.json, tokenizer.json, and *.safetensors.
CLI Usage
# Interactive Chat REPL $ ./target/release/rustylm run models/qwen2.5-1.5b-instruct # Single Prompt Answer $ ./target/release/rustylm run models/qwen2.5-1.5b-instruct "Explain gravity briefly." # List Local Models $ ./target/release/rustylm list # With VRAM Limit Cap (800 MiB VRAM + System RAM offload) $ RUSTYLM_VRAM_CAP=800 ./target/release/rustylm run models/qwen2.5-1.5b-instruct
3
Rust Code Example
Embed rustylm directly into your Rust applications with 3 clean methods: load, ask, and generate.
src/main.rs
use rustylm::{Engine, Device, Params}; fn main() -> Result<(), Box<dyn std::error::Error>> { // 1. Load model directory let engine = Engine::load("models/qwen2.5-1.5b-instruct", Device::Auto)?; // 2. Single direct answer println!("{}", engine.ask("What is the capital of France?")?); // 3. Token streaming with sampling let params = Params::default(); let stats = engine.generate("Write a haiku about Rust.", ¶ms, |chunk| { print!("{}", chunk); })?; println!("\n{:.1} tok/s", stats.tokens_per_sec()); Ok(()) }