Skip to content

Browser-based implementation of BPE Encoder / Decoder for GPT-2 / GPT-3

Notifications You must be signed in to change notification settings

sandor-szabo/gpt-encoder

 
 

Repository files navigation

gpt-encoder

GPT-2 and GPT-3 use byte pair encoding to turn text into a series of integers to feed into the model. latitudegames implemented this in Node.js. This is an implementation of their encoder for use in the browser, re-written in Typescript.

Installation

npm install @beskar-labs/gpt-encoder

Usage

import { encode } from '@beskar-labs/gpt-encoder';

const tokens = encode(
  'This is an example sentence to try encoding out on!'
).length;

About

Browser-based implementation of BPE Encoder / Decoder for GPT-2 / GPT-3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.2%
  • TypeScript 0.8%