Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.3 to 1.1.4

index.d.ts

12

Encoder.js

@@ -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 @@

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