#language-model #nlp #ai #llm #llama #mistral

kalosm-language-model

A common interface for language models/transformers

7 releases

0.3.3 Aug 28, 2024
0.3.2 Aug 14, 2024
0.2.1 Feb 28, 2024
0.1.0 Dec 16, 2023

#884 in Machine learning

Download history 22/week @ 2024-07-18 15/week @ 2024-07-25 25/week @ 2024-08-01 317/week @ 2024-08-08 143/week @ 2024-08-15 136/week @ 2024-08-22 116/week @ 2024-08-29 30/week @ 2024-09-05 149/week @ 2024-09-12 224/week @ 2024-09-19 190/week @ 2024-09-26 91/week @ 2024-10-03 62/week @ 2024-10-10 104/week @ 2024-10-17 58/week @ 2024-10-24 56/week @ 2024-10-31

300 downloads per month
Used in 12 crates (8 directly)

MIT/Apache

300KB
7K SLoC

Language Model

This crate provides a unified interface for language models. It supports streaming text, sampling, and embedding.

Usage (with the RPhi implementation crate)

use kalosm::language::*;

#[tokio::main]
async fn main() {
    let mut model = Llama::phi_3().await.unwrap();
    let prompt = "The capital of France is ";
    let mut result = model.stream_text(prompt).await.unwrap();

    print!("{prompt}");
    while let Some(token) = result.next().await {
        print!("{token}");
    }
}

Dependencies

~33–48MB
~803K SLoC