gpt-3-encoder
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -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 | ||
}; |
{ | ||
"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') |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
140
0
33
1505090
1