1 unstable release
0.1.1 | May 2, 2023 |
---|---|
0.1.0 |
|
#167 in #encoder
30 downloads per month
560KB
176 lines
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"
}
lib.rs
:
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
Example
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"
}
Dependencies
~2.7–4MB
~75K SLoC