Javascript BPE Encoder Decoder for GPT-2 / GPT-3 compatible with AWS Lambda
npm install gpt-3-encoder-lambdaThis lib can be used either with AWS Lambda or with any other "standard" node runtime / deployment
fs.readFileSync(...) as it's the case in the original implementation ```
npm install gpt-3-encoder-lambda
Compatible with Node >= 12
`js
const {encode, decode} = require('gpt-3-encoder-lambda')
const str = 'This is an example sentence to try encoding out on!'
const encoded = encode(str)
console.log('Encoded this string looks like: ', encoded)
console.log('We can look at each token and what it represents')
for(let token of encoded){
console.log({token, string: decode([token])})
}
const decoded = decode(encoded)
console.log('We can decode it back into:\n', decoded)
``