gpt-encoder 0.1.1

Rust BPE Encoder Decoder for GPT-2 / GPT-3
Documentation
  • Coverage
  • 80%
    4 out of 5 items documented3 out of 5 items with examples
  • Size
  • Source code size: 1.51 MB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.71 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 25s Average build duration of successful builds.
  • all releases: 25s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • mohanavel15/gpt-encoder
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • mohanavel15

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"
}