gpt-encoder

Crates.iogpt-encoder
lib.rsgpt-encoder
version0.1.1
sourcesrc
created_at2023-04-24 07:53:03.535263
updated_at2023-05-02 09:03:09.809386
descriptionRust BPE Encoder Decoder for GPT-2 / GPT-3
homepage
repositoryhttps://github.com/mohanavel15/gpt-encoder
max_upload_size
id847144
size1,510,403
Mohan (mohanavel15)

documentation

README

GPT-Encoder

Rust BPE Encoder Decoder for GPT-2 / GPT-3

This is rewrite of openai's gpt-2 encoder and latitudegames's GPT-3-Encoder in rust
use gpt_encoder::Encoder;

fn main() {
    let mut encoder = Encoder::new();
    let encoded = encoder.encode("Hello, World".to_string());
    println!("{:?}", encoded); 
    // prints: [15496, 11, 2159]

    let decoded = encoder.decode(encoded);
    println!("{:?}", decoded); 
    // prints: "Hello, World"
}
Commit count: 6

cargo fmt