From 3509fc405bf74734ed17c892c2c74bf693a647e5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Mar 2024 15:49:41 +0200 Subject: [PATCH 1/5] Bump webpack-dev-middleware from 5.3.3 to 5.3.4 (#661) Bumps [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) from 5.3.3 to 5.3.4. - [Release notes](https://github.com/webpack/webpack-dev-middleware/releases) - [Changelog](https://github.com/webpack/webpack-dev-middleware/blob/v5.3.4/CHANGELOG.md) - [Commits](https://github.com/webpack/webpack-dev-middleware/compare/v5.3.3...v5.3.4) --- updated-dependencies: - dependency-name: webpack-dev-middleware dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index dc479579c..5a7331e9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7717,9 +7717,9 @@ } }, "node_modules/webpack-dev-middleware": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz", - "integrity": "sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==", + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz", + "integrity": "sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q==", "dev": true, "dependencies": { "colorette": "^2.0.10", From 8804c36591d11d8456788d1bb4b16489121b3be2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Mar 2024 22:45:55 +0200 Subject: [PATCH 2/5] Bump ip from 2.0.0 to 2.0.1 in /examples/electron (#665) Bumps [ip](https://github.com/indutny/node-ip) from 2.0.0 to 2.0.1. - [Commits](https://github.com/indutny/node-ip/compare/v2.0.0...v2.0.1) --- updated-dependencies: - dependency-name: ip dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- examples/electron/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/electron/package-lock.json b/examples/electron/package-lock.json index e3a48f32b..5b1ad977e 100644 --- a/examples/electron/package-lock.json +++ b/examples/electron/package-lock.json @@ -3066,9 +3066,9 @@ } }, "node_modules/ip": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz", + "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==", "dev": true }, "node_modules/is-arrayish": { From f71ee32dd9e4b5aef77e9f5062860cf660faa946 Mon Sep 17 00:00:00 2001 From: Jonathan Padilla <44036128+jonathanpv@users.noreply.github.com> Date: Wed, 10 Apr 2024 08:13:36 -0500 Subject: [PATCH 3/5] Add binary embedding quantization support to FeatureExtraction pipeline (#691) * Add binary embedding quantization support to FeatureExtraction pipeline * Add JSDoc return type * Apply suggestions from code review * Update src/utils/tensor.js * Update example code snippet * Update src/pipelines.js --------- Co-authored-by: Joshua Lochner --- src/pipelines.js | 19 +++++++++++++++++++ src/tokenizers.js | 4 ++-- src/utils/tensor.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/src/pipelines.js b/src/pipelines.js index 2b064d522..3b15af53d 100644 --- a/src/pipelines.js +++ b/src/pipelines.js @@ -67,6 +67,7 @@ import { Tensor, mean_pooling, interpolate, + quantize_embeddings, } from './utils/tensor.js'; import { RawImage } from './utils/image.js'; @@ -1112,6 +1113,8 @@ export class ZeroShotClassificationPipeline extends (/** @type {new (options: Te * @typedef {Object} FeatureExtractionPipelineOptions Parameters specific to feature extraction pipelines. * @property {'none'|'mean'|'cls'} [pooling="none"] The pooling method to use. * @property {boolean} [normalize=false] Whether or not to normalize the embeddings in the last dimension. + * @property {boolean} [quantize=false] Whether or not to quantize the embeddings. + * @property {'binary'|'ubinary'} [precision='binary'] The precision to use for quantization. * * @callback FeatureExtractionPipelineCallback Extract the features of the input(s). * @param {string|string[]} texts One or several texts (or one list of texts) to get the features of. @@ -1157,6 +1160,16 @@ export class ZeroShotClassificationPipeline extends (/** @type {new (options: Te * // dims: [1, 384] * // } * ``` + * **Example:** Calculating binary embeddings with `sentence-transformers` models. + * ```javascript + * const extractor = await pipeline('feature-extraction', 'Xenova/all-MiniLM-L6-v2'); + * const output = await extractor('This is a simple test.', { pooling: 'mean', quantize: true, precision: 'binary' }); + * // Tensor { + * // type: 'int8', + * // data: Int8Array [49, 108, 24, ...], + * // dims: [1, 48] + * // } + * ``` */ export class FeatureExtractionPipeline extends (/** @type {new (options: TextPipelineConstructorArgs) => FeatureExtractionPipelineType} */ (Pipeline)) { /** @@ -1171,6 +1184,8 @@ export class FeatureExtractionPipeline extends (/** @type {new (options: TextPip async _call(texts, { pooling = /** @type {'none'} */('none'), normalize = false, + quantize = false, + precision = /** @type {'binary'} */('binary'), } = {}) { // Run tokenization @@ -1203,6 +1218,10 @@ export class FeatureExtractionPipeline extends (/** @type {new (options: TextPip result = result.normalize(2, -1); } + if (quantize) { + result = quantize_embeddings(result, precision); + } + return result; } } diff --git a/src/tokenizers.js b/src/tokenizers.js index 5b58e37c0..e671c8318 100644 --- a/src/tokenizers.js +++ b/src/tokenizers.js @@ -2653,8 +2653,8 @@ export class PreTrainedTokenizer extends Callable { } } else { - if (text === null) { - throw Error('text may not be null') + if (text === null || text === undefined) { + throw Error('text may not be null or undefined') } if (Array.isArray(text_pair)) { diff --git a/src/utils/tensor.js b/src/utils/tensor.js index ccdf781be..469054cac 100644 --- a/src/utils/tensor.js +++ b/src/utils/tensor.js @@ -1193,3 +1193,47 @@ export function ones(size) { export function ones_like(tensor) { return ones(tensor.dims); } + +/** + * Quantizes the embeddings tensor to binary or unsigned binary precision. + * @param {Tensor} tensor The tensor to quantize. + * @param {'binary'|'ubinary'} precision The precision to use for quantization. + * @returns {Tensor} The quantized tensor. + */ +export function quantize_embeddings(tensor, precision) { + if (tensor.dims.length !== 2) { + throw new Error("The tensor must have 2 dimensions"); + } + if (tensor.dims.at(-1) % 8 !== 0) { + throw new Error("The last dimension of the tensor must be a multiple of 8"); + } + if (!['binary', 'ubinary'].includes(precision)) { + throw new Error("The precision must be either 'binary' or 'ubinary'"); + } + + const signed = precision === 'binary'; + const dtype = signed ? 'int8' : 'uint8'; + + // Create a typed array to store the packed bits + const cls = signed ? Int8Array : Uint8Array; + const inputData = tensor.data; + const outputData = new cls(inputData.length / 8); + + // Iterate over each number in the array + for (let i = 0; i < inputData.length; ++i) { + // Determine if the number is greater than 0 + const bit = inputData[i] > 0 ? 1 : 0; + + // Calculate the index in the typed array and the position within the byte + const arrayIndex = Math.floor(i / 8); + const bitPosition = i % 8; + + // Pack the bit into the typed array + outputData[arrayIndex] |= bit << (7 - bitPosition); + if (signed && bitPosition === 0) { + outputData[arrayIndex] -= 128; + } + }; + + return new Tensor(dtype, outputData, [tensor.dims[0], tensor.dims[1] / 8]); +} From cdbc532cf6ffb16f44348faa001f1ce9d778a7de Mon Sep 17 00:00:00 2001 From: Joshua Lochner Date: Wed, 10 Apr 2024 16:07:58 +0200 Subject: [PATCH 4/5] Update dependencies (#702) * Bump vite from 4.5.2 to 4.5.3 in /examples/tokenizer-playground (#693) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.5.2 to 4.5.3. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v4.5.3/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v4.5.3/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump express from 4.18.2 to 4.19.2 (#666) Bumps [express](https://github.com/expressjs/express) from 4.18.2 to 4.19.2. - [Release notes](https://github.com/expressjs/express/releases) - [Changelog](https://github.com/expressjs/express/blob/master/History.md) - [Commits](https://github.com/expressjs/express/compare/4.18.2...4.19.2) --- updated-dependencies: - dependency-name: express dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump vite from 5.0.12 to 5.0.13 in /examples/remove-background-client (#694) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.0.12 to 5.0.13. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v5.0.13/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v5.0.13/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump vite from 5.0.12 to 5.0.13 in /examples/zero-shot-classification (#695) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.0.12 to 5.0.13. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v5.0.13/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v5.0.13/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump vite from 5.0.12 to 5.0.13 in /examples/depth-anything-client (#696) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.0.12 to 5.0.13. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v5.0.13/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v5.0.13/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump vite from 5.0.12 to 5.0.13 in /examples/semantic-audio-search (#697) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.0.12 to 5.0.13. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v5.0.13/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v5.0.13/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump vite from 4.5.2 to 4.5.3 in /examples/code-completion (#698) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.5.2 to 4.5.3. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v4.5.3/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v4.5.3/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump vite from 5.1.4 to 5.1.7 in /examples/video-object-detection (#699) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.1.4 to 5.1.7. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v5.1.7/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v5.1.7/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump vite from 5.1.1 to 5.1.7 in /examples/cross-encoder (#700) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.1.1 to 5.1.7. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v5.1.7/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v5.1.7/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump vite from 5.1.1 to 5.1.7 in /examples/adaptive-retrieval (#701) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.1.1 to 5.1.7. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v5.1.7/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v5.1.7/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- examples/adaptive-retrieval/package-lock.json | 8 +- examples/adaptive-retrieval/package.json | 2 +- examples/code-completion/package-lock.json | 8 +- examples/code-completion/package.json | 2 +- examples/cross-encoder/package-lock.json | 8 +- examples/cross-encoder/package.json | 2 +- .../depth-anything-client/package-lock.json | 8 +- examples/depth-anything-client/package.json | 2 +- .../package-lock.json | 8 +- .../remove-background-client/package.json | 2 +- .../semantic-audio-search/package-lock.json | 8 +- examples/semantic-audio-search/package.json | 2 +- .../tokenizer-playground/package-lock.json | 8 +- examples/tokenizer-playground/package.json | 2 +- .../video-object-detection/package-lock.json | 8 +- examples/video-object-detection/package.json | 2 +- .../package-lock.json | 8 +- .../zero-shot-classification/package.json | 2 +- package-lock.json | 201 ++++++++++++++---- 19 files changed, 206 insertions(+), 85 deletions(-) diff --git a/examples/adaptive-retrieval/package-lock.json b/examples/adaptive-retrieval/package-lock.json index 46c97e84c..5ba3dfb24 100644 --- a/examples/adaptive-retrieval/package-lock.json +++ b/examples/adaptive-retrieval/package-lock.json @@ -23,7 +23,7 @@ "eslint-plugin-react-refresh": "^0.4.5", "postcss": "^8.4.33", "tailwindcss": "^3.4.1", - "vite": "^5.0.12" + "vite": "^5.1.7" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -5587,9 +5587,9 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "node_modules/vite": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.1.tgz", - "integrity": "sha512-wclpAgY3F1tR7t9LL5CcHC41YPkQIpKUGeIuT8MdNwNZr6OqOTLs7JX5vIHAtzqLWXts0T+GDrh9pN2arneKqg==", + "version": "5.1.7", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.7.tgz", + "integrity": "sha512-sgnEEFTZYMui/sTlH1/XEnVNHMujOahPLGMxn1+5sIT45Xjng1Ec1K78jRP15dSmVgg5WBin9yO81j3o9OxofA==", "dev": true, "dependencies": { "esbuild": "^0.19.3", diff --git a/examples/adaptive-retrieval/package.json b/examples/adaptive-retrieval/package.json index 579150e33..3b7310338 100644 --- a/examples/adaptive-retrieval/package.json +++ b/examples/adaptive-retrieval/package.json @@ -25,6 +25,6 @@ "eslint-plugin-react-refresh": "^0.4.5", "postcss": "^8.4.33", "tailwindcss": "^3.4.1", - "vite": "^5.0.12" + "vite": "^5.1.7" } } diff --git a/examples/code-completion/package-lock.json b/examples/code-completion/package-lock.json index 0f71a179e..197127c59 100644 --- a/examples/code-completion/package-lock.json +++ b/examples/code-completion/package-lock.json @@ -24,7 +24,7 @@ "eslint-plugin-react-refresh": "^0.4.3", "postcss": "^8.4.31", "tailwindcss": "^3.3.3", - "vite": "^4.5.2" + "vite": "^4.5.3" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -4633,9 +4633,9 @@ "license": "MIT" }, "node_modules/vite": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.2.tgz", - "integrity": "sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==", + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.3.tgz", + "integrity": "sha512-kQL23kMeX92v3ph7IauVkXkikdDRsYMGTVl5KY2E9OY4ONLvkHf04MDTbnfo6NKxZiDLWzVpP5oTa8hQD8U3dg==", "dev": true, "dependencies": { "esbuild": "^0.18.10", diff --git a/examples/code-completion/package.json b/examples/code-completion/package.json index fdd64ad97..05f94b5b5 100644 --- a/examples/code-completion/package.json +++ b/examples/code-completion/package.json @@ -26,7 +26,7 @@ "eslint-plugin-react-refresh": "^0.4.3", "postcss": "^8.4.31", "tailwindcss": "^3.3.3", - "vite": "^4.5.2" + "vite": "^4.5.3" }, "overrides": { "protobufjs": "^7.2.4" diff --git a/examples/cross-encoder/package-lock.json b/examples/cross-encoder/package-lock.json index 4e18bd6cd..571019f77 100644 --- a/examples/cross-encoder/package-lock.json +++ b/examples/cross-encoder/package-lock.json @@ -23,7 +23,7 @@ "eslint-plugin-react-refresh": "^0.4.5", "postcss": "^8.4.33", "tailwindcss": "^3.4.1", - "vite": "^5.0.12" + "vite": "^5.1.7" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -5587,9 +5587,9 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "node_modules/vite": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.1.tgz", - "integrity": "sha512-wclpAgY3F1tR7t9LL5CcHC41YPkQIpKUGeIuT8MdNwNZr6OqOTLs7JX5vIHAtzqLWXts0T+GDrh9pN2arneKqg==", + "version": "5.1.7", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.7.tgz", + "integrity": "sha512-sgnEEFTZYMui/sTlH1/XEnVNHMujOahPLGMxn1+5sIT45Xjng1Ec1K78jRP15dSmVgg5WBin9yO81j3o9OxofA==", "dev": true, "dependencies": { "esbuild": "^0.19.3", diff --git a/examples/cross-encoder/package.json b/examples/cross-encoder/package.json index 4804b7cbb..a505be482 100644 --- a/examples/cross-encoder/package.json +++ b/examples/cross-encoder/package.json @@ -25,6 +25,6 @@ "eslint-plugin-react-refresh": "^0.4.5", "postcss": "^8.4.33", "tailwindcss": "^3.4.1", - "vite": "^5.0.12" + "vite": "^5.1.7" } } diff --git a/examples/depth-anything-client/package-lock.json b/examples/depth-anything-client/package-lock.json index 63e029d95..c24c4db67 100644 --- a/examples/depth-anything-client/package-lock.json +++ b/examples/depth-anything-client/package-lock.json @@ -12,7 +12,7 @@ "three": "^0.160.1" }, "devDependencies": { - "vite": "^5.0.8" + "vite": "^5.0.13" } }, "node_modules/@esbuild/aix-ppc64": { @@ -1404,9 +1404,9 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "node_modules/vite": { - "version": "5.0.12", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.12.tgz", - "integrity": "sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==", + "version": "5.0.13", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.13.tgz", + "integrity": "sha512-/9ovhv2M2dGTuA+dY93B9trfyWMDRQw2jdVBhHNP6wr0oF34wG2i/N55801iZIpgUpnHDm4F/FabGQLyc+eOgg==", "dev": true, "dependencies": { "esbuild": "^0.19.3", diff --git a/examples/depth-anything-client/package.json b/examples/depth-anything-client/package.json index 1bedaa6af..0adf621a0 100644 --- a/examples/depth-anything-client/package.json +++ b/examples/depth-anything-client/package.json @@ -9,7 +9,7 @@ "preview": "vite preview" }, "devDependencies": { - "vite": "^5.0.8" + "vite": "^5.0.13" }, "dependencies": { "@xenova/transformers": "^2.14.1", diff --git a/examples/remove-background-client/package-lock.json b/examples/remove-background-client/package-lock.json index 4320625cc..95fc5ed41 100644 --- a/examples/remove-background-client/package-lock.json +++ b/examples/remove-background-client/package-lock.json @@ -11,7 +11,7 @@ "@xenova/transformers": "^2.15.0" }, "devDependencies": { - "vite": "^5.0.12" + "vite": "^5.0.13" } }, "node_modules/@esbuild/aix-ppc64": { @@ -1398,9 +1398,9 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "node_modules/vite": { - "version": "5.0.12", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.12.tgz", - "integrity": "sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==", + "version": "5.0.13", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.13.tgz", + "integrity": "sha512-/9ovhv2M2dGTuA+dY93B9trfyWMDRQw2jdVBhHNP6wr0oF34wG2i/N55801iZIpgUpnHDm4F/FabGQLyc+eOgg==", "dev": true, "dependencies": { "esbuild": "^0.19.3", diff --git a/examples/remove-background-client/package.json b/examples/remove-background-client/package.json index c95061e34..b5669082d 100644 --- a/examples/remove-background-client/package.json +++ b/examples/remove-background-client/package.json @@ -9,7 +9,7 @@ "preview": "vite preview" }, "devDependencies": { - "vite": "^5.0.12" + "vite": "^5.0.13" }, "dependencies": { "@xenova/transformers": "^2.15.0" diff --git a/examples/semantic-audio-search/package-lock.json b/examples/semantic-audio-search/package-lock.json index 30cfbb235..864183715 100644 --- a/examples/semantic-audio-search/package-lock.json +++ b/examples/semantic-audio-search/package-lock.json @@ -12,7 +12,7 @@ "deepscatter": "github:nomic-ai/deepscatter" }, "devDependencies": { - "vite": "^5.0.12" + "vite": "^5.0.13" } }, "node_modules/@75lb/deep-merge": { @@ -2042,9 +2042,9 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "node_modules/vite": { - "version": "5.0.12", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.12.tgz", - "integrity": "sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==", + "version": "5.0.13", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.13.tgz", + "integrity": "sha512-/9ovhv2M2dGTuA+dY93B9trfyWMDRQw2jdVBhHNP6wr0oF34wG2i/N55801iZIpgUpnHDm4F/FabGQLyc+eOgg==", "dev": true, "dependencies": { "esbuild": "^0.19.3", diff --git a/examples/semantic-audio-search/package.json b/examples/semantic-audio-search/package.json index 547f8a21c..972d964d3 100644 --- a/examples/semantic-audio-search/package.json +++ b/examples/semantic-audio-search/package.json @@ -9,7 +9,7 @@ "preview": "vite preview" }, "devDependencies": { - "vite": "^5.0.12" + "vite": "^5.0.13" }, "dependencies": { "@xenova/transformers": "^2.10.1", diff --git a/examples/tokenizer-playground/package-lock.json b/examples/tokenizer-playground/package-lock.json index 1c1dd0f4e..e3a04b4de 100644 --- a/examples/tokenizer-playground/package-lock.json +++ b/examples/tokenizer-playground/package-lock.json @@ -23,7 +23,7 @@ "eslint-plugin-react-refresh": "^0.4.3", "postcss": "^8.4.31", "tailwindcss": "^3.3.3", - "vite": "^4.5.2" + "vite": "^4.5.3" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -4973,9 +4973,9 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "node_modules/vite": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.2.tgz", - "integrity": "sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==", + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.3.tgz", + "integrity": "sha512-kQL23kMeX92v3ph7IauVkXkikdDRsYMGTVl5KY2E9OY4ONLvkHf04MDTbnfo6NKxZiDLWzVpP5oTa8hQD8U3dg==", "dev": true, "dependencies": { "esbuild": "^0.18.10", diff --git a/examples/tokenizer-playground/package.json b/examples/tokenizer-playground/package.json index b79938781..0f7500879 100644 --- a/examples/tokenizer-playground/package.json +++ b/examples/tokenizer-playground/package.json @@ -25,7 +25,7 @@ "eslint-plugin-react-refresh": "^0.4.3", "postcss": "^8.4.31", "tailwindcss": "^3.3.3", - "vite": "^4.5.2" + "vite": "^4.5.3" }, "overrides": { "protobufjs": "^7.2.4" diff --git a/examples/video-object-detection/package-lock.json b/examples/video-object-detection/package-lock.json index d4a49ec72..9ece04cd3 100644 --- a/examples/video-object-detection/package-lock.json +++ b/examples/video-object-detection/package-lock.json @@ -11,7 +11,7 @@ "@xenova/transformers": "^2.15.0" }, "devDependencies": { - "vite": "^5.0.12" + "vite": "^5.1.7" } }, "node_modules/@esbuild/aix-ppc64": { @@ -1437,9 +1437,9 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "node_modules/vite": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.4.tgz", - "integrity": "sha512-n+MPqzq+d9nMVTKyewqw6kSt+R3CkvF9QAKY8obiQn8g1fwTscKxyfaYnC632HtBXAQGc1Yjomphwn1dtwGAHg==", + "version": "5.1.7", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.7.tgz", + "integrity": "sha512-sgnEEFTZYMui/sTlH1/XEnVNHMujOahPLGMxn1+5sIT45Xjng1Ec1K78jRP15dSmVgg5WBin9yO81j3o9OxofA==", "dev": true, "dependencies": { "esbuild": "^0.19.3", diff --git a/examples/video-object-detection/package.json b/examples/video-object-detection/package.json index 29e30c073..d4ac2d672 100644 --- a/examples/video-object-detection/package.json +++ b/examples/video-object-detection/package.json @@ -9,7 +9,7 @@ "preview": "vite preview" }, "devDependencies": { - "vite": "^5.0.12" + "vite": "^5.1.7" }, "dependencies": { "@xenova/transformers": "^2.15.0" diff --git a/examples/zero-shot-classification/package-lock.json b/examples/zero-shot-classification/package-lock.json index 59705084f..6a37ea1b5 100644 --- a/examples/zero-shot-classification/package-lock.json +++ b/examples/zero-shot-classification/package-lock.json @@ -23,7 +23,7 @@ "eslint-plugin-react-refresh": "^0.4.5", "postcss": "^8.4.33", "tailwindcss": "^3.4.1", - "vite": "^5.0.12" + "vite": "^5.0.13" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -5497,9 +5497,9 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "node_modules/vite": { - "version": "5.0.12", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.12.tgz", - "integrity": "sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==", + "version": "5.0.13", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.13.tgz", + "integrity": "sha512-/9ovhv2M2dGTuA+dY93B9trfyWMDRQw2jdVBhHNP6wr0oF34wG2i/N55801iZIpgUpnHDm4F/FabGQLyc+eOgg==", "dev": true, "dependencies": { "esbuild": "^0.19.3", diff --git a/examples/zero-shot-classification/package.json b/examples/zero-shot-classification/package.json index 2dd6c1f87..c5c206a65 100644 --- a/examples/zero-shot-classification/package.json +++ b/examples/zero-shot-classification/package.json @@ -25,6 +25,6 @@ "eslint-plugin-react-refresh": "^0.4.5", "postcss": "^8.4.33", "tailwindcss": "^3.4.1", - "vite": "^5.0.12" + "vite": "^5.0.13" } } diff --git a/package-lock.json b/package-lock.json index 5a7331e9d..2b6067a7c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2188,13 +2188,13 @@ "dev": true }, "node_modules/body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "dev": true, "dependencies": { "bytes": "3.1.2", - "content-type": "~1.0.4", + "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", @@ -2202,7 +2202,7 @@ "iconv-lite": "0.4.24", "on-finished": "2.4.1", "qs": "6.11.0", - "raw-body": "2.5.1", + "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" }, @@ -2357,13 +2357,19 @@ } }, "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "dev": true, "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2818,9 +2824,9 @@ "dev": true }, "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", "dev": true, "engines": { "node": ">= 0.6" @@ -2999,6 +3005,23 @@ "node": ">= 10" } }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/define-lazy-prop": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", @@ -3208,6 +3231,27 @@ "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/es-module-lexer": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.2.1.tgz", @@ -3376,17 +3420,17 @@ } }, "node_modules/express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "dev": true, "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.1", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -3665,10 +3709,13 @@ } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/gensync": { "version": "1.0.0-beta.2", @@ -3689,14 +3736,19 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", - "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", "dev": true, "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3794,6 +3846,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -3853,6 +3917,30 @@ "node": ">=8" } }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", @@ -3865,6 +3953,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/hpack.js": { "version": "2.1.6", "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", @@ -5681,9 +5781,9 @@ "dev": true }, "node_modules/object-inspect": { - "version": "1.12.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", - "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -6186,9 +6286,9 @@ } }, "node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dev": true, "dependencies": { "bytes": "3.1.2", @@ -6687,6 +6787,23 @@ "node": ">= 0.8.0" } }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", @@ -6778,14 +6895,18 @@ } }, "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dev": true, "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" From 15b90b75239c62d61c5d5586d38f96ff6dae66e4 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 10 Apr 2024 08:01:03 -0700 Subject: [PATCH 5/5] maths: switch dot to faster for loop (#667) * maths: switch dot to faster for loop * Update src/utils/maths.js --------- Co-authored-by: Joshua Lochner --- src/utils/maths.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils/maths.js b/src/utils/maths.js index 264b69fc7..e63865314 100644 --- a/src/utils/maths.js +++ b/src/utils/maths.js @@ -174,7 +174,11 @@ export function log_softmax(arr) { * @returns {number} The dot product of arr1 and arr2. */ export function dot(arr1, arr2) { - return arr1.reduce((acc, val, i) => acc + val * arr2[i], 0); + let result = 0; + for (let i = 0; i < arr1.length; ++i) { + result += arr1[i] * arr2[i]; + } + return result; }