Socket
Socket
Sign inDemoInstall

gpt-3-encoder

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gpt-3-encoder - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

10

Encoder.js

@@ -23,8 +23,8 @@ // This file includes code which was modified from https://github.com/openai/gpt-2

const encodeStr = str => {
//return str.split('').map(x => ord(x))
return Array.from(textEncoder.encode(str)).map(x => x.toString())
}
const textDecoder = new TextDecoder("utf-8")
const decodeStr = arr => {
return arr.map(x => String.fromCharCode(x)).join('')
return textDecoder.decode(new Uint8Array(arr));
}

@@ -176,3 +176,5 @@

// const encoded = encode('hello 👋 world 🌍 This is a long string to test whether or not the emoji issue was fixed!')
// console.log({encoded})
module.exports = {
encode,
decode
};

11

package.json
{
"name": "gpt-3-encoder",
"version": "1.1.0",
"version": "1.1.1",
"description": "Javascript BPE Encoder Decoder for GPT-2 / GPT-3",

@@ -11,3 +11,3 @@ "main": "encoder.js",

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "jest"
},

@@ -23,3 +23,6 @@ "repository": {

},
"homepage": "https://github.com/AIDungeon/GPT-3-Encoder#readme"
}
"homepage": "https://github.com/AIDungeon/GPT-3-Encoder#readme",
"devDependencies": {
"jest": "^26.4.2"
}
}

@@ -8,5 +8,9 @@ GPT-3-Encoder

## Install with npm
`npm install gpt-3-encoder`
## Usage
Compatible with Node >= 12
```

@@ -13,0 +17,0 @@ const {encode, decode} = require('gpt-3-encoder')

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc