Crates.io | gpt-encoder |
lib.rs | gpt-encoder |
version | 0.1.1 |
source | src |
created_at | 2023-04-24 07:53:03.535263 |
updated_at | 2023-05-02 09:03:09.809386 |
description | Rust BPE Encoder Decoder for GPT-2 / GPT-3 |
homepage | |
repository | https://github.com/mohanavel15/gpt-encoder |
max_upload_size | |
id | 847144 |
size | 1,510,403 |
Rust BPE Encoder Decoder for GPT-2 / GPT-3
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"
}