gpt-3-encoder
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -68,3 +68,3 @@ // This file includes code which was modified from https://github.com/openai/gpt-2 | ||
const pat = /'s|'t|'re|'ve|'m|'l l|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu | ||
const pat = /'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu | ||
@@ -86,8 +86,8 @@ const decoder = {} | ||
const bpe_ranks = dictZip(bpe_merges, range(0, bpe_merges.length)) | ||
const cache = {} | ||
const cache = new Map; | ||
function bpe(token) { | ||
if (token in cache) { | ||
return cache[token] | ||
} | ||
if (cache.has(token)) { | ||
return cache.get(token) | ||
}`` | ||
@@ -152,3 +152,3 @@ let word = token.split('') | ||
word = word.join(' ') | ||
cache[token] = word | ||
cache.set(token, word) | ||
@@ -155,0 +155,0 @@ return word |
{ | ||
"name": "gpt-3-encoder", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Javascript BPE Encoder Decoder for GPT-2 / GPT-3", | ||
"main": "Encoder.js", | ||
"main": "index.js", | ||
"types": "./index.d.ts", | ||
"files": [ | ||
"Encoder.js", | ||
"encoder.json", | ||
"vocab.bpe" | ||
"vocab.bpe", | ||
"index.d.ts" | ||
], | ||
@@ -10,0 +13,0 @@ "scripts": { |
@@ -1,2 +0,2 @@ | ||
GPT-3-Encoder | ||
# GPT-3-Encoder | ||
Javascript BPE Encoder Decoder for GPT-2 / GPT-3 | ||
@@ -9,3 +9,5 @@ | ||
`npm install gpt-3-encoder` | ||
``` | ||
npm install gpt-3-encoder | ||
``` | ||
@@ -16,3 +18,3 @@ ## Usage | ||
``` | ||
```js | ||
const {encode, decode} = require('gpt-3-encoder') | ||
@@ -19,0 +21,0 @@ |
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
1505408
8
149
35