From a22b7679cd43da7bda1f301fe2a561ecb1fd357f Mon Sep 17 00:00:00 2001 From: Sylvestre Bouchot Date: Mon, 26 Aug 2024 09:25:31 +0200 Subject: [PATCH 1/2] Allow to customize parallelDownload for ggufAllShards (#859) Could be related to https://huggingface.slack.com/archives/C02EMARJ65P/p1724166668261449 --- packages/gguf/src/gguf.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/gguf/src/gguf.ts b/packages/gguf/src/gguf.ts index 945d5a494..6f0230f79 100644 --- a/packages/gguf/src/gguf.ts +++ b/packages/gguf/src/gguf.ts @@ -9,6 +9,7 @@ export { GGUF_QUANT_DESCRIPTIONS } from "./quant-descriptions"; export const RE_GGUF_FILE = /\.gguf$/; export const RE_GGUF_SHARD_FILE = /^(?.*?)-(?\d{5})-of-(?\d{5})\.gguf$/; +const PARALLEL_DOWNLOADS = 20; export interface GgufShardFileInfo { prefix: string; @@ -401,8 +402,13 @@ export async function ggufAllShards( */ fetch?: typeof fetch; additionalFetchHeaders?: Record; + parallelDownloads?: number; } ): Promise<{ shards: GGUFParseOutput[]; parameterCount: number }> { + const parallelDownloads = params?.parallelDownloads ?? PARALLEL_DOWNLOADS; + if (parallelDownloads < 1) { + throw new TypeError("parallelDownloads must be greater than 0"); + } const ggufShardFileInfo = parseGgufShardFilename(url); if (ggufShardFileInfo) { const total = parseInt(ggufShardFileInfo.total); @@ -413,10 +419,9 @@ export async function ggufAllShards( urls.push(`${prefix}-${shardIdx.toString().padStart(5, "0")}-of-${total.toString().padStart(5, "0")}.gguf`); } - const PARALLEL_DOWNLOADS = 20; const shards = await promisesQueue( urls.map((shardUrl) => () => gguf(shardUrl, { ...params, computeParametersCount: true })), - PARALLEL_DOWNLOADS + parallelDownloads ); return { shards, From c367ae41a7bb4fc941dd318d21c4d404e7dde2f8 Mon Sep 17 00:00:00 2001 From: machineuser Date: Mon, 26 Aug 2024 07:28:42 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=96=20@hugginface/gguf=200.1.10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/gguf/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gguf/package.json b/packages/gguf/package.json index ae7bd6efd..8cb97656b 100644 --- a/packages/gguf/package.json +++ b/packages/gguf/package.json @@ -1,7 +1,7 @@ { "name": "@huggingface/gguf", "packageManager": "pnpm@8.10.5", - "version": "0.1.9", + "version": "0.1.10", "description": "a GGUF parser that works on remotely hosted files", "repository": "https://github.com/huggingface/huggingface.js.git", "publishConfig": {