diff --git a/node_modules/@huggingface/hub/dist/src/lib/repo-exists.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/lib/repo-exists.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..d53c3fa35ee1d41d26047a45e5f51f9017cc5657 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/repo-exists.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"repo-exists.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/repo-exists.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/snapshot-download.d.ts b/node_modules/@huggingface/hub/dist/src/lib/snapshot-download.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a1b9e44dbb157cad06b5e5a6055bc596b45c8cb7 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/snapshot-download.d.ts @@ -0,0 +1,23 @@ +import type { CredentialsParams, RepoDesignation } from "../types/public"; +export declare const DEFAULT_REVISION = "main"; +/** + * Downloads an entire repository at a given revision in the cache directory {@link getHFHubCachePath}. + * You can list all cached repositories using {@link scanCachedRepo} + * @remarks It uses internally {@link downloadFileToCacheDir}. + */ +export declare function snapshotDownload(params: { + repo: RepoDesignation; + cacheDir?: string; + /** + * An optional Git revision id which can be a branch name, a tag, or a commit hash. + * + * @default "main" + */ + revision?: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; +} & Partial): Promise; +//# sourceMappingURL=snapshot-download.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/snapshot-download.d.ts.map b/node_modules/@huggingface/hub/dist/src/lib/snapshot-download.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..bc2f828706ce822fba8e7ae1915a68188fcc9930 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/snapshot-download.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"snapshot-download.d.ts","sourceRoot":"","sources":["../../../src/lib/snapshot-download.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAW1E,eAAO,MAAM,gBAAgB,SAAS,CAAC;AAEvC;;;;GAIG;AACH,wBAAsB,gBAAgB,CACrC,MAAM,EAAE;IACP,IAAI,EAAE,eAAe,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB,GAAG,OAAO,CAAC,iBAAiB,CAAC,GAC5B,OAAO,CAAC,MAAM,CAAC,CAyFjB"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/snapshot-download.spec.d.ts b/node_modules/@huggingface/hub/dist/src/lib/snapshot-download.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b30ca61e456c5cce98cd14f7924e8e71f3b05030 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/snapshot-download.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=snapshot-download.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/snapshot-download.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/lib/snapshot-download.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..5cc460f188f3ca2d235aa04a3844e1fff083c294 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/snapshot-download.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"snapshot-download.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/snapshot-download.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/space-info.d.ts b/node_modules/@huggingface/hub/dist/src/lib/space-info.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bb5da6bcb12f5457bf62b1e3305af411e7e1e4ab --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/space-info.d.ts @@ -0,0 +1,18 @@ +import type { ApiSpaceInfo } from "../types/api/api-space"; +import type { CredentialsParams } from "../types/public"; +import type { SPACE_EXPANDABLE_KEYS, SpaceEntry } from "./list-spaces"; +import { SPACE_EXPAND_KEYS } from "./list-spaces"; +export declare function spaceInfo = never>(params: { + name: string; + hubUrl?: string; + additionalFields?: T[]; + /** + * An optional Git revision id which can be a branch name, a tag, or a commit hash. + */ + revision?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; +} & Partial): Promise>; +//# sourceMappingURL=space-info.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/space-info.d.ts.map b/node_modules/@huggingface/hub/dist/src/lib/space-info.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..f02a162dd57a96d3c6bccae584765e4fb02ba3ec --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/space-info.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"space-info.d.ts","sourceRoot":"","sources":["../../../src/lib/space-info.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,wBAAsB,SAAS,CAC9B,KAAK,CAAC,CAAC,SAAS,OAAO,CAAC,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,EAE3G,MAAM,EAAE;IACP,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,CAAC,EAAE,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB,GAAG,OAAO,CAAC,iBAAiB,CAAC,GAC5B,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAkC7C"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/space-info.spec.d.ts b/node_modules/@huggingface/hub/dist/src/lib/space-info.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..492a7dc07496c3ea833f538a54326f4c3a2cceee --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/space-info.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=space-info.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/space-info.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/lib/space-info.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..0f443b9fe75d49d12128305a8a6e824f8e4aef14 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/space-info.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"space-info.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/space-info.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/upload-file.d.ts b/node_modules/@huggingface/hub/dist/src/lib/upload-file.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..de98cd492b6b57773886e5b6f6b6328464e27886 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/upload-file.d.ts @@ -0,0 +1,20 @@ +import type { CredentialsParams } from "../types/public"; +import type { CommitOutput, CommitParams, ContentSource } from "./commit"; +export declare function uploadFile(params: { + repo: CommitParams["repo"]; + file: URL | File | { + path: string; + content: ContentSource; + }; + commitTitle?: CommitParams["title"]; + commitDescription?: CommitParams["description"]; + hubUrl?: CommitParams["hubUrl"]; + branch?: CommitParams["branch"]; + isPullRequest?: CommitParams["isPullRequest"]; + parentCommit?: CommitParams["parentCommit"]; + fetch?: CommitParams["fetch"]; + useWebWorkers?: CommitParams["useWebWorkers"]; + abortSignal?: CommitParams["abortSignal"]; + useXet?: CommitParams["useXet"]; +} & Partial): Promise; +//# sourceMappingURL=upload-file.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/upload-file.d.ts.map b/node_modules/@huggingface/hub/dist/src/lib/upload-file.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..31080ea7108c079bfa7dfbdd70e2568688701dc5 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/upload-file.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"upload-file.d.ts","sourceRoot":"","sources":["../../../src/lib/upload-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG1E,wBAAgB,UAAU,CACzB,MAAM,EAAE;IACP,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3B,IAAI,EAAE,GAAG,GAAG,IAAI,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,aAAa,CAAA;KAAE,CAAC;IAC5D,WAAW,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IACpC,iBAAiB,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IAChD,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;IAC9C,YAAY,CAAC,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAC5C,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAC9B,aAAa,CAAC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IAC1C,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;CAChC,GAAG,OAAO,CAAC,iBAAiB,CAAC,GAC5B,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CA6BnC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/upload-file.spec.d.ts b/node_modules/@huggingface/hub/dist/src/lib/upload-file.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..abd67bbcd82b8e7e1b3a4ac47cdd555278ebb0aa --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/upload-file.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=upload-file.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/upload-file.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/lib/upload-file.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..5d7a1fc716da9f90f3dcaa868bf3e96271fb504f --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/upload-file.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"upload-file.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/upload-file.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/upload-files-with-progress.d.ts b/node_modules/@huggingface/hub/dist/src/lib/upload-files-with-progress.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ed8671f076e40d92e6448d97cd272a3adc8cfaa1 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/upload-files-with-progress.d.ts @@ -0,0 +1,29 @@ +import type { CredentialsParams } from "../types/public"; +import type { CommitOutput, CommitParams, CommitProgressEvent, ContentSource } from "./commit"; +/** + * Uploads with progress + * + * Needs XMLHttpRequest to be available for progress events for uploads on models, datasets and spaces. + * Set useWebWorkers to true in order to have progress events for hashing for models, datasets and spaces. + */ +export declare function uploadFilesWithProgress(params: { + repo: CommitParams["repo"]; + files: Array; + commitTitle?: CommitParams["title"]; + commitDescription?: CommitParams["description"]; + hubUrl?: CommitParams["hubUrl"]; + branch?: CommitParams["branch"]; + isPullRequest?: CommitParams["isPullRequest"]; + parentCommit?: CommitParams["parentCommit"]; + abortSignal?: CommitParams["abortSignal"]; + maxFolderDepth?: CommitParams["maxFolderDepth"]; + useXet?: CommitParams["useXet"]; + /** + * Set this to true in order to have progress events for hashing + */ + useWebWorkers?: CommitParams["useWebWorkers"]; +} & Partial): AsyncGenerator; +//# sourceMappingURL=upload-files-with-progress.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/upload-files-with-progress.d.ts.map b/node_modules/@huggingface/hub/dist/src/lib/upload-files-with-progress.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..70b3df2c678cd0d2b6360a855e7011de3f71c3e0 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/upload-files-with-progress.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"upload-files-with-progress.d.ts","sourceRoot":"","sources":["../../../src/lib/upload-files-with-progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAW/F;;;;;GAKG;AACH,wBAAuB,uBAAuB,CAC7C,MAAM,EAAE;IACP,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC,GAAG,GAAG,IAAI,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,aAAa,CAAA;KAAE,CAAC,CAAC;IACpE,WAAW,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IACpC,iBAAiB,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IAChD,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;IAC9C,YAAY,CAAC,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAC5C,WAAW,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAChD,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC;;OAEG;IACH,aAAa,CAAC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;CAC9C,GAAG,OAAO,CAAC,iBAAiB,CAAC,GAC5B,cAAc,CAAC,mBAAmB,EAAE,YAAY,GAAG,SAAS,CAAC,CAyH/D"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/upload-files-with-progress.spec.d.ts b/node_modules/@huggingface/hub/dist/src/lib/upload-files-with-progress.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..be30c98f9d1b7bb6b35bb18c5f8b1c64257a8ff9 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/upload-files-with-progress.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=upload-files-with-progress.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/upload-files-with-progress.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/lib/upload-files-with-progress.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..554c4450c0ff875214647536415eab792418d3e3 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/upload-files-with-progress.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"upload-files-with-progress.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/upload-files-with-progress.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/upload-files.d.ts b/node_modules/@huggingface/hub/dist/src/lib/upload-files.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..024b081f10d936eaeb68ba49bfa2de3bcf36f669 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/upload-files.d.ts @@ -0,0 +1,21 @@ +import type { CredentialsParams } from "../types/public"; +import type { CommitOutput, CommitParams, ContentSource } from "./commit"; +export declare function uploadFiles(params: { + repo: CommitParams["repo"]; + files: Array; + commitTitle?: CommitParams["title"]; + commitDescription?: CommitParams["description"]; + hubUrl?: CommitParams["hubUrl"]; + branch?: CommitParams["branch"]; + isPullRequest?: CommitParams["isPullRequest"]; + parentCommit?: CommitParams["parentCommit"]; + fetch?: CommitParams["fetch"]; + useWebWorkers?: CommitParams["useWebWorkers"]; + maxFolderDepth?: CommitParams["maxFolderDepth"]; + abortSignal?: CommitParams["abortSignal"]; + useXet?: CommitParams["useXet"]; +} & Partial): Promise; +//# sourceMappingURL=upload-files.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/upload-files.d.ts.map b/node_modules/@huggingface/hub/dist/src/lib/upload-files.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..869dd0e3a51c7740392cc302144317d73bf3a491 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/upload-files.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"upload-files.d.ts","sourceRoot":"","sources":["../../../src/lib/upload-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG1E,wBAAgB,WAAW,CAC1B,MAAM,EAAE;IACP,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC,GAAG,GAAG,IAAI,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,aAAa,CAAA;KAAE,CAAC,CAAC;IACpE,WAAW,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IACpC,iBAAiB,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IAChD,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;IAC9C,YAAY,CAAC,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAC5C,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAC9B,aAAa,CAAC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;IAC9C,cAAc,CAAC,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAChD,WAAW,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IAC1C,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;CAChC,GAAG,OAAO,CAAC,iBAAiB,CAAC,GAC5B,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAoBnC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/upload-files.fs.spec.d.ts b/node_modules/@huggingface/hub/dist/src/lib/upload-files.fs.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d5185a7b3f266c6ff006a34d244759a5f9ea4ca4 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/upload-files.fs.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=upload-files.fs.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/upload-files.fs.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/lib/upload-files.fs.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..45e27e07142683746cfed07213e97b9757f2659a --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/upload-files.fs.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"upload-files.fs.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/upload-files.fs.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/upload-files.spec.d.ts b/node_modules/@huggingface/hub/dist/src/lib/upload-files.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c74223ec254a9815f5eacd3151a0a622c4450c79 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/upload-files.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=upload-files.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/upload-files.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/lib/upload-files.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..3ea1dc8b4eddb0dd3fbc868f989bf1c83e19c82b --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/upload-files.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"upload-files.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/upload-files.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/who-am-i.d.ts b/node_modules/@huggingface/hub/dist/src/lib/who-am-i.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1baef0f46f541ffcecf5afc98529c86dd3975807 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/who-am-i.d.ts @@ -0,0 +1,62 @@ +import type { AccessTokenRole, AuthType, CredentialsParams } from "../types/public"; +export interface WhoAmIUser { + /** Unique ID persistent across renames */ + id: string; + type: "user"; + email: string; + emailVerified: boolean; + isPro: boolean; + orgs: WhoAmIOrg[]; + name: string; + fullname: string; + canPay: boolean; + avatarUrl: string; + /** + * Unix timestamp in seconds + */ + periodEnd: number | null; + billingMode: "postpaid" | "prepaid"; +} +export interface WhoAmIOrg { + /** Unique ID persistent across renames */ + id: string; + type: "org"; + name: string; + fullname: string; + email: string | null; + canPay: boolean; + avatarUrl: string; + /** + * Unix timestamp in seconds + */ + periodEnd: number | null; +} +export interface WhoAmIApp { + id: string; + type: "app"; + name: string; + scope?: { + entities: string[]; + role: "admin" | "write" | "contributor" | "read"; + }; +} +export type WhoAmI = WhoAmIApp | WhoAmIOrg | WhoAmIUser; +export interface AuthInfo { + type: AuthType; + accessToken?: { + displayName: string; + role: AccessTokenRole; + createdAt: Date; + }; + expiresAt?: Date; +} +export declare function whoAmI(params: { + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; +} & CredentialsParams): Promise; +//# sourceMappingURL=who-am-i.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/who-am-i.d.ts.map b/node_modules/@huggingface/hub/dist/src/lib/who-am-i.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..e0e3427e31bf0dd8ef3211d94bc3841a5311342f --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/who-am-i.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"who-am-i.d.ts","sourceRoot":"","sources":["../../../src/lib/who-am-i.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpF,MAAM,WAAW,UAAU;IAC1B,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,aA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AAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB,GAAG,iBAAiB,GACnB,OAAO,CAAC,MAAM,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAsBtC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/who-am-i.spec.d.ts b/node_modules/@huggingface/hub/dist/src/lib/who-am-i.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fb98d015629183178ada0b1c088ab41e89b388d6 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/who-am-i.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=who-am-i.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/lib/who-am-i.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/lib/who-am-i.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..82fce42e56637a318aea43a2b7ea4b12c4784c48 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/lib/who-am-i.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"who-am-i.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/who-am-i.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/test/consts.d.ts b/node_modules/@huggingface/hub/dist/src/test/consts.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b3ebcdd1ecc1eb288c1688ff9cb04d69ee0cd67a --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/test/consts.d.ts @@ -0,0 +1,5 @@ +export declare const TEST_HUB_URL = "https://hub-ci.huggingface.co"; +export declare const TEST_USER = "hub.js"; +export declare const TEST_ACCESS_TOKEN = "hf_hub.js"; +export declare const TEST_COOKIE = "huggingface-hub.js-cookie"; +//# sourceMappingURL=consts.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/test/consts.d.ts.map b/node_modules/@huggingface/hub/dist/src/test/consts.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..700fd7d3b5fb00ae7fa159a578278ea99c54f822 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/test/consts.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/test/consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,kCAAkC,CAAC;AAC5D,eAAO,MAAM,SAAS,WAAW,CAAC;AAClC,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAC7C,eAAO,MAAM,WAAW,8BAA8B,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-author.d.ts b/node_modules/@huggingface/hub/dist/src/types/api/api-author.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..605d7d100e840b87a090b3b145065e26c97fbb78 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-author.d.ts @@ -0,0 +1,25 @@ +export type ApiAuthor = { + avatarUrl: string; + fullname: string; + name: string; + isHf: boolean; + isHfAdmin: boolean; + isMod: boolean; + followerCount?: number; + type: "org"; + plan?: string; + isUserFollowing?: boolean; +} | { + avatarUrl: string; + fullname: string; + name: string; + isHf: boolean; + isHfAdmin: boolean; + isMod: boolean; + followerCount?: number; + type: "user"; + isPro: boolean; + _id: string; + isUserFollowing?: boolean; +}; +//# sourceMappingURL=api-author.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-author.d.ts.map b/node_modules/@huggingface/hub/dist/src/types/api/api-author.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..dd66328a7228d6799a213c37ac7c693034611aec --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-author.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"api-author.d.ts","sourceRoot":"","sources":["../../../../src/types/api/api-author.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAClB;IACA,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,OAAO,CAAC;CACzB,GACD;IACA,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-collection.d.ts b/node_modules/@huggingface/hub/dist/src/types/api/api-collection.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0ddd384c65e8e6e082afb2cb11f74a7bcac76471 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-collection.d.ts @@ -0,0 +1,169 @@ +import type { ApiAuthor } from "./api-author"; +export interface ApiCollectionInfo { + slug: string; + title: string; + description?: string; + lastUpdated: string; + gating: true | (false | { + mode: "auto"; + } | { + mode: "manual"; + notifications: { + mode: "bulk" | "real-time"; + email?: string; + }; + }); + owner: ApiAuthor; + /** + * Note that it's limited to 4 items when the listing endpoint is used. + */ + items: ApiCollectionItem[]; + theme: "orange" | "blue" | "green" | "purple" | "pink" | "indigo"; + private: boolean; + upvotes: number; + isUpvotedByUser: boolean; +} +interface ApiCollectionItemBase { + _id: string; + position: number; + note?: { + html: string; + text: string; + }; + gallery?: string[]; +} +interface ApiCollectionItemModel extends ApiCollectionItemBase { + type: "model"; + author: string; + downloads: number; + id: string; + availableInferenceProviders: { + provider: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together"; + providerStatus: "live" | "staging" | "error"; + modelStatus: "live" | "staging" | "error"; + providerId: string; + task: "text-classification" | "token-classification" | "table-question-answering" | "question-answering" | "zero-shot-classification" | "translation" | "summarization" | "feature-extraction" | "text-generation" | "text2text-generation" | "fill-mask" | "sentence-similarity" | "text-to-speech" | "text-to-audio" | "automatic-speech-recognition" | "audio-to-audio" | "audio-classification" | "audio-text-to-text" | "voice-activity-detection" | "depth-estimation" | "image-classification" | "object-detection" | "image-segmentation" | "text-to-image" | "image-to-text" | "image-to-image" | "image-to-video" | "unconditional-image-generation" | "video-classification" | "reinforcement-learning" | "robotics" | "tabular-classification" | "tabular-regression" | "tabular-to-text" | "table-to-text" | "multiple-choice" | "text-ranking" | "text-retrieval" | "time-series-forecasting" | "text-to-video" | "image-text-to-text" | "visual-question-answering" | "document-question-answering" | "zero-shot-image-classification" | "graph-ml" | "mask-generation" | "zero-shot-object-detection" | "text-to-3d" | "image-to-3d" | "image-feature-extraction" | "video-text-to-text" | "keypoint-detection" | "visual-document-retrieval" | "any-to-any" | "video-to-video" | "other" | "conversational"; + adapterType?: "lora"; + adapterWeightsPath?: string; + }[]; + isLikedByUser: boolean; + lastModified: string; + likes: number; + pipeline_tag?: string; + private: boolean; + repoType: "model"; + gated: false | ("auto" | "manual"); + resourceGroup?: { + id: string; + name: string; + numUsers: number; + }; + numParameters?: number; + authorData?: ApiAuthor; + widgetOutputUrls?: string[]; +} +interface ApiCollectionItemDataset extends ApiCollectionItemBase { + type: "dataset"; + author: string; + id: string; + isLikedByUser: boolean; + likes: number; + datasetsServerInfo?: { + viewer: "preview" | "viewer-partial" | "viewer"; + numRows: number | null; + libraries: ("mlcroissant" | "webdataset" | "datasets" | "pandas" | "dask" | "distilabel" | "fiftyone" | "argilla" | "polars" | "duckdb")[]; + formats: ("json" | "csv" | "parquet" | "imagefolder" | "audiofolder" | "webdataset" | "text" | "arrow")[]; + modalities: ("3d" | "audio" | "document" | "geospatial" | "image" | "tabular" | "text" | "timeseries" | "video")[]; + }; + private: boolean; + repoType: "dataset"; + downloads: number; + gated: false | ("auto" | "manual"); + lastModified: string; + resourceGroup?: { + id: string; + name: string; + numUsers: number; + }; +} +interface ApiCollectionItemSpace extends ApiCollectionItemBase { + type: "space"; + author: string; + colorFrom: string; + colorTo: string; + createdAt: string; + emoji: string; + id: string; + isLikedByUser: boolean; + lastModified: string; + likes: number; + pinned: boolean; + private: boolean; + featured: boolean; + repoType: "space"; + title: string; + sdk?: "gradio" | "docker" | "static" | "streamlit"; + runtime: { + stage: "NO_APP_FILE" | "CONFIG_ERROR" | "BUILDING" | "BUILD_ERROR" | "APP_STARTING" | "RUNNING" | "RUNNING_BUILDING" | "RUNNING_APP_STARTING" | "RUNTIME_ERROR" | "DELETING" | "STOPPED" | "PAUSED" | "SLEEPING"; + hardware: { + current: ("cpu-basic" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "zero-a10g" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "h100" | "h100x8") | null; + requested: ("cpu-basic" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "zero-a10g" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "h100" | "h100x8") | null; + }; + storage: ("small" | "medium" | "large") | null; + errorMessage?: string; + gcTimeout?: number | null; + replicas: { + current?: number | null; + requested: number | "auto"; + }; + devMode?: boolean; + domains?: { + domain: string; + isCustom?: boolean | null; + stage: "READY" | "PENDING"; + }[]; + sha?: string; + }; + originSpace?: { + author: ApiAuthor; + name: string; + }; + ai_short_description?: string; + ai_category?: string; + trendingScore?: number; + resourceGroup?: { + id: string; + name: string; + numUsers: number; + }; + tags: string[]; + authorData?: ApiAuthor; + shortDescription?: string; + semanticRelevancyScore?: number; +} +interface ApiCollectionItemPaper extends ApiCollectionItemBase { + type: "paper"; + id: string; + title: string; + upvotes: number; + publishedAt: string; + thumbnailUrl?: string; + isUpvotedByUser?: boolean; +} +interface ApiCollectionItemCollection extends ApiCollectionItemBase { + type: "collection"; + slug: string; + lastUpdated: string; + description?: string; + owner: ApiAuthor; + title: string; + theme: "orange" | "blue" | "green" | "purple" | "pink" | "indigo"; + upvotes: number; + isUpvotedByUser: boolean; + id: string; + numberItems: number; + shareUrl: string; +} +type ApiCollectionItem = ApiCollectionItemModel | ApiCollectionItemDataset | ApiCollectionItemSpace | ApiCollectionItemPaper | ApiCollectionItemCollection; +export {}; +//# sourceMappingURL=api-collection.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-collection.d.ts.map b/node_modules/@huggingface/hub/dist/src/types/api/api-collection.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..bff07dc4d0ab566dde6b69dd3aa5a7af4c843d07 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-collection.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"api-collection.d.ts","sourceRoot":"","sources":["../../../../src/types/api/api-collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EACH,IAAI,GACJ,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AAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,UAAU,2BAA4B,SAAQ,qBAAqB;IAClE,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;IAClE,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,OAAO,CAAC;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,KAAK,iBAAiB,GACnB,sBAAsB,GACtB,wBAAwB,GACxB,sBAAsB,GACtB,sBAAsB,GACtB,2BAA2B,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-commit.d.ts b/node_modules/@huggingface/hub/dist/src/types/api/api-commit.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e6f5ac29cd61ddf27324d8ad7dca6ccbef741887 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-commit.d.ts @@ -0,0 +1,198 @@ +export interface ApiLfsBatchRequest { + operation: "download" | "upload"; + transfers?: Array; + /** + * Optional object describing the server ref that the objects belong to. Note: Added in v2.4. + * + * We use this object for QOL and to fail early for users when they're trying to push to the wrong reference. + * But it does nothing for security. + */ + ref?: { + name: string; + } | null; + objects: { + oid: string; + /** + * Integer byte size of the LFS object. Must be at least zero. + */ + size: number; + }[]; + /** + * The hash algorithm used to name Git LFS objects. Optional; defaults to sha256 if not specified. + * */ + hash_algo?: string; +} +export interface ApiLfsBatchResponse { + transfer?: ApiLfsResponseTransfer; + objects: ApiLfsResponseObject[]; +} +export type ApiLfsResponseTransfer = "basic" | "multipart" | "xet"; +export interface ApiLfsCompleteMultipartRequest { + oid: string; + parts: { + etag: string; + partNumber: number; + }[]; +} +export interface ApiLfsResponseObject { + /** + * Optional boolean specifying whether the request + * for this specific object is authenticated. + * If omitted or false, Git LFS will attempt to find credentials for this URL. + */ + authenticated?: boolean; + oid: string; + /** + * Integer byte size of the LFS object. Must be at least zero. + */ + size: number; + /** + * Applicable actions depend on which `operation` is specified in the request. + * How these properties are interpreted depends on which transfer adapter + * the client will be using. + */ + actions?: { + /** + * Download operations MUST specify a download action, + * or an object error if the object cannot be downloaded for some reason + */ + download?: ApiLfsAction; + /** + * Upload operations can specify an upload and a verify action. + * The upload action describes how to upload the object. + */ + upload?: ApiLfsAction; + /** + * The LFS client will hit this URL after a successful upload. + * Servers can use this for extra verification, if needed. + */ + verify?: ApiLfsAction; + }; + /** + * If there are problems accessing individual objects, servers should continue + * to return a 200 status code, and provide per-object errors + */ + error?: { + code: number; + message: string; + }; +} +export interface ApiLfsAction { + href: string; + /** + * Optional hash of String HTTP header key/value pairs to apply to the request + */ + header?: { + [key: string]: string; + } & { + chunk_size?: string; + }; + /** + * Whole number of seconds after local client time when transfer will expire. + * Preferred over `expires_at` if both are provided. + * Maximum of 2147483647, minimum of -2147483647. + */ + expires_in?: number; + /** + * String uppercase RFC 3339-formatted timestamp with second precision + * for when the given action expires (usually due to a temporary token). + */ + expires_at?: string; +} +export interface ApiPreuploadRequest { + /** + * Optional, otherwise takes the existing content of `.gitattributes` for the revision. + * + * Provide this parameter if you plan to modify `.gitattributes` yourself at the same + * time as uploading LFS files. + * + * Note that this is not needed if you solely rely on automatic LFS detection from HF: the commit endpoint + * will automatically edit the `.gitattributes` file to track the files passed to its `lfsFiles` param. + */ + gitAttributes?: string; + files: Array<{ + /** + * Path of the LFS file + */ + path: string; + /** + * Full size of the LFS file + */ + size: number; + /** + * Base64-encoded sample of the first 512 bytes of the file + */ + sample: string; + }>; +} +export interface ApiBucketBatchResponse { + /** True if all files were successfully added */ + success: boolean; + /** Total number of operations attempted */ + processed: number; + /** Number of successful operations */ + succeeded: number; + /** List of failed operations */ + failed: Array<{ + path: string; + error: string; + }>; +} +export interface ApiPreuploadResponse { + files: Array<{ + path: string; + uploadMode: "lfs" | "regular"; + }>; +} +export interface ApiCommitHeader { + summary: string; + description?: string; + /** + * Parent commit. Optional + * + * - When opening a PR: will use parentCommit as the parent commit + * - When committing on a branch: Will make sure that there were no intermediate commits + */ + parentCommit?: string; +} +export interface ApiCommitDeletedEntry { + path: string; +} +export interface ApiCommitLfsFile { + path: string; + oldPath?: string; + /** Required if {@link oldPath} is not set */ + algo?: "sha256"; + /** Required if {@link oldPath} is not set */ + oid?: string; + size?: number; +} +export interface ApiCommitFile { + /** Required if {@link oldPath} is not set */ + content?: string; + path: string; + oldPath?: string; + encoding?: "utf-8" | "base64"; +} +export type ApiCommitOperation = { + key: "file"; + value: ApiCommitFile; +} | { + key: "lfsFile"; + value: ApiCommitLfsFile; +} | { + key: "deletedFile"; + value: ApiCommitDeletedEntry; +}; +export interface ApiCommitData { + id: string; + title: string; + message: string; + authors: Array<{ + user: string; + avatar: string; + }>; + date: string; + formatted?: string; +} +//# sourceMappingURL=api-commit.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-commit.d.ts.map b/node_modules/@huggingface/hub/dist/src/types/api/api-commit.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..739574dc874764752afcc729e0196b6ac026e9d2 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-commit.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"api-commit.d.ts","sourceRoot":"","sources":["../../../../src/types/api/api-commit.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IAElC,SAAS,EAAE,UAAU,GAAG,QAAQ,CAAC;IACjC,SAAS,CAAC,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1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AAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC7B,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC9B;AAED,MAAM,MAAM,kBAAkB,GAC3B;IACA,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,aAAa,CAAC;CACpB,GACD;IACA,GAAG,EAAE,SAAS,CAAC;IACf,KAAK,EAAE,gBAAgB,CAAC;CACvB,GACD;IACA,GAAG,EAAE,aAAa,CAAC;IACnB,KAAK,EAAE,qBAAqB,CAAC;CAC5B,CAAC;AAEL,MAAM,WAAW,aAAa;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-create-collection.d.ts b/node_modules/@huggingface/hub/dist/src/types/api/api-create-collection.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4dc723003a5d39c2ac52bfd4ca099d880a67567c --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-create-collection.d.ts @@ -0,0 +1,20 @@ +export interface ApiCreateCollectionPayload { + /** + * Title of the collection to create. + */ + title: string; + /** + * Namespace of the collection to create (username or org). + */ + namespace: string; + /** + * Description of the collection to create. + */ + description?: string; + /** + * Whether the collection should be private or not. Defaults to False (i.e. public collection). + * @default false + */ + private?: boolean; +} +//# sourceMappingURL=api-create-collection.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-create-collection.d.ts.map b/node_modules/@huggingface/hub/dist/src/types/api/api-create-collection.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7bb2b04e3420ab3d356202c5a9ce3fbe2c2cafba --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-create-collection.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"api-create-collection.d.ts","sourceRoot":"","sources":["../../../../src/types/api/api-create-collection.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IAC1C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-create-repo.d.ts b/node_modules/@huggingface/hub/dist/src/types/api/api-create-repo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6fd575dea2b7489a815748fd014aac6cddce2365 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-create-repo.d.ts @@ -0,0 +1,23 @@ +import type { SetRequired } from "../../vendor/type-fest/set-required"; +import type { RepoType, SpaceHardwareFlavor, SpaceSdk } from "../public"; +import type { ApiCommitFile } from "./api-commit"; +export type ApiCreateRepoPayload = { + name: string; + canonical?: boolean; + license?: string; + resourceGroupId?: string; + template?: string; + organization?: string; + /** @default false */ + private?: boolean; + lfsmultipartthresh?: number; + files?: SetRequired[]; +} & ({ + type: Exclude; +} | { + type: "space"; + hardware?: SpaceHardwareFlavor; + sdk: SpaceSdk; + sdkVersion?: string; +}); +//# sourceMappingURL=api-create-repo.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-create-repo.d.ts.map b/node_modules/@huggingface/hub/dist/src/types/api/api-create-repo.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..3476caac7c109ed24a0cfdefc7312d812509b8c3 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-create-repo.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"api-create-repo.d.ts","sourceRoot":"","sources":["../../../../src/types/api/api-create-repo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC,aAAa,EAAE,SAAS,CAAC,EAAE,CAAC;CAChD,GAAG,CACD;IACA,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;CAChC,GACD;IACA,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,GAAG,EAAE,QAAQ,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACnB,CACH,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-dataset.d.ts b/node_modules/@huggingface/hub/dist/src/types/api/api-dataset.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..65257d1d3b97dab7e9b65eba2786b875e295e204 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-dataset.d.ts @@ -0,0 +1,95 @@ +import type { License } from "../public"; +export interface ApiDatasetInfo { + _id: string; + id: string; + arxivIds?: string[]; + author?: string; + cardExists?: true; + cardError?: unknown; + cardData?: ApiDatasetMetadata; + contributors?: Array<{ + user: string; + _id: string; + }>; + disabled: boolean; + discussionsDisabled: boolean; + gated: false | "auto" | "manual"; + gitalyUid: string; + lastAuthor: { + email: string; + user?: string; + }; + lastModified: string; + likes: number; + likesRecent: number; + private: boolean; + updatedAt: string; + createdAt: string; + tags: string[]; + paperswithcode_id?: string; + sha: string; + files?: string[]; + citation?: string; + description?: string; + downloads: number; + downloadsAllTime: number; + previewable?: boolean; + doi?: { + id: string; + commit: string; + }; +} +export interface ApiDatasetMetadata { + licenses?: undefined; + license?: License | License[]; + license_name?: string; + license_link?: "LICENSE" | "LICENSE.md" | string; + license_details?: string; + languages?: undefined; + language?: string | string[]; + language_bcp47?: string[]; + language_details?: string; + tags?: string[]; + task_categories?: string[]; + task_ids?: string[]; + config_names?: string[]; + configs?: { + config_name: string; + data_files?: string | string[] | { + split: string; + path: string | string[]; + }[]; + data_dir?: string; + }[]; + benchmark?: string; + paperswithcode_id?: string | null; + pretty_name?: string; + viewer?: boolean; + viewer_display_urls?: boolean; + thumbnail?: string | null; + description?: string | null; + annotations_creators?: string[]; + language_creators?: string[]; + multilinguality?: string[]; + size_categories?: string[]; + source_datasets?: string[]; + extra_gated_prompt?: string; + extra_gated_fields?: { + /** + * "text" | "checkbox" | "date_picker" | "country" | "ip_location" | { type: "text" | "checkbox" | "date_picker" | "country" | "ip_location" } | { type: "select", options: Array } Property + */ + [x: string]: "text" | "checkbox" | "date_picker" | "country" | "ip_location" | { + type: "text" | "checkbox" | "date_picker" | "country" | "ip_location"; + } | { + type: "select"; + options: Array; + }; + }; + extra_gated_heading?: string; + extra_gated_description?: string; + extra_gated_button_content?: string; +} +//# sourceMappingURL=api-dataset.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-dataset.d.ts.map b/node_modules/@huggingface/hub/dist/src/types/api/api-dataset.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..a6edd3577ab63ce94adea5ef3ad0e97b0788dda4 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-dataset.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"api-dataset.d.ts","sourceRoot":"","sources":["../../../../src/types/api/api-dataset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,WAAW,cAAc;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,QAAQ,EAAE,OAAO,CAAC;IAClB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,G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AAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE;QACpB;;WAEG;QACH,CAAC,CAAC,EAAE,MAAM,GACP,MAAM,GACN,UAAU,GACV,aAAa,GACb,SAAS,GACT,aAAa,GACb;YAAE,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,aAAa,CAAA;SAAE,GACzE;YAAE,IAAI,EAAE,QAAQ,CAAC;YAAC,OAAO,EAAE,KAAK,CAAC,MAAM,GAAG;gBAAE,KAAK,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE,CAAC,CAAA;SAAE,CAAC;KACjF,CAAC;IACF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACpC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-index-tree.d.ts b/node_modules/@huggingface/hub/dist/src/types/api/api-index-tree.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f6a43634d9ee7dbad89b49f2129060db221af12b --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-index-tree.d.ts @@ -0,0 +1,43 @@ +export interface ApiIndexTreeEntry { + type: "file" | "directory" | "unknown"; + size: number; + path: string; + oid: string; + lfs?: { + oid: string; + size: number; + /** Size of the raw pointer file, 100~200 bytes */ + pointerSize: number; + }; + lastCommit?: { + date: string; + id: string; + title: string; + }; + security?: ApiFileScanResult; +} +export interface ApiFileScanResult { + /** namespaced by repo type (models/, datasets/, spaces/) */ + repositoryId: string; + blobId: string; + name: string; + safe: boolean; + avScan?: ApiAVScan; + pickleImportScan?: ApiPickleImportScan; +} +interface ApiAVScan { + virusFound: boolean; + virusNames?: string[]; +} +type ApiSafetyLevel = "innocuous" | "suspicious" | "dangerous"; +interface ApiPickleImport { + module: string; + name: string; + safety: ApiSafetyLevel; +} +interface ApiPickleImportScan { + highestSafetyLevel: ApiSafetyLevel; + imports: ApiPickleImport[]; +} +export {}; +//# sourceMappingURL=api-index-tree.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-index-tree.d.ts.map b/node_modules/@huggingface/hub/dist/src/types/api/api-index-tree.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..1d1f24ac4bc7e7a8eedf07d5821fb9ccbe7630f3 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-index-tree.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"api-index-tree.d.ts","sourceRoot":"","sources":["../../../../src/types/api/api-index-tree.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE;QACL,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,kDAAkD;QAClD,WAAW,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,UAAU,CAAC,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACd,CAAC;IACF,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB;IACjC,4DAA4D;IAC5D,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,gBAAgB,CAAC,EAAE,mBAAmB,CAAC;CACvC;AAED,UAAU,SAAS;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,KAAK,cAAc,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,CAAC;AAE/D,UAAU,eAAe;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,cAAc,CAAC;CACvB;AAED,UAAU,mBAAmB;IAC5B,kBAAkB,EAAE,cAAc,CAAC;IACnC,OAAO,EAAE,eAAe,EAAE,CAAC;CAC3B"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-jobs.d.ts b/node_modules/@huggingface/hub/dist/src/types/api/api-jobs.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..083d37a03f3f0f7ee4002254cb3b55a3bdc1697d --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-jobs.d.ts @@ -0,0 +1,139 @@ +import type { SpaceHardwareFlavor } from "../public"; +export interface ApiJobHardware { + name: string; + prettyName: string; + cpu: string; + ram: string; + accelerator: { + type: "gpu" | "neuron"; + model: string; + quantity: string; + vram: string; + manufacturer: "Nvidia" | "AWS"; + } | null; + unitCostMicroUSD: number; + unitCostUSD: number; + unitLabel: string; +} +export type JobStatusStage = "DELETING" | "RUNNING" | "PAUSED" | "STOPPED" | "UPDATING" | "ERROR"; +export interface ApiJobStatus { + stage: JobStatusStage; + message?: string | null; + failureCount: number; +} +export interface ApiJobUser { + id: string; + name: string; + type?: "user" | "org"; + avatarUrl?: string; +} +export interface ApiJob { + type: "job"; + id: string; + status: ApiJobStatus; + createdAt: string; + updatedAt?: string; + startedAt?: string | null; + finishedAt?: string | null; + createdBy?: { + id: string; + name: string; + }; + dockerImage?: string | null; + spaceId?: string | null; + command?: string[] | null; + arguments?: string[] | null; + environment?: Record | null; + flavor: SpaceHardwareFlavor; + arch?: "amd64" | "arm64" | null; + timeoutSeconds?: number | null; + attempts?: number; + owner?: ApiJobUser; + initiator?: ApiJobUser; + secrets?: string[]; + labels?: Record | null; +} +export interface ApiScheduledJob { + id: string; + schedule: string; + suspend: boolean; + concurrency: boolean; + createdAt: string; + updatedAt: string; + jobSpec: { + dockerImage?: string | null; + spaceId?: string | null; + command?: string[] | null; + environment?: Record | null; + flavor: SpaceHardwareFlavor; + arch?: "amd64" | "arm64" | null; + timeoutSeconds?: number | null; + attempts?: number; + labels?: Record | null; + }; +} +export interface CreateJobOptions { + /** + * The Docker image to run (e.g., "python:3.12" or "pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel") + */ + dockerImage?: string; + /** + * The Space ID to run (e.g., "username/space-name") + */ + spaceId?: string; + /** + * The command to run (array of strings) + */ + command?: string[]; + /** + * Additional arguments to pass to the command + */ + arguments?: string[]; + /** + * Environment variables to set + */ + environment?: Record; + /** + * Secrets to pass (will be encrypted server-side) + */ + secrets?: Record; + /** + * Hardware flavor to use + */ + flavor: SpaceHardwareFlavor; + /** + * Architecture (defaults to "amd64") + */ + arch?: "amd64" | "arm64"; + /** + * Timeout in seconds + */ + timeoutSeconds?: number | null; + /** + * Maximum number of attempts (defaults to 1) + */ + attempts?: number; + /** + * Labels to attach to the job (key-value pairs) + */ + labels?: Record; +} +export interface CreateScheduledJobOptions { + /** + * The job specification + */ + jobSpec: Omit; + /** + * CRON schedule expression (e.g., "0 9 * * 1" for 9 AM every Monday) or shortcuts like "@hourly", "@daily" + */ + schedule: string; + /** + * Whether the scheduled job is suspended (paused) + */ + suspend?: boolean; + /** + * Whether multiple instances of this job can run concurrently + */ + concurrency?: boolean; +} +//# sourceMappingURL=api-jobs.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-jobs.d.ts.map b/node_modules/@huggingface/hub/dist/src/types/api/api-jobs.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..3c61c47a161a161b91070d674e85f0676c1881c6 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-jobs.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"api-jobs.d.ts","sourceRoot":"","sources":["../../../../src/types/api/api-jobs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAErD,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE;QACZ,IAAI,EAAE,KAAK,GAAG,QAAQ,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,EAAE,QAAQ,GAAG,KAAK,CAAC;KAC/B,GAAG,IAAI,CAAC;IACT,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;AAElG,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,EAA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H,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,yBAAyB;IACzC;;OAEG;IACH,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;IAC7C;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-model.d.ts b/node_modules/@huggingface/hub/dist/src/types/api/api-model.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5cb9babc2545e6f28bddecbe56c00248b7dd4e75 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-model.d.ts @@ -0,0 +1,276 @@ +import type { ModelLibraryKey, TransformersInfo, WidgetType } from "@huggingface/tasks"; +import type { License, PipelineType } from "../public"; +export interface ApiModelInfo { + _id: string; + id: string; + arxivIds: string[]; + author?: string; + cardData?: ApiModelMetadata; + cardError: unknown; + cardExists?: true; + config: unknown; + contributors: Array<{ + user: string; + _id: string; + }>; + disabled: boolean; + discussionsDisabled: boolean; + doi?: { + id: string; + commit: string; + }; + downloads: number; + downloadsAllTime: number; + files: string[]; + gitalyUid: string; + inferenceProviderMapping?: ApiModelInferenceProviderMappingEntry[]; + lastAuthor: { + email: string; + user?: string; + }; + lastModified: string; + library_name?: ModelLibraryKey; + likes: number; + likesRecent: number; + private: boolean; + gated: false | "auto" | "manual"; + sha: string; + spaces: string[]; + updatedAt: string; + createdAt: string; + pipeline_tag: PipelineType; + tags: string[]; + "model-index": unknown; + safetensors?: { + parameters: Record; + total: number; + }; + transformersInfo?: TransformersInfo; +} +export interface ApiModelIndex { + name: string; + results: { + task: { + /** + * Example: automatic-speech-recognition +Use task id from https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/tasksData.ts + */ + type: string; + /** + * Example: Speech Recognition + */ + name?: string; + }; + /** + * This will switch to required at some point. +in any case, we need them to link to PWC + */ + dataset?: { + /** + * Example: common_voice. Use dataset id from https://hf.co/datasets + */ + type: string; + /** + * A pretty name for the dataset. Example: Common Voice zh-CN +Also encode config params into the name if relevant. + */ + name: string; + /** + * Optional. The name of the dataset configuration used in `load_dataset()` + */ + config?: string; + /** + * Optional. Example: test + */ + split?: string; + /** + * Optional. Example: 5503434ddd753f426f4b38109466949a1217c2bb + */ + revision?: string; + args?: string | { + /** + * String Property + */ + [x: string]: string; + }; + }; + metrics: { + /** + * Example: wer. Use metric id from https://hf.co/metrics + */ + type: string; + /** + * Required. Example: 20.0 or "20.0 ± 1.2" + */ + value: unknown; + /** + * Example: Test WER + */ + name?: string; + /** + * Optional. The name of the metric configuration used in `load_metric()`. + */ + config?: string; + args?: string | { + /** + * String Property + */ + [x: string]: string; + }; + /** + * [Automatically computed, do not set] Dynamically overridden by huggingface in API calls to indicate if it was verified by Hugging Face. + */ + verified?: boolean; + /** + * Generated by Hugging Face to prove the results are valid. + */ + verifyToken?: string; + }[]; + /** + * The source for this evaluation result. + */ + source?: { + /** + * Example: Open LLM Leaderboard + */ + name?: string; + /** + * Example: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard + */ + url: string; + }; + }[]; +} +export interface ApiWidgetExampleFromModelcard { + example_title?: string; + group?: string; + text?: string; + src?: string; + table?: { + /** + * (string | number)[] Property + */ + [x: string]: (string | number)[]; + }; + structured_data?: { + /** + * (string | number)[] Property + */ + [x: string]: (string | number)[]; + }; + candidate_labels?: string; + messages?: { + role: "system" | "user" | "assistant"; + content: string; + }[]; + multi_class?: boolean; + source_sentence?: string; + sentences?: string[]; + parameters?: { + aggregation_strategy?: string; + top_k?: number; + top_p?: number; + temperature?: number; + max_new_tokens?: number; + do_sample?: boolean; + negative_prompt?: string; + guidance_scale?: number; + num_inference_steps?: number; + }; + output?: { + label: string; + score: number; + }[] | { + answer: string; + score: number; + } | { + text: string; + } | { + url: string; + }; +} +export interface ApiModelMetadata { + datasets?: string | string[]; + license?: License | License[]; + license_name?: string; + license_link?: "LICENSE" | "LICENSE.md" | string; + license_details?: string; + inference?: boolean | { + parameters?: { + aggregation_strategy?: string; + top_k?: number; + top_p?: number; + temperature?: number; + max_new_tokens?: number; + do_sample?: boolean; + negative_prompt?: string; + guidance_scale?: number; + num_inference_steps?: number; + }; + }; + language?: string | string[]; + language_bcp47?: string[]; + language_details?: string; + tags?: string[]; + pipeline_tag?: string; + co2_eq_emissions?: number | { + /** + * Emissions in grams of CO2 + */ + emissions: number; + /** + * source of the information, either directly from AutoTrain, code carbon or from a scientific article documenting the model + */ + source?: string; + /** + * pre-training or fine-tuning + */ + training_type?: string; + /** + * as granular as possible, for instance Quebec, Canada or Brooklyn, NY, USA + */ + geographical_location?: string; + /** + * how much compute and what kind, e.g. 8 v100 GPUs + */ + hardware_used?: string; + }; + library_name?: string; + thumbnail?: string | null; + description?: string | null; + mask_token?: string; + widget?: ApiWidgetExampleFromModelcard[]; + "model-index"?: ApiModelIndex[]; + finetuned_from?: string; + base_model?: string | string[]; + instance_prompt?: string | null; + extra_gated_prompt?: string; + extra_gated_fields?: { + /** + * "text" | "checkbox" | "date_picker" | "country" | "ip_location" | { type: "text" | "checkbox" | "date_picker" | "country" | "ip_location" } | { type: "select", options: Array } Property + */ + [x: string]: "text" | "checkbox" | "date_picker" | "country" | "ip_location" | { + type: "text" | "checkbox" | "date_picker" | "country" | "ip_location"; + } | { + type: "select"; + options: Array; + }; + }; + extra_gated_heading?: string; + extra_gated_description?: string; + extra_gated_button_content?: string; +} +export interface ApiModelInferenceProviderMappingEntry { + provider: string; + hfModelId: string; + providerId: string; + status: "live" | "staging"; + task: WidgetType; + adapter?: string; + adapterWeightsPath?: string; + type?: "single-file" | "tag-filter"; +} +//# sourceMappingURL=api-model.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-model.d.ts.map b/node_modules/@huggingface/hub/dist/src/types/api/api-model.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..4c482b0ddfe8e7f1f17522d7ac47b40c68cb5167 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-model.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"api-model.d.ts","sourceRoot":"","sources":["../../../../src/types/api/api-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACxF,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEvD,MAAM,WAAW,YAAY;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,QAAQ,EAAE,OAAO,CAAC;IAClB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,GAAG,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB,CAAC,EAAE,qCAAqC,EAAE,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,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,aAAa,CAAA;SAAE,GACzE;YAAE,IAAI,EAAE,QAAQ,CAAC;YAAC,OAAO,EAAE,KAAK,CAAC,MAAM,GAAG;gBAAE,KAAK,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE,CAAC,CAAA;SAAE,CAAC;KACjF,CAAC;IACF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,qCAAqC;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;CACpC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-space.d.ts b/node_modules/@huggingface/hub/dist/src/types/api/api-space.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9adcefe9ab29392235bc5bb66d5b8c5cefb1a181 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-space.d.ts @@ -0,0 +1,92 @@ +import type { License, SpaceRuntime, SpaceSdk } from "../public"; +type Color = "red" | "yellow" | "green" | "blue" | "indigo" | "purple" | "pink" | "gray"; +export interface ApiSpaceInfo { + _id: string; + id: string; + arxivIds?: string[]; + author: string; + cardExists?: true; + cardError?: unknown; + cardData?: unknown; + contributors?: Array<{ + user: string; + _id: string; + }>; + disabled: boolean; + discussionsDisabled: boolean; + duplicationDisabled: boolean; + gated: false | "auto" | "manual"; + gitalyUid: string; + lastAuthor: { + email: string; + user?: string; + }; + lastModified: string; + likes: number; + likesRecent: number; + private: boolean; + updatedAt: string; + createdAt: string; + tags: string[]; + sha: string; + subdomain: string; + title: string; + emoji: string; + colorFrom: Color; + colorTo: Color; + pinned: boolean; + siblings: Array<{ + rfilename: string; + }>; + sdk?: SpaceSdk; + runtime?: SpaceRuntime; + models?: string[]; + datasets?: string[]; + originSpace?: { + _id: string; + authorId: string; + }; +} +export interface ApiSpaceMetadata { + license?: License | License[]; + tags?: string[]; + title?: string; + colorFrom?: "red" | "yellow" | "green" | "blue" | "indigo" | "purple" | "pink" | "gray"; + colorTo?: "red" | "yellow" | "green" | "blue" | "indigo" | "purple" | "pink" | "gray"; + emoji?: string; + sdk?: "streamlit" | "gradio" | "docker" | "static"; + sdk_version?: string | string; + python_version?: string | string; + fullWidth?: boolean; + header?: "mini" | "default"; + app_file?: string; + app_port?: number; + base_path?: string; + models?: string[]; + datasets?: string[]; + pinned?: boolean; + metaTitle?: string; + description?: string; + thumbnail?: string; + /** + * If enabled, will associate an oauth app to the Space, adding variables and secrets to the Space's environment + */ + hf_oauth?: boolean; + /** + * The expiration of access tokens for your oauth app in minutes. max 30 days (43,200 minutes). Defaults to 8 hours (480 minutes) + */ + hf_oauth_expiration_minutes?: number; + /** + * OAuth scopes to request. By default you have access to the user's profile, you can request access to their repos or inference-api. + */ + hf_oauth_scopes?: ("email" | "read-repos" | "write-repos" | "manage-repos" | "inference-api")[]; + suggested_hardware?: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-xl" | "t4-small" | "t4-medium" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large"; + suggested_storage?: "small" | "medium" | "large"; + custom_headers?: { + "cross-origin-embedder-policy"?: "unsafe-none" | "require-corp" | "credentialless"; + "cross-origin-opener-policy"?: "same-origin" | "same-origin-allow-popups" | "unsafe-none"; + "cross-origin-resource-policy"?: "same-site" | "same-origin" | "cross-origin"; + }; +} +export {}; +//# sourceMappingURL=api-space.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-space.d.ts.map b/node_modules/@huggingface/hub/dist/src/types/api/api-space.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..d8951d8f85a48df3be5177f029ee2929f460e8b0 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-space.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"api-space.d.ts","sourceRoot":"","sources":["../../../../src/types/api/api-space.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEjE,KAAK,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzF,MAAM,WAAW,YAAY;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,QAAQ,EAAE,OAAO,CAAC;IAClB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,W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_modules/@huggingface/hub/dist/src/types/api/api-who-am-i.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..62d92b26d78590a7da5a1683fc90b3b35876d79a --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-who-am-i.d.ts @@ -0,0 +1,47 @@ +import type { AccessTokenRole, AuthType } from "../public"; +interface ApiWhoAmIBase { + /** Unique ID persistent across renames */ + id: string; + type: "user" | "org" | "app"; + name: string; +} +interface ApiWhoAmIEntityBase extends ApiWhoAmIBase { + fullname: string; + email: string | null; + canPay: boolean; + avatarUrl: string; + /** + * Unix timestamp in seconds + */ + periodEnd: number | null; +} +interface ApiWhoAmIOrg extends ApiWhoAmIEntityBase { + type: "org"; +} +interface ApiWhoAmIUser extends ApiWhoAmIEntityBase { + type: "user"; + email: string; + emailVerified: boolean; + isPro: boolean; + orgs: ApiWhoAmIOrg[]; + billingMode: "postpaid" | "prepaid"; +} +interface ApiWhoAmIApp extends ApiWhoAmIBase { + type: "app"; + name: string; + scope?: { + entities: string[]; + role: AccessTokenRole; + }; +} +export type ApiWhoAmIReponse = ApiWhoAmIUser | ApiWhoAmIOrg | ApiWhoAmIApp; +export interface ApiWhoAmIAuthInfo { + type: AuthType; + accessToken?: { + displayName: string; + expiration?: string; + role: AccessTokenRole; + }; +} +export {}; +//# sourceMappingURL=api-who-am-i.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/api/api-who-am-i.d.ts.map b/node_modules/@huggingface/hub/dist/src/types/api/api-who-am-i.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..eb31de33ff8a6dabad5bc68653812e99c83c494f --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/api/api-who-am-i.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"api-who-am-i.d.ts","sourceRoot":"","sources":["../../../../src/types/api/api-who-am-i.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE3D,UAAU,aAAa;IACtB,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;CACb;AAED,UAAU,mBAAoB,SAAQ,aAAa;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,UAAU,YAAa,SAAQ,mBAAmB;IACjD,IAAI,EAAE,KAAK,CAAC;CACZ;AAED,UAAU,aAAc,SAAQ,mBAAmB;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,WAAW,EAAE,UAAU,GAAG,SAAS,CAAC;CACpC;AAED,UAAU,YAAa,SAAQ,aAAa;IAC3C,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE;QACP,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,IAAI,EAAE,eAAe,CAAC;KACtB,CAAC;CACF;AAED,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,YAAY,GAAG,YAAY,CAAC;AAE3E,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,CAAC,EAAE;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,eAAe,CAAC;KACtB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/public.d.ts b/node_modules/@huggingface/hub/dist/src/types/public.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9afa0220940f3e007517be36a840f474b6128aa3 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/public.d.ts @@ -0,0 +1,67 @@ +import type { PipelineType } from "@huggingface/tasks"; +export type RepoType = "space" | "dataset" | "model" | "bucket"; +export interface RepoId { + name: string; + type: RepoType; +} +export type RepoFullName = string | `spaces/${string}` | `datasets/${string}` | `buckets/${string}`; +export type RepoDesignation = RepoId | RepoFullName; +/** Actually `hf_${string}`, but for convenience, using the string type */ +export type AccessToken = string; +/** + * @deprecated Use `AccessToken` instead. Pass { accessToken: "hf_..." } instead of { credentials: { accessToken: "hf_..." } } + */ +export interface Credentials { + accessToken: AccessToken; +} +export type CredentialsParams = { + accessToken?: undefined; + /** + * @deprecated Use `accessToken` instead + */ + credentials: Credentials; +} | { + accessToken: AccessToken; + /** + * @deprecated Use `accessToken` instead + */ + credentials?: undefined; +}; +export type SpaceHardwareFlavor = "cpu-basic" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "zero-a10g" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "a100x4" | "a100x8"; +export type SpaceSdk = "streamlit" | "gradio" | "docker" | "static"; +export type SpaceStage = "NO_APP_FILE" | "CONFIG_ERROR" | "BUILDING" | "BUILD_ERROR" | "RUNNING" | "RUNNING_BUILDING" | "RUNTIME_ERROR" | "DELETING" | "PAUSED" | "SLEEPING"; +export type AccessTokenRole = "admin" | "write" | "contributor" | "read"; +export type AuthType = "access_token" | "app_token" | "app_token_as_user"; +export type { PipelineType }; +export interface SpaceRuntime { + stage: SpaceStage; + sdk?: SpaceSdk; + sdkVersion?: string; + errorMessage?: string; + hardware?: { + current: SpaceHardwareFlavor | null; + currentPrettyName?: string; + requested: SpaceHardwareFlavor | null; + requestedPrettyName?: string; + }; + /** when calling /spaces, those props are only fetched if ?full=true */ + resources?: SpaceResourceConfig; + /** in seconds */ + gcTimeout?: number | null; +} +export interface SpaceResourceRequirement { + cpu?: string; + memory?: string; + gpu?: string; + gpuModel?: string; + ephemeral?: string; +} +export interface SpaceResourceConfig { + requests: SpaceResourceRequirement; + limits: SpaceResourceRequirement; + replicas?: number; + throttled?: boolean; + is_custom?: boolean; +} +export type License = "apache-2.0" | "mit" | "openrail" | "bigscience-openrail-m" | "creativeml-openrail-m" | "bigscience-bloom-rail-1.0" | "bigcode-openrail-m" | "afl-3.0" | "artistic-2.0" | "bsl-1.0" | "bsd" | "bsd-2-clause" | "bsd-3-clause" | "bsd-3-clause-clear" | "c-uda" | "cc" | "cc0-1.0" | "cc-by-2.0" | "cc-by-2.5" | "cc-by-3.0" | "cc-by-4.0" | "cc-by-sa-3.0" | "cc-by-sa-4.0" | "cc-by-nc-2.0" | "cc-by-nc-3.0" | "cc-by-nc-4.0" | "cc-by-nd-4.0" | "cc-by-nc-nd-3.0" | "cc-by-nc-nd-4.0" | "cc-by-nc-sa-2.0" | "cc-by-nc-sa-3.0" | "cc-by-nc-sa-4.0" | "cdla-sharing-1.0" | "cdla-permissive-1.0" | "cdla-permissive-2.0" | "wtfpl" | "ecl-2.0" | "epl-1.0" | "epl-2.0" | "etalab-2.0" | "eupl-1.1" | "agpl-3.0" | "gfdl" | "gpl" | "gpl-2.0" | "gpl-3.0" | "lgpl" | "lgpl-2.1" | "lgpl-3.0" | "isc" | "lppl-1.3c" | "ms-pl" | "mpl-2.0" | "odc-by" | "odbl" | "openrail++" | "osl-3.0" | "postgresql" | "ofl-1.1" | "ncsa" | "unlicense" | "zlib" | "pddl" | "lgpl-lr" | "deepfloyd-if-license" | "llama2" | "llama3" | "llama3.1" | "llama3.2" | "llama3.3" | "gemma" | "apple-ascl" | "apple-amlr" | "unknown" | "other"; +//# sourceMappingURL=public.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/types/public.d.ts.map b/node_modules/@huggingface/hub/dist/src/types/public.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..456cb8d18535229ee2687dc625553a396fe84133 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/types/public.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/types/public.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhE,MAAM,WAAW,MAAM;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;CACf;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,UAAU,MAAM,EAAE,GAAG,YAAY,MAAM,EAAE,GAAG,WAAW,MAAM,EAAE,CAAC;AAEpG,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,YAAY,CAAC;AAEpD,0EAA0E;AAC1E,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAEjC;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,WAAW,EAAE,WAAW,CAAC;CACzB;AAED,MAAM,MAAM,iBAAiB,GAC1B;IACA,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,WAAW,EAAE,WAAW,CAAC;CACxB,GACD;IACA,WAAW,EAAE,WAAW,CAAC;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEL,MAAM,MAAM,mBAAmB,GAC5B,WAAW,GACX,aAAa,GACb,iBAAiB,GACjB,QAAQ,GACR,OAAO,GACP,WAAW,GACX,QAAQ,GACR,UAAU,GACV,WAAW,GACX,MAAM,GACN,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,YAAY,GACZ,YAAY,GACZ,cAAc,GACd,cAAc,GACd,YAAY,GACZ,QAAQ,GACR,QAAQ,CAA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AAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,OAAO,GAChB,YAAY,GACZ,KAAK,GACL,UAAU,GACV,uBAAuB,GACvB,uBAAuB,GACvB,2BAA2B,GAC3B,oBAAoB,GACpB,SAAS,GACT,cAAc,GACd,SAAS,GACT,KAAK,GACL,cAAc,GACd,cAAc,GACd,oBAAoB,GACpB,OAAO,GACP,IAAI,GACJ,SAAS,GACT,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,cAAc,GACd,cAAc,GACd,cAAc,GACd,cAAc,GACd,cAAc,GACd,cAAc,GACd,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,qBAAqB,GACrB,qBAAqB,GACrB,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,YAAY,GACZ,UAAU,GACV,UAAU,GACV,MAAM,GACN,KAAK,GACL,SAAS,GACT,SAAS,GACT,MAAM,GACN,UAAU,GACV,UAAU,GACV,KAAK,GACL,WAAW,GACX,OAAO,GACP,SAAS,GACT,QAAQ,GACR,MAAM,GACN,YAAY,GACZ,SAAS,GACT,YAAY,GACZ,SAAS,GACT,MAAM,GACN,WAAW,GACX,MAAM,GACN,MAAM,GACN,SAAS,GACT,sBAAsB,GACtB,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,UAAU,GACV,UAAU,GACV,OAAO,GACP,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,OAAO,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/ChunkCache.d.ts b/node_modules/@huggingface/hub/dist/src/utils/ChunkCache.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..adac54f9e1194f85f3b793c3140435a677679f35 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/ChunkCache.d.ts @@ -0,0 +1,21 @@ +export declare class ChunkCache { + index: number; + xorbIndices: Int32Array; + chunkIndices: Uint16Array; + map: Map; + hmacs: Set; + maxSize: number; + constructor(maxSize?: number); + addChunkToCache(hash: string, xorbIndex: number, chunkIndex: number, hmac: string | null): void; + getChunk(hash: string, + /** + * Set to null if you only want to check against locally created chunks, or the hash is already a hmac + */ + hmacFunction: ((hash: string, key: string) => string) | null): { + xorbIndex: number; + chunkIndex: number; + } | undefined; + updateChunkIndex(hash: string, chunkIndex: number): void; + removeChunkFromCache(hash: string): void; +} +//# sourceMappingURL=ChunkCache.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/ChunkCache.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/ChunkCache.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..37fdd6e22605a95b32df26a2123bc3ea1fabbff2 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/ChunkCache.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ChunkCache.d.ts","sourceRoot":"","sources":["../../../src/utils/ChunkCache.ts"],"names":[],"mappings":"AAIA,qBAAa,UAAU;IACtB,KAAK,SAAK;IAEV,WAAW,EAAE,UAAU,CAAC;IAExB,YAAY,EAAE,WAAW,CAAC;IAC1B,GAAG,sBAA6B;IAChC,KAAK,cAAqB;IAC1B,OAAO,EAAE,MAAM,CAAC;gBAEJ,OAAO,GAAE,MAA6B;IASlD,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAkC/F,QAAQ,CACP,IAAI,EAAE,MAAM;IACZ;;OAEG;IACH,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,IAAI,GAE1D;QACA,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;KAClB,GACD,SAAS;IAmBZ,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAQxD,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAGxC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/ChunkCache.spec.d.ts b/node_modules/@huggingface/hub/dist/src/utils/ChunkCache.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4c53ed26eba0f9c94b5dc571a9535f6c5a69e4e7 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/ChunkCache.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=ChunkCache.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/ChunkCache.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/ChunkCache.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..99b179f37390cc20f054e7b66fba3dce58bc6ff9 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/ChunkCache.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ChunkCache.spec.d.ts","sourceRoot":"","sources":["../../../src/utils/ChunkCache.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/FileBlob.d.ts b/node_modules/@huggingface/hub/dist/src/utils/FileBlob.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..33567f7e559d2ce6b3f19e39c7094ca4e3f7ba9d --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/FileBlob.d.ts @@ -0,0 +1,61 @@ +/** + * @internal + * + * A FileBlob is a replacement for the Blob class that allows to lazy read files + * in order to preserve memory. + * + * It is a drop-in replacement for the Blob class, so you can use it as a Blob. + * + * The main difference is the instantiation, which is done asynchronously using the `FileBlob.create` method. + * + * @example + * const fileBlob = await FileBlob.create("path/to/package.json"); + * + * await fetch("https://aschen.tech", { method: "POST", body: fileBlob }); + */ +export declare class FileBlob extends Blob { + /** + * Creates a new FileBlob on the provided file. + * + * @param path Path to the file to be lazy readed + */ + static create(path: string | URL): Promise; + private path; + private start; + private end; + private constructor(); + /** + * Returns the size of the blob. + */ + get size(): number; + /** + * Returns a new instance of FileBlob that is a slice of the current one. + * + * The slice is inclusive of the start and exclusive of the end. + * + * The slice method does not supports negative start/end. + * + * @param start beginning of the slice + * @param end end of the slice + */ + slice(start?: number, end?: number): FileBlob; + /** + * Read the part of the file delimited by the FileBlob and returns it as an ArrayBuffer. + */ + arrayBuffer(): Promise; + /** + * Read the part of the file delimited by the FileBlob and returns it as a string. + */ + text(): Promise; + /** + * Returns a stream around the part of the file delimited by the FileBlob. + */ + stream(): ReturnType; + /** + * We are opening and closing the file for each action to prevent file descriptor leaks. + * + * It is an intended choice of developer experience over performances. + */ + private execute; +} +//# sourceMappingURL=FileBlob.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/FileBlob.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/FileBlob.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..2a7d1312e2d3bbc84475efc6836b66934f97e43f --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/FileBlob.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"FileBlob.d.ts","sourceRoot":"","sources":["../../../src/utils/FileBlob.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,qBAAa,QAAS,SAAQ,IAAI;IACjC;;;;OAIG;WACU,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;IAU1D,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,GAAG,CAAS;IAEpB,OAAO;IAQP;;OAEG;IACH,IAAa,IAAI,IAAI,MAAM,CAE1B;IAED;;;;;;;;;OASG;IACM,KAAK,CAAC,KAAK,SAAI,EAAE,GAAG,SAAY,GAAG,QAAQ;IAUpD;;OAEG;IACY,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;IAMlD;;OAEG;IACY,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAMtC;;OAEG;IACM,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAU7C;;;;OAIG;YACW,OAAO;CASrB"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/FileBlob.spec.d.ts b/node_modules/@huggingface/hub/dist/src/utils/FileBlob.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3dc4b9bdaa2e5d1f61764724aeb956a9f1decb9e --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/FileBlob.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=FileBlob.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/FileBlob.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/FileBlob.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..fe05adadf8a8c2290c395959ddeb770a8bf20a1b --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/FileBlob.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"FileBlob.spec.d.ts","sourceRoot":"","sources":["../../../src/utils/FileBlob.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/RangeList.d.ts b/node_modules/@huggingface/hub/dist/src/utils/RangeList.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6643303da47626cc99319eabc91bd9fc35d1bff6 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/RangeList.d.ts @@ -0,0 +1,52 @@ +/** + * Code generated with this prompt by Cursor: + * + * I want to build a class to manage ranges + * + * I can add ranges to it with a start& an end (both integer, end > start). It should store those ranges efficiently. + * + * When several ranges overlap, eg [1, 100] and [30, 50], I want the class to split the range into non-overlapping ranges, and add a "ref counter" to the ranges. For example, [1, 30], [30, 50] * 2, [50, 100] + * + * I also want to be able to remove ranges, it will decrease the ref counter or remove the range altogether. I can only remove ranges at existing boundaries. For example, with the [1, 30], [30, 50] * 2, [50, 100] configuration + * + * - removing [1, 100] => the only range remaning is [30, 50] + * - removing [2, 50] => error, because "2' is not a boundary + * - removing [30, 50] => [1, 30], [30, 50], [50, 100] (do not "merge" the ranges back together) + * + * I want to be able to associate data to each range. And I want to be able to get the ranges inside boundaries. For example , with [1, 30], [30, 50] * 2, [50, 100] configuration + * + * - getting [30, 100] => I receive [30, 50] * 2, [50, 100], and I can get / modify the data associated to each range by accessing their data prop. Note the "*2" is just the ref counter, there is onlly one range object for the interval returned + * - getting [2, 50] => I get [30, 50] * 2 + * + * ---- + * + * Could optimize with binary search, but the ranges we want to handle are not that many. + */ +interface Range { + start: number; + end: number; + refCount: number; + data: T | null; +} +export declare class RangeList { + private ranges; + /** + * Add a range to the list. If it overlaps with existing ranges, + * it will split them and increment reference counts accordingly. + */ + add(start: number, end: number): void; + /** + * Remove a range from the list. The range must start and end at existing boundaries. + */ + remove(start: number, end: number): void; + /** + * Get all ranges within the specified boundaries. + */ + getRanges(start: number, end: number): Range[]; + /** + * Get all ranges in the list + */ + getAllRanges(): Range[]; +} +export {}; +//# sourceMappingURL=RangeList.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/RangeList.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/RangeList.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..1bb233291c606acfada9677da4ad6518c23425ba --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/RangeList.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"RangeList.d.ts","sourceRoot":"","sources":["../../../src/utils/RangeList.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,UAAU,KAAK,CAAC,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;CACf;AAED,qBAAa,SAAS,CAAC,CAAC;IACvB,OAAO,CAAC,MAAM,CAAkB;IAEhC;;;OAGG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAsFrC;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAkCxC;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE;IAQjD;;OAEG;IACH,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;CAG1B"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/RangeList.spec.d.ts b/node_modules/@huggingface/hub/dist/src/utils/RangeList.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a859f578163d9a221f250055706ca0c5bbeb6c12 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/RangeList.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=RangeList.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/RangeList.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/RangeList.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..c0d70f8a61ca0678f80575c4651ad140101ba520 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/RangeList.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"RangeList.spec.d.ts","sourceRoot":"","sources":["../../../src/utils/RangeList.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/SplicedBlob.d.ts b/node_modules/@huggingface/hub/dist/src/utils/SplicedBlob.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8580c55a2e5707af0ab536261f4181df857ed8fd --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/SplicedBlob.d.ts @@ -0,0 +1,68 @@ +/** + * Represents a single splice operation + */ +interface SpliceOperation { + insert: Blob; + start: number; + end: number; +} +/** + * @internal + * + * A SplicedBlob is a Blob that represents the result of splicing one or more insert blobs + * into an original blob at specified positions, replacing content between start and end. + * + * It is a drop-in replacement for the Blob class, so you can use it as a Blob. + * The splicing is done virtually without copying data until accessed. + * + * @example + * const originalBlob = new Blob(["Hello, World!"]); + * const insertBlob = new Blob(["Beautiful "]); + * const splicedBlob = SplicedBlob.create(originalBlob, insertBlob, 7, 7); + * // Result represents: "Hello, Beautiful World!" + */ +export declare class SplicedBlob extends Blob { + originalBlob: Blob; + spliceOperations: SpliceOperation[]; + private constructor(); + static create(originalBlob: Blob, operations: SpliceOperation[]): SplicedBlob; + /** + * Returns the size of the spliced blob. + * Size = original size - total replaced size + total insert size + */ + get size(): number; + /** + * Returns the MIME type of the original blob. + */ + get type(): string; + /** + * Returns a new instance of SplicedBlob that is a slice of the current one. + * + * The slice is inclusive of the start and exclusive of the end. + * The slice method does not support negative start/end. + * + * @param start beginning of the slice + * @param end end of the slice + */ + slice(start?: number, end?: number): Blob; + get firstSpliceIndex(): number; + /** + * Read the spliced blob content and returns it as an ArrayBuffer. + */ + arrayBuffer(): Promise; + /** + * Read the spliced blob content and returns it as a string. + */ + text(): Promise; + /** + * Returns a stream around the spliced blob content. + */ + stream(): ReturnType; + /** + * Get all segments that make up the spliced blob. + * This includes original blob segments between splice operations and insert blobs. + */ + private get segments(); +} +export {}; +//# sourceMappingURL=SplicedBlob.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/SplicedBlob.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/SplicedBlob.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..26219e324401b837f58542d3c53a70713ee73131 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/SplicedBlob.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"SplicedBlob.d.ts","sourceRoot":"","sources":["../../../src/utils/SplicedBlob.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,UAAU,eAAe;IACxB,MAAM,EAAE,IAAI,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,WAAY,SAAQ,IAAI;IAC7B,YAAY,EAAE,IAAI,CAAC;IACnB,gBAAgB,EAAE,eAAe,EAAE,CAAC;IAE3C,OAAO;IAOP,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,WAAW;IAyB7E;;;OAGG;IACH,IAAa,IAAI,IAAI,MAAM,CAU1B;IAED;;OAEG;IACH,IAAa,IAAI,IAAI,MAAM,CAE1B;IAED;;;;;;;;OAQG;IACM,KAAK,CAAC,KAAK,SAAI,EAAE,GAAG,SAAY,GAAG,IAAI;IAmDhD,IAAI,gBAAgB,IAAI,MAAM,CAE7B;IAED;;OAEG;IACY,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;IAiBlD;;OAEG;IACY,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAKtC;;OAEG;IACM,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAgC7C;;;OAGG;IACH,OAAO,KAAK,QAAQ,GA4BnB;CACD"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/SplicedBlob.spec.d.ts b/node_modules/@huggingface/hub/dist/src/utils/SplicedBlob.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..51358346368fe397cabb0c4f822edd282172d9e2 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/SplicedBlob.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=SplicedBlob.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/SplicedBlob.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/SplicedBlob.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..d856cb7a3e3040e0f2ed956043a406740dc5be0d --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/SplicedBlob.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"SplicedBlob.spec.d.ts","sourceRoot":"","sources":["../../../src/utils/SplicedBlob.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/WebBlob.d.ts b/node_modules/@huggingface/hub/dist/src/utils/WebBlob.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..abcb924cc8a4c80f97051db67eb5a31f91d4e9d9 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/WebBlob.d.ts @@ -0,0 +1,37 @@ +/** + * WebBlob is a Blob implementation for web resources that supports range requests. + */ +interface WebBlobCreateOptions { + /** + * @default 1_000_000 + * + * Objects below that size will immediately be fetched and put in RAM, rather + * than streamed ad-hoc + */ + cacheBelow?: number; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + accessToken: string | undefined; +} +export declare class WebBlob extends Blob { + static create(url: URL, opts?: WebBlobCreateOptions): Promise; + private url; + private start; + private end; + private contentType; + private full; + private fetch; + private accessToken; + constructor(url: URL, start: number, end: number, contentType: string, full: boolean, customFetch: typeof fetch, accessToken: string | undefined); + get size(): number; + get type(): string; + slice(start?: number, end?: number): WebBlob; + arrayBuffer(): Promise; + text(): Promise; + stream(): ReturnType; + private fetchRange; +} +export {}; +//# sourceMappingURL=WebBlob.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/WebBlob.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/WebBlob.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..f5fc5b67cbe6ea573d0378cc12a65e93b94fa139 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/WebBlob.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"WebBlob.d.ts","sourceRoot":"","sources":["../../../src/utils/WebBlob.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,UAAU,oBAAoB;IAC7B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED,qBAAa,OAAQ,SAAQ,IAAI;WACnB,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBzE,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,IAAI,CAAU;IACtB,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,WAAW,CAAqB;gBAGvC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,OAAO,KAAK,EACzB,WAAW,EAAE,MAAM,GAAG,SAAS;IAahC,IAAa,IAAI,IAAI,MAAM,CAE1B;IAED,IAAa,IAAI,IAAI,MAAM,CAE1B;IAEQ,KAAK,CAAC,KAAK,SAAI,EAAE,GAAG,SAAY,GAAG,OAAO;IAkBpC,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;IAMnC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAM7B,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAU7C,OAAO,CAAC,UAAU;CAkBlB"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/WebBlob.spec.d.ts b/node_modules/@huggingface/hub/dist/src/utils/WebBlob.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..aca418dff45130924e8f7cc7c44436d28336cbfb --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/WebBlob.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=WebBlob.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/WebBlob.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/WebBlob.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..91978e677249d646b7b1152ae4291b3aa8216e18 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/WebBlob.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"WebBlob.spec.d.ts","sourceRoot":"","sources":["../../../src/utils/WebBlob.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/XetBlob.d.ts b/node_modules/@huggingface/hub/dist/src/utils/XetBlob.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..92a5392c6c9bff22b6c28863ed320a850d4f8244 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/XetBlob.d.ts @@ -0,0 +1,107 @@ +import type { CredentialsParams } from "../types/public"; +export interface XetReadToken { + accessToken: string; + casUrl: string; + exp: number; +} +type XetBlobCreateOptions = { + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + refreshUrl: string; + size: number; + listener?: (arg: { + event: "read"; + } | { + event: "progress"; + progress: { + read: number; + total: number; + }; + }) => void; + internalLogging?: boolean; + /** + * Pre-fetched read token to avoid the refresh URL roundtrip. + */ + readToken?: XetReadToken; +} & ({ + hash: string; + reconstructionUrl?: string; +} | { + hash?: string; + reconstructionUrl: string; +}) & Partial; +export interface ReconstructionInfo { + /** + * List of CAS blocks + */ + terms: Array<{ + /** Hash of the CAS block */ + hash: string; + /** Total uncompressed length of data of the chunks from range.start to range.end - 1 */ + unpacked_length: number; + /** Chunks. Eg start: 10, end: 100 = chunks 10-99 */ + range: { + start: number; + end: number; + }; + }>; + /** + * Dictionnary of CAS block hash => list of ranges in the block + url to fetch it + */ + fetch_info: Record>; + /** + * When doing a range request, the offset into the term's uncompressed data. Can be multiple chunks' worth of data. + */ + offset_into_first_range: number; +} +export declare enum XetChunkCompressionScheme { + None = 0, + LZ4 = 1, + ByteGroupingLZ4 = 2 +} +export declare const XET_CHUNK_HEADER_BYTES = 8; +/** + * XetBlob is a blob implementation that fetches data directly from the Xet storage + */ +export declare class XetBlob extends Blob { + #private; + fetch: typeof fetch; + accessToken?: string; + refreshUrl: string; + reconstructionUrl?: string; + hash?: string; + start: number; + end: number; + internalLogging: boolean; + reconstructionInfo: ReconstructionInfo | undefined; + listener: XetBlobCreateOptions["listener"]; + constructor(params: XetBlobCreateOptions); + get size(): number; + slice(start?: number, end?: number): XetBlob; + arrayBuffer(): Promise; + text(): Promise; + response(): Promise; + stream(): ReturnType; +} +export declare function bg4_regroup_bytes(bytes: Uint8Array): Uint8Array; +export declare function bg4_split_bytes(bytes: Uint8Array): Uint8Array; +export {}; +//# sourceMappingURL=XetBlob.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/XetBlob.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/XetBlob.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..ec17337b3eb63e930b1e57ed01d7d16c694c56d9 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/XetBlob.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"XetBlob.d.ts","sourceRoot":"","sources":["../../../src/utils/XetBlob.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AASzD,MAAM,WAAW,YAAY;IAC5B,WAAW,EAAE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ob.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6b9e66998f8e4532f6b32273faee81dce58ec3c6 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/XetBlob.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=XetBlob.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/XetBlob.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/XetBlob.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..3ec609ddf408832fefea7342b1f6369794f9f90b --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/XetBlob.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"XetBlob.spec.d.ts","sourceRoot":"","sources":["../../../src/utils/XetBlob.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/base64FromBytes.d.ts b/node_modules/@huggingface/hub/dist/src/utils/base64FromBytes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4cbee918664971dbe986ef21375120c44924979a --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/base64FromBytes.d.ts @@ -0,0 +1,2 @@ +export declare function base64FromBytes(arr: Uint8Array): string; +//# sourceMappingURL=base64FromBytes.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/base64FromBytes.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/base64FromBytes.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..6f58a178c9da0fcdd6e1fd27282e2b1bc612489e --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/base64FromBytes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base64FromBytes.d.ts","sourceRoot":"","sources":["../../../src/utils/base64FromBytes.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAUvD"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/checkCredentials.d.ts b/node_modules/@huggingface/hub/dist/src/utils/checkCredentials.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4eed32a6feb4eb241402ce09531509c11e735259 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/checkCredentials.d.ts @@ -0,0 +1,4 @@ +import type { CredentialsParams } from "../types/public"; +export declare function checkAccessToken(accessToken: string): void; +export declare function checkCredentials(params: Partial): string | undefined; +//# sourceMappingURL=checkCredentials.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/checkCredentials.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/checkCredentials.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..3c683f78b508a6c78207a8e38e72688cfb92fba0 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/checkCredentials.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"checkCredentials.d.ts","sourceRoot":"","sources":["../../../src/utils/checkCredentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAI1D;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,MAAM,GAAG,SAAS,CASvF"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/chunk.d.ts b/node_modules/@huggingface/hub/dist/src/utils/chunk.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ef12cdda9226612e4cf1c1492b0c662e997143e --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/chunk.d.ts @@ -0,0 +1,7 @@ +/** + * Chunk array into arrays of length at most `chunkSize` + * + * @param chunkSize must be greater than or equal to 1 + */ +export declare function chunk(arr: T, chunkSize: number): T[]; +//# sourceMappingURL=chunk.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/chunk.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/chunk.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..80708bab7af0c2e2462199377b7cfa54d050ae00 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/chunk.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../../../src/utils/chunk.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC,EAAE,CAiBlF"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/combineUint8Arrays.d.ts b/node_modules/@huggingface/hub/dist/src/utils/combineUint8Arrays.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..306fc41c5ed6fb4168dfdbf8024c577478de3a80 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/combineUint8Arrays.d.ts @@ -0,0 +1,2 @@ +export declare function combineUint8Arrays(a: Uint8Array, b: Uint8Array): Uint8Array; +//# sourceMappingURL=combineUint8Arrays.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/combineUint8Arrays.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/combineUint8Arrays.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..577accbb7d85426405fa205f315d9c32a80a001a --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/combineUint8Arrays.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"combineUint8Arrays.d.ts","sourceRoot":"","sources":["../../../src/utils/combineUint8Arrays.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CACjC,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,EAC9B,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,GAC5B,UAAU,CAAC,WAAW,CAAC,CAMzB"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/combineUint8Arrays.spec.d.ts b/node_modules/@huggingface/hub/dist/src/utils/combineUint8Arrays.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..94c4c0680fee2056c16262b6a28f7b3593d2c253 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/combineUint8Arrays.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=combineUint8Arrays.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/combineUint8Arrays.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/combineUint8Arrays.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7143c2d6c3a7aec245278fc8ec6fc41cca7f65d2 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/combineUint8Arrays.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"combineUint8Arrays.spec.d.ts","sourceRoot":"","sources":["../../../src/utils/combineUint8Arrays.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/createBlob.d.ts b/node_modules/@huggingface/hub/dist/src/utils/createBlob.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..24d0d70fce75368728806fb00ca7341ac19f0b56 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/createBlob.d.ts @@ -0,0 +1,15 @@ +/** + * This function allow to retrieve either a FileBlob or a WebBlob from a URL. + * + * From the backend: + * - support local files + * - support http resources with absolute URLs + * + * From the frontend: + * - support http resources with absolute or relative URLs + */ +export declare function createBlob(url: URL, opts?: { + fetch?: typeof fetch; + accessToken?: string; +}): Promise; +//# sourceMappingURL=createBlob.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/createBlob.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/createBlob.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..c8f042d169b38c108cbae5e7fb1387ad2c069933 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/createBlob.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"createBlob.d.ts","sourceRoot":"","sources":["../../../src/utils/createBlob.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB/G"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/createBlobs.d.ts b/node_modules/@huggingface/hub/dist/src/utils/createBlobs.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2e43bdfd6a18871abce8069b848d7c38cf7769e0 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/createBlobs.d.ts @@ -0,0 +1,20 @@ +/** + * This function allow to retrieve either a FileBlob or a WebBlob from a URL. + * + * From the backend: + * - support local files + * - support local folders + * - support http resources with absolute URLs + * + * From the frontend: + * - support http resources with absolute or relative URLs + */ +export declare function createBlobs(url: URL, destPath: string, opts?: { + fetch?: typeof fetch; + maxFolderDepth?: number; + accessToken?: string; +}): Promise>; +//# sourceMappingURL=createBlobs.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/createBlobs.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/createBlobs.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..5e21137842d11d48799812977745f79925650e9f --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/createBlobs.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"createBlobs.d.ts","sourceRoot":"","sources":["../../../src/utils/createBlobs.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAChC,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5E,OAAO,CAAC,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC,CAgC9C"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/createXorb.spec.d.ts b/node_modules/@huggingface/hub/dist/src/utils/createXorb.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..207d9fa0ed1d7db1728a19c7feeef1101b1a97a0 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/createXorb.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=createXorb.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/createXorb.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/createXorb.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..72bdab5719c1245a868b7fc1c3f68a52fc4b04d6 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/createXorb.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"createXorb.spec.d.ts","sourceRoot":"","sources":["../../../src/utils/createXorb.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/createXorbs.d.ts b/node_modules/@huggingface/hub/dist/src/utils/createXorbs.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bef532b0d827821ec150d48cc577353f92ba9db2 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/createXorbs.d.ts @@ -0,0 +1,73 @@ +import { ChunkCache } from "./ChunkCache"; +import { type XetWriteTokenParams } from "./xetWriteToken"; +import type { ShardData } from "./shardParser"; +interface XorbEvent { + event: "xorb"; + xorb: Uint8Array; + hash: string; + id: number; + chunks: Array<{ + hash: string; + length: number; + }>; + files: Array<{ + path: string; + progress: number; + lastSentProgress: number; + }>; +} +export declare class CurrentXorbInfo { + id: number; + offset: number; + chunks: Array<{ + hash: string; + length: number; + offset: number; + }>; + fileProcessedBytes: Record; + fileUploadedBytes: Record; + fileSize: Record; + data: Uint8Array; + immutableData: { + chunkIndex: number; + offset: number; + } | null; + constructor(); + event(computeXorbHash: (chunks: { + hash: string; + length: number; + }[]) => string): XorbEvent; +} +export declare function createXorbs(fileSources: AsyncGenerator<{ + content: Blob; + path: string; + sha256?: string; +}>, params: XetWriteTokenParams & { + yieldCallback?: (event: { + event: "fileProgress"; + path: string; + progress: number; + }) => void; +}): AsyncGenerator; +}, void, undefined>; +export declare function backtrackDedup(xorb: CurrentXorbInfo, computeHmac: (hash: string, key: string) => string, shardData: ShardData, chunkCache: ChunkCache, chunkMetadata: { + xorbId: number | string; + chunkIndex: number; + length: number; +}[], dedupedBytes: number): number; +export {}; +//# sourceMappingURL=createXorbs.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/createXorbs.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/createXorbs.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..3c9d54b73ddbe5ddd0869803c45d5655103cfff8 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/createXorbs.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"createXorbs.d.ts","sourceRoot":"","sources":["../../../src/utils/createXorbs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAiB,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAkB/C,UAAU,SAAS;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb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QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAC3F,GACC,cAAc,CACd,SAAS,GACT;IACA,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,KAAK,CAAC;QACrB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,sBAAsB;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACF,EACH,IAAI,EACJ,SAAS,CACT,CA8QA;AAED,wBAAgB,cAAc,CAC7B,IAAI,EAAE,eAAe,EACrB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,EAClD,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE;IAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,EAChF,YAAY,EAAE,MAAM,GAClB,MAAM,CAmGR"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/eventToGenerator.d.ts b/node_modules/@huggingface/hub/dist/src/utils/eventToGenerator.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4023ceea374623c495a4b391ff20eb85eb98a847 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/eventToGenerator.d.ts @@ -0,0 +1,2 @@ +export declare function eventToGenerator(cb: (yieldCallback: (y: YieldType) => void, returnCallback: (r: ReturnType) => void, rejectCallack: (reason: unknown) => void) => unknown): AsyncGenerator; +//# sourceMappingURL=eventToGenerator.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/eventToGenerator.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/eventToGenerator.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..c145f34e3a8f0ffe9d8e47880d3a2c81860bc222 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/eventToGenerator.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"eventToGenerator.d.ts","sourceRoot":"","sources":["../../../src/utils/eventToGenerator.ts"],"names":[],"mappings":"AAAA,wBAAuB,gBAAgB,CAAC,SAAS,EAAE,UAAU,EAC5D,EAAE,EAAE,CACH,aAAa,EAAE,CAAC,CAAC,EAAE,SAAS,KAAK,IAAI,EACrC,cAAc,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,EACvC,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,KACpC,OAAO,GACV,cAAc,CAAC,SAAS,EAAE,UAAU,CAAC,CAyDvC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/eventToGenerator.spec.d.ts b/node_modules/@huggingface/hub/dist/src/utils/eventToGenerator.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..48665837d283aabc4512d4dda06f00a1a148a77e --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/eventToGenerator.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=eventToGenerator.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/eventToGenerator.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/eventToGenerator.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..0bb4d9a5f7782ee078caf6c44b6c73fd0a92a7ba --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/eventToGenerator.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"eventToGenerator.spec.d.ts","sourceRoot":"","sources":["../../../src/utils/eventToGenerator.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/hexFromBytes.d.ts b/node_modules/@huggingface/hub/dist/src/utils/hexFromBytes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c46b6770008f612d0c2bb7bf4c058f14d1b88d11 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/hexFromBytes.d.ts @@ -0,0 +1,2 @@ +export declare function hexFromBytes(arr: Uint8Array): string; +//# sourceMappingURL=hexFromBytes.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/hexFromBytes.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/hexFromBytes.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7648ff81154157295bec5f561ba4c77cdc769916 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/hexFromBytes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hexFromBytes.d.ts","sourceRoot":"","sources":["../../../src/utils/hexFromBytes.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAUpD"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/insecureRandomString.d.ts b/node_modules/@huggingface/hub/dist/src/utils/insecureRandomString.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..44f3e0e242ecdd766bfb500cbeceda0b855d3f40 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/insecureRandomString.d.ts @@ -0,0 +1,2 @@ +export declare function insecureRandomString(): string; +//# sourceMappingURL=insecureRandomString.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/insecureRandomString.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/insecureRandomString.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..45728c06f25c99fcc0205f065452f69a2b0e5833 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/insecureRandomString.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"insecureRandomString.d.ts","sourceRoot":"","sources":["../../../src/utils/insecureRandomString.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/isBackend.d.ts b/node_modules/@huggingface/hub/dist/src/utils/isBackend.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..069d8727ffbc8bb2c70bae99fe1413db4bf0e7a2 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/isBackend.d.ts @@ -0,0 +1,2 @@ +export declare const isBackend: boolean; +//# sourceMappingURL=isBackend.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/isBackend.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/isBackend.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..56291c33b8f5490fd2cc3d194f43bd791f599280 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/isBackend.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"isBackend.d.ts","sourceRoot":"","sources":["../../../src/utils/isBackend.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS,SAA6B,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/isFrontend.d.ts b/node_modules/@huggingface/hub/dist/src/utils/isFrontend.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f48051727350420cea4a870a0df61fd629c8f47a --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/isFrontend.d.ts @@ -0,0 +1,2 @@ +export declare const isFrontend: boolean; +//# sourceMappingURL=isFrontend.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/isFrontend.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/isFrontend.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..eb97bede136119de84b957123d53836f5de4ea2f --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/isFrontend.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"isFrontend.d.ts","sourceRoot":"","sources":["../../../src/utils/isFrontend.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,SAAa,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/mergeAsyncGenerators.d.ts b/node_modules/@huggingface/hub/dist/src/utils/mergeAsyncGenerators.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4699ddbde6aca8408916607eeee718facdbb31d0 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/mergeAsyncGenerators.d.ts @@ -0,0 +1,5 @@ +/** + * Merge outputs of multiple async generators. + */ +export declare function mergeAsyncGenerators(generators: AsyncGenerator[]): AsyncGenerator; +//# sourceMappingURL=mergeAsyncGenerators.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/mergeAsyncGenerators.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/mergeAsyncGenerators.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..4a387c0b5c473da5d40d7b3c8f77436332a64061 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/mergeAsyncGenerators.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mergeAsyncGenerators.d.ts","sourceRoot":"","sources":["../../../src/utils/mergeAsyncGenerators.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAuB,oBAAoB,CAAC,CAAC,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,GAAG,cAAc,CAAC,CAAC,CAAC,CA8BjG"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/mergeAsyncGenerators.spec.d.ts b/node_modules/@huggingface/hub/dist/src/utils/mergeAsyncGenerators.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9eabdfde96de2c9954f01e54588899a69576423c --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/mergeAsyncGenerators.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=mergeAsyncGenerators.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/mergeAsyncGenerators.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/mergeAsyncGenerators.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..1a80e950ca139f98c499df308eff46a656c40da2 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/mergeAsyncGenerators.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mergeAsyncGenerators.spec.d.ts","sourceRoot":"","sources":["../../../src/utils/mergeAsyncGenerators.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/normalizeInferenceProviderMapping.d.ts b/node_modules/@huggingface/hub/dist/src/utils/normalizeInferenceProviderMapping.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c74be59900e109bcc3b1c0eed77eb9b435dd077a --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/normalizeInferenceProviderMapping.d.ts @@ -0,0 +1,14 @@ +import type { WidgetType } from "@huggingface/tasks"; +import type { ApiModelInferenceProviderMappingEntry } from "../types/api/api-model"; +/** + * Normalize inferenceProviderMapping to always return an array format. + * + * Little hack to simplify Inference Providers logic and make it backward and forward compatible. + * Right now, API returns a dict on model-info and a list on list-models. Let's harmonize to list. + */ +export declare function normalizeInferenceProviderMapping(hfModelId: string, inferenceProviderMapping?: ApiModelInferenceProviderMappingEntry[] | Record): ApiModelInferenceProviderMappingEntry[]; +//# sourceMappingURL=normalizeInferenceProviderMapping.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/normalizeInferenceProviderMapping.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/normalizeInferenceProviderMapping.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..0185b247025c3e6ed8b8563af1a939846cc5d891 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/normalizeInferenceProviderMapping.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"normalizeInferenceProviderMapping.d.ts","sourceRoot":"","sources":["../../../src/utils/normalizeInferenceProviderMapping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,wBAAwB,CAAC;AAEpF;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAChD,SAAS,EAAE,MAAM,EACjB,wBAAwB,CAAC,EACtB,qCAAqC,EAAE,GACvC,MAAM,CAAC,MAAM,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,GACrF,qCAAqC,EAAE,CAqBzC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/omit.d.ts b/node_modules/@huggingface/hub/dist/src/utils/omit.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..131e4d9f9406b8ebc3190b712141be127d7b2445 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/omit.d.ts @@ -0,0 +1,5 @@ +/** + * Return copy of object, omitting blacklisted array of props + */ +export declare function omit, K extends keyof T>(o: T, props: K[] | K): Pick>; +//# sourceMappingURL=omit.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/omit.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/omit.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..f921f39722761d48dd1135985e7bd6ca20a232c3 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/omit.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"omit.d.ts","sourceRoot":"","sources":["../../../src/utils/omit.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,EACxE,CAAC,EAAE,CAAC,EACJ,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,GACZ,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAI9B"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/parseLinkHeader.d.ts b/node_modules/@huggingface/hub/dist/src/utils/parseLinkHeader.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..63c5d9becba662bd7ba37e9beb205a61ee3d995f --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/parseLinkHeader.d.ts @@ -0,0 +1,5 @@ +/** + * Parse Link HTTP header, eg `; rel="next"` + */ +export declare function parseLinkHeader(header: string): Record; +//# sourceMappingURL=parseLinkHeader.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/parseLinkHeader.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/parseLinkHeader.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..32793a7ff82c66134a054e75eca37a38b9bdc694 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/parseLinkHeader.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parseLinkHeader.d.ts","sourceRoot":"","sources":["../../../src/utils/parseLinkHeader.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAItE"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/pick.d.ts b/node_modules/@huggingface/hub/dist/src/utils/pick.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..263f5eea8d53d5aec52cae6143fc9d1f27fbba1d --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/pick.d.ts @@ -0,0 +1,5 @@ +/** + * Return copy of object, only keeping whitelisted properties. + */ +export declare function pick(o: T, props: K[] | ReadonlyArray): Pick; +//# sourceMappingURL=pick.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/pick.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/pick.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..0ea81b4da845f65ccce0ceb28d60fff5e33ba7bf --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/pick.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pick.d.ts","sourceRoot":"","sources":["../../../src/utils/pick.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAS1F"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/promisesQueue.d.ts b/node_modules/@huggingface/hub/dist/src/utils/promisesQueue.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9f6a9d15a5989ed0f03f81737167ecaae75102bc --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/promisesQueue.d.ts @@ -0,0 +1,7 @@ +/** + * Execute queue of promises. + * + * Inspired by github.com/rxaviers/async-pool + */ +export declare function promisesQueue(factories: (() => Promise)[], concurrency: number): Promise; +//# sourceMappingURL=promisesQueue.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/promisesQueue.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/promisesQueue.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..69d485dfe767ec32ba609cf24babafa2a7205280 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/promisesQueue.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"promisesQueue.d.ts","sourceRoot":"","sources":["../../../src/utils/promisesQueue.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAiBzG"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/promisesQueue.spec.d.ts b/node_modules/@huggingface/hub/dist/src/utils/promisesQueue.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..34dcd72d62f718a8a7343dcdbcf05cf8073a8941 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/promisesQueue.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=promisesQueue.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/promisesQueue.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/promisesQueue.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..cfe1a6213806b3ed46a7601a8c39b14c6693aa9e --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/promisesQueue.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"promisesQueue.spec.d.ts","sourceRoot":"","sources":["../../../src/utils/promisesQueue.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/promisesQueueStreaming.d.ts b/node_modules/@huggingface/hub/dist/src/utils/promisesQueueStreaming.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f2a7e3d6b659b85c33452a7bc55f7a4bd835bb5a --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/promisesQueueStreaming.d.ts @@ -0,0 +1,11 @@ +/** + * Execute queue of promises in a streaming fashion. + * + * Optimized for streaming: + * - Expects an iterable as input + * - Does not return a list of all results + * + * Inspired by github.com/rxaviers/async-pool + */ +export declare function promisesQueueStreaming(factories: AsyncIterable<() => Promise> | Iterable<() => Promise>, concurrency: number): Promise; +//# sourceMappingURL=promisesQueueStreaming.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/promisesQueueStreaming.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/promisesQueueStreaming.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..122e476a2ec906ed1fd2c815d1d2ab2ed95e383e --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/promisesQueueStreaming.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"promisesQueueStreaming.d.ts","sourceRoot":"","sources":["../../../src/utils/promisesQueueStreaming.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAAC,CAAC,EAC7C,SAAS,EAAE,aAAa,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EACvE,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAYf"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/range.d.ts b/node_modules/@huggingface/hub/dist/src/utils/range.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb4f113f7e4dedaa552f82ef826c650bee0932ca --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/range.d.ts @@ -0,0 +1,6 @@ +/** + * One param: create list of integers from 0 (inclusive) to n (exclusive) + * Two params: create list of integers from a (inclusive) to b (exclusive) + */ +export declare function range(n: number, b?: number): number[]; +//# sourceMappingURL=range.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/range.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/range.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..ae3ed0568677ff5deb9da878250e3d8961513ccb --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/range.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../../src/utils/range.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAQrD"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/sha256-node.d.ts b/node_modules/@huggingface/hub/dist/src/utils/sha256-node.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..64c666ae2771e2f16450eb97d7553ce8aaff5d02 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/sha256-node.d.ts @@ -0,0 +1,4 @@ +export declare function sha256Node(buffer: ArrayBuffer | Blob, opts?: { + abortSignal?: AbortSignal; +}): AsyncGenerator; +//# sourceMappingURL=sha256-node.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/sha256-node.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/sha256-node.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..208ca3e88b6ce69fe378aadc4e401db1b468ddc6 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/sha256-node.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sha256-node.d.ts","sourceRoot":"","sources":["../../../src/utils/sha256-node.ts"],"names":[],"mappings":"AAIA,wBAAuB,UAAU,CAChC,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,IAAI,CAAC,EAAE;IACN,WAAW,CAAC,EAAE,WAAW,CAAC;CAC1B,GACC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBhC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/sha256.d.ts b/node_modules/@huggingface/hub/dist/src/utils/sha256.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ff8e7ac961d5db66f81781189ecb0df563ce341f --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/sha256.d.ts @@ -0,0 +1,12 @@ +/** + * @returns hex-encoded sha + * @yields progress (0-1) + */ +export declare function sha256(buffer: Blob, opts?: { + useWebWorker?: boolean | { + minSize?: number; + poolSize?: number; + }; + abortSignal?: AbortSignal; +}): AsyncGenerator; +//# sourceMappingURL=sha256.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/sha256.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/sha256.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..c9fab8e218016e2c3c35312b7f56a03bb7f30ca7 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/sha256.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sha256.d.ts","sourceRoot":"","sources":["../../../src/utils/sha256.ts"],"names":[],"mappings":"AAmEA;;;GAGG;AACH,wBAAuB,MAAM,CAC5B,MAAM,EAAE,IAAI,EACZ,IAAI,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,OAAO,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,WAAW,CAAC,EAAE,WAAW,CAAA;CAAE,GACpG,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CA8HhC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/sha256.spec.d.ts b/node_modules/@huggingface/hub/dist/src/utils/sha256.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f8113753430e5bac2b71d036748c666904ce676 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/sha256.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=sha256.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/sha256.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/sha256.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..5b7d9a4c4c2d5167f96b864fe6fd3b3e30205223 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/sha256.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sha256.spec.d.ts","sourceRoot":"","sources":["../../../src/utils/sha256.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/shardParser.d.ts b/node_modules/@huggingface/hub/dist/src/utils/shardParser.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a25ad37be5bfe0afa6efd66a461234a9f58ad9f1 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/shardParser.d.ts @@ -0,0 +1,13 @@ +export interface ShardData { + hmacKey: string; + xorbs: Array<{ + hash: string; + chunks: Array<{ + hash: string; + startOffset: number; + unpackedLength: number; + }>; + }>; +} +export declare function parseShardData(shardBlob: Blob): Promise; +//# sourceMappingURL=shardParser.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/shardParser.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/shardParser.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..472cf769dad7fb8e92ff9a940b475f3dcaad0a8e --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/shardParser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"shardParser.d.ts","sourceRoot":"","sources":["../../../src/utils/shardParser.ts"],"names":[],"mappings":"AAsBA,MAAM,WAAW,SAAS;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,KAAK,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;YACb,WAAW,EAAE,MAAM,CAAC;YACpB,cAAc,EAAE,MAAM,CAAC;SACvB,CAAC,CAAC;KACH,CAAC,CAAC;CACH;AAED,wBAAsB,cAAc,CAAC,SAAS,EAAE,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,CAkHxE"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/shardParser.spec.d.ts b/node_modules/@huggingface/hub/dist/src/utils/shardParser.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cef9dc426a38e6e434abe3478ad726a0eea696ea --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/shardParser.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=shardParser.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/shardParser.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/shardParser.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..0ecbe9928efae0f83114d2faff85cb8ca4a2daeb --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/shardParser.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"shardParser.spec.d.ts","sourceRoot":"","sources":["../../../src/utils/shardParser.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/splitAsyncGenerator.d.ts b/node_modules/@huggingface/hub/dist/src/utils/splitAsyncGenerator.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fbec9588e8b793a345be6d2338bdb540e3c73474 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/splitAsyncGenerator.d.ts @@ -0,0 +1,5 @@ +/** + * Split an async generator into multiple async generators, all drawing from the same source. + */ +export declare function splitAsyncGenerator(source: AsyncGenerator, n: number): Array>; +//# sourceMappingURL=splitAsyncGenerator.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/splitAsyncGenerator.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/splitAsyncGenerator.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..5bd217c94a64b2dfeccc9de5d40a2f400cc48a69 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/splitAsyncGenerator.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"splitAsyncGenerator.d.ts","sourceRoot":"","sources":["../../../src/utils/splitAsyncGenerator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAuCrG"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/sub-paths.d.ts b/node_modules/@huggingface/hub/dist/src/utils/sub-paths.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..67a5958cb6a4f67d3bdc8ae942e42bd7580a54ec --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/sub-paths.d.ts @@ -0,0 +1,8 @@ +/** + * Recursively retrieves all sub-paths of a given directory up to a specified depth. + */ +export declare function subPaths(path: URL, maxDepth?: number): Promise>; +//# sourceMappingURL=sub-paths.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/sub-paths.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/sub-paths.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..6bd4d8d0c30e7c6ccb76659278e1ec9504a2463d --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/sub-paths.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sub-paths.d.ts","sourceRoot":"","sources":["../../../src/utils/sub-paths.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,QAAQ,CAC7B,IAAI,EAAE,GAAG,EACT,QAAQ,SAAK,GACX,OAAO,CACT,KAAK,CAAC;IACL,IAAI,EAAE,GAAG,CAAC;IACV,YAAY,EAAE,MAAM,CAAC;CACrB,CAAC,CACF,CAuBA"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/sub-paths.spec.d.ts b/node_modules/@huggingface/hub/dist/src/utils/sub-paths.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..56526ea3edaf4e9c68b422b7e05f7ddc05b5496b --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/sub-paths.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=sub-paths.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/sub-paths.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/sub-paths.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..96337009bb1ed3b6d01c12f0a18b6e11bff10b4f --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/sub-paths.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sub-paths.spec.d.ts","sourceRoot":"","sources":["../../../src/utils/sub-paths.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/sum.d.ts b/node_modules/@huggingface/hub/dist/src/utils/sum.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2938657fe7ad469a00bb6c9746352594b4e9d2fe --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/sum.d.ts @@ -0,0 +1,5 @@ +/** + * Sum of elements in array + */ +export declare function sum(arr: number[]): number; +//# sourceMappingURL=sum.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/sum.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/sum.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7752efe0d45ab8028279894b920d0a7a3149d1bf --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/sum.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sum.d.ts","sourceRoot":"","sources":["../../../src/utils/sum.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,CAEzC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/symlink.d.ts b/node_modules/@huggingface/hub/dist/src/utils/symlink.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ead0f37bf2ff381400dd6ba2ee13db69fa8a2817 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/symlink.d.ts @@ -0,0 +1,38 @@ +/** + * Heavily inspired by https://github.com/huggingface/huggingface_hub/blob/fcfd14361bd03f23f82efced1aa65a7cbfa4b922/src/huggingface_hub/file_download.py#L517 + */ +/** + * Create a symbolic link named dst pointing to src. + * + * By default, it will try to create a symlink using a relative path. Relative paths have 2 advantages: + * - If the cache_folder is moved (example: back-up on a shared drive), relative paths within the cache folder will + * not break. + * - Relative paths seems to be better handled on Windows. Issue was reported 3 times in less than a week when + * changing from relative to absolute paths. See https://github.com/huggingface/huggingface_hub/issues/1398, + * https://github.com/huggingface/diffusers/issues/2729 and https://github.com/huggingface/transformers/pull/22228. + * NOTE: The issue with absolute paths doesn't happen on admin mode. + * When creating a symlink from the cache to a local folder, it is possible that a relative path cannot be created. + * This happens when paths are not on the same volume. In that case, we use absolute paths. + * + * The result layout looks something like + * └── [ 128] snapshots + * ├── [ 128] 2439f60ef33a0d46d85da5001d52aeda5b00ce9f + * │ ├── [ 52] README.md -> ../../../blobs/d7edf6bd2a681fb0175f7735299831ee1b22b812 + * │ └── [ 76] pytorch_model.bin -> ../../../blobs/403450e234d65943a7dcf7e05a771ce3c92faa84dd07db4ac20f592037a1e4bd + * + * If symlinks cannot be created on this platform (most likely to be Windows), the workaround is to avoid symlinks by + * having the actual file in `dst`. If it is a new file (`new_blob=True`), we move it to `dst`. If it is not a new file + * (`new_blob=False`), we don't know if the blob file is already referenced elsewhere. To avoid breaking existing + * cache, the file is duplicated on the disk. + */ +export declare function createSymlink(params: { + /** + * The path to the symlink. + */ + finalPath: string; + /** + * The path the symlink should point to. + */ + sourcePath: string; +}): Promise; +//# sourceMappingURL=symlink.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/symlink.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/symlink.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..198f26130e63ea4d89a084f208672d1a1a16884b --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/symlink.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"symlink.d.ts","sourceRoot":"","sources":["../../../src/utils/symlink.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE;IAC3C;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBhB"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/symlink.spec.d.ts b/node_modules/@huggingface/hub/dist/src/utils/symlink.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..84af2aadfaf2cdecc028476e26cfdaf9372f47a6 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/symlink.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=symlink.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/symlink.spec.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/symlink.spec.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..75ef4b18596ce4e5f1bdaa9b2550ea8140f481a1 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/symlink.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"symlink.spec.d.ts","sourceRoot":"","sources":["../../../src/utils/symlink.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/toRepoId.d.ts b/node_modules/@huggingface/hub/dist/src/utils/toRepoId.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f633788be346a4e3954687933a336dc3a6f58cec --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/toRepoId.d.ts @@ -0,0 +1,3 @@ +import type { RepoDesignation, RepoId } from "../types/public"; +export declare function toRepoId(repo: RepoDesignation): RepoId; +//# sourceMappingURL=toRepoId.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/toRepoId.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/toRepoId.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..b6b0fdd3751ff3b3bc1607d0b2ad668e6de7e33d --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/toRepoId.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"toRepoId.d.ts","sourceRoot":"","sources":["../../../src/utils/toRepoId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE/D,wBAAgB,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAkEtD"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/typedEntries.d.ts b/node_modules/@huggingface/hub/dist/src/utils/typedEntries.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a6f0116ecba6e1afd76c415e5c2bd0826754776c --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/typedEntries.d.ts @@ -0,0 +1,5 @@ +import type { Entries } from "../vendor/type-fest/entries"; +export declare function typedEntries>(obj: T): Entries; +//# sourceMappingURL=typedEntries.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/typedEntries.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/typedEntries.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..d84b2b6c5d05414c37d268af991b7762841afea8 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/typedEntries.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"typedEntries.d.ts","sourceRoot":"","sources":["../../../src/utils/typedEntries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAE3D,wBAAgB,YAAY,CAAC,CAAC,SAAS;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAE9G"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/typedInclude.d.ts b/node_modules/@huggingface/hub/dist/src/utils/typedInclude.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..18fcc761228d7347ac431d408cd967cdb1f60c47 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/typedInclude.d.ts @@ -0,0 +1,2 @@ +export declare function typedInclude(arr: readonly T[], v: V): v is T; +//# sourceMappingURL=typedInclude.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/typedInclude.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/typedInclude.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..4512a06ceb2dca2c2c3207dc352faef3e3099512 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/typedInclude.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"typedInclude.d.ts","sourceRoot":"","sources":["../../../src/utils/typedInclude.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAE5E"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/uploadShards.d.ts b/node_modules/@huggingface/hub/dist/src/utils/uploadShards.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4d2ab81aecc77c89030728efa3caa1869bdb9e36 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/uploadShards.d.ts @@ -0,0 +1,45 @@ +import type { RepoId } from "../types/public"; +export declare const SHARD_HEADER_VERSION = 2n; +export declare const SHARD_FOOTER_VERSION = 1n; +export declare const SHARD_MAGIC_TAG: Uint8Array; +export interface XetTokenParams { + sessionId?: string; + casUrl?: string; + accessToken?: string; + expiresAt?: Date; + refreshWriteTokenUrl: string; +} +interface UploadShardsParams { + accessToken: string | undefined; + hubUrl: string; + xetParams: XetTokenParams; + fetch?: typeof fetch; + repo: RepoId; + rev: string; + isPullRequest?: boolean; + yieldCallback?: (event: { + event: "fileProgress"; + path: string; + progress: number; + }) => void; +} +/** + * Outputs the file sha256 after their xorbs/shards have been uploaded. + */ +export declare function uploadShards(source: AsyncGenerator<{ + content: Blob; + path: string; + sha256?: string; +}>, params: UploadShardsParams): AsyncGenerator<{ + event: "file"; + path: string; + xetHash: string; + sha256: string | undefined; + dedupRatio: number; +} | { + event: "fileProgress"; + path: string; + progress: number; +}>; +export {}; +//# sourceMappingURL=uploadShards.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/uploadShards.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/uploadShards.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..f3360a173f5c940d171aa4736fc9d505959a6c49 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/uploadShards.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"uploadShards.d.ts","sourceRoot":"","sources":["../../../src/utils/uploadShards.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAW9C,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAOvC,eAAO,MAAM,eAAe,yBAiC1B,CAAC;AAEH,MAAM,WAAW,cAAc;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;CAC7B;AAED,UAAU,kBAAkB;IAC3B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,cAAc,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,cAAc,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAC3F;AAED;;GAEG;AACH,wBAAuB,YAAY,CAClC,MAAM,EAAE,cAAc,CAAC;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EACxE,MAAM,EAAE,kBAAkB,GACxB,cAAc,CACd;IACA,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CAClB,GACD;IAAE,KAAK,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAC3D,CAiRA"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/xetWriteToken.d.ts b/node_modules/@huggingface/hub/dist/src/utils/xetWriteToken.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0d91b92d45f85d8e96a5281862bd53049fafa928 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/xetWriteToken.d.ts @@ -0,0 +1,11 @@ +import type { XetTokenParams } from "./uploadShards"; +export interface XetWriteTokenParams { + accessToken: string | undefined; + fetch?: typeof fetch; + xetParams: XetTokenParams; +} +export declare function xetWriteToken(params: XetWriteTokenParams): Promise<{ + accessToken: string; + casUrl: string; +}>; +//# sourceMappingURL=xetWriteToken.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/utils/xetWriteToken.d.ts.map b/node_modules/@huggingface/hub/dist/src/utils/xetWriteToken.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..c65476dc0e46629814ec3b88fb2bad4d24196a04 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/utils/xetWriteToken.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"xetWriteToken.d.ts","sourceRoot":"","sources":["../../../src/utils/xetWriteToken.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,WAAW,mBAAmB;IACnC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,SAAS,EAAE,cAAc,CAAC;CAC1B;AAkBD,wBAAsB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAwEjH"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/hash-wasm/sha256-wrapper.d.ts b/node_modules/@huggingface/hub/dist/src/vendor/hash-wasm/sha256-wrapper.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5abd70c5ba17fbeaa88ceff3ed5d65d737e425cd --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/hash-wasm/sha256-wrapper.d.ts @@ -0,0 +1,7 @@ +export declare function createSHA256(isInsideWorker?: boolean): Promise<{ + init(): void; + update(data: Uint8Array): void; + digest(method: "hex"): string; +}>; +export declare function createSHA256WorkerCode(): string; +//# sourceMappingURL=sha256-wrapper.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/hash-wasm/sha256-wrapper.d.ts.map b/node_modules/@huggingface/hub/dist/src/vendor/hash-wasm/sha256-wrapper.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..8f093a79f4f5eae87c5881fe0ae4387f9cfa81db --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/hash-wasm/sha256-wrapper.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sha256-wrapper.d.ts","sourceRoot":"","sources":["../../../../src/vendor/hash-wasm/sha256-wrapper.ts"],"names":[],"mappings":"AAEA,wBAAsB,YAAY,CAAC,cAAc,UAAQ,GAAG,OAAO,CAAC;IACnE,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;CAC9B,CAAC,CA8BD;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CAuB/C"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/lz4js/index.d.ts b/node_modules/@huggingface/hub/dist/src/vendor/lz4js/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d7234eb842a5738c47a26b1ebe0d9a92b6565e38 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/lz4js/index.d.ts @@ -0,0 +1,9 @@ +export declare function compressBound(n: number): number; +export declare function decompressBound(src: Uint8Array): number; +export declare function decompressBlock(src: Uint8Array, dst: Uint8Array, sIndex: number, sLength: number, dIndex: number): number; +export declare function compressBlock(src: Uint8Array, dst: Uint8Array, sIndex: number, sLength: number, hashTable: Uint32Array | number[]): number; +export declare function decompressFrame(src: Uint8Array, dst: Uint8Array): number; +export declare function compressFrame(src: Uint8Array, dst: Uint8Array): number; +export declare function decompress(src: Uint8Array, maxSize: number): Uint8Array; +export declare function compress(src: Uint8Array, maxSize?: number): Uint8Array; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/lz4js/index.d.ts.map b/node_modules/@huggingface/hub/dist/src/vendor/lz4js/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..b62f63cbbd71b0db8af0dd62c144d4dadce44b90 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/lz4js/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/vendor/lz4js/index.ts"],"names":[],"mappings":"AA8FA,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,UAEtC;AAGD,wBAAgB,eAAe,CAAC,GAAG,EAAE,UAAU,UA8D9C;AAGD,wBAAgB,eAAe,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAuEhH;AAGD,wBAAgB,aAAa,CAC5B,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,UAAU,EACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,WAAW,GAAG,MAAM,EAAE,UAgHjC;AAGD,wBAAgB,eAAe,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,UA6E/D;AAGD,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,UA2D7D;AAKD,wBAAgB,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,2BAc1D;AAKD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,2BAezD"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/lz4js/util.d.ts b/node_modules/@huggingface/hub/dist/src/vendor/lz4js/util.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6cb832d0cc53fbd05a1c374d3ab487b55cf0075f --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/lz4js/util.d.ts @@ -0,0 +1,6 @@ +export declare function hashU32(a: number): number; +export declare function readU64(b: Uint8Array, n: number): number; +export declare function readU32(b: Uint8Array, n: number): number; +export declare function writeU32(b: Uint8Array, n: number, x: number): void; +export declare function imul(a: number, b: number): number; +//# sourceMappingURL=util.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/lz4js/util.d.ts.map b/node_modules/@huggingface/hub/dist/src/vendor/lz4js/util.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..4881104c4e19850b7c8a3d4275b12f69b17006c5 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/lz4js/util.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/vendor/lz4js/util.ts"],"names":[],"mappings":"AAEA,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAQzC;AAGD,wBAAgB,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAWxD;AAGD,wBAAgB,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAOxD;AAGD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAKlE;AAID,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAOjD"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/lz4js/xxh32.d.ts b/node_modules/@huggingface/hub/dist/src/vendor/lz4js/xxh32.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a99c38224ea73de8171588fc034d3cdaf4505cd8 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/lz4js/xxh32.d.ts @@ -0,0 +1,4 @@ +declare function xxh32(seed: number, src: Uint8Array, index: number, len: number): number; +export declare const hash: typeof xxh32; +export {}; +//# sourceMappingURL=xxh32.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/lz4js/xxh32.d.ts.map b/node_modules/@huggingface/hub/dist/src/vendor/lz4js/xxh32.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..c8f48fd66fd4709107d7ffb9f09b38150a8eea3a --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/lz4js/xxh32.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"xxh32.d.ts","sourceRoot":"","sources":["../../../../src/vendor/lz4js/xxh32.ts"],"names":[],"mappings":"AA0DA,iBAAS,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAmChF;AAED,eAAO,MAAM,IAAI,cAAQ,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/type-fest/basic.d.ts b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/basic.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..563bf416b94e4e2537bf9d16cca53b16e75c2ffc --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/basic.d.ts @@ -0,0 +1,33 @@ +/** +Matches a JSON object. + +This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`. + +@category JSON +*/ +export type JsonObject = { + [Key in string]: JsonValue; +} & { + [Key in string]?: JsonValue | undefined; +}; +/** +Matches a JSON array. + +@category JSON +*/ +export type JsonArray = JsonValue[] | readonly JsonValue[]; +/** +Matches any valid JSON primitive value. + +@category JSON +*/ +export type JsonPrimitive = string | number | boolean | null; +/** +Matches any valid JSON value. + +@see `Jsonify` if you need to transform a type to one that is assignable to `JsonValue`. + +@category JSON +*/ +export type JsonValue = JsonPrimitive | JsonObject | JsonArray; +//# sourceMappingURL=basic.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/type-fest/basic.d.ts.map b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/basic.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..a331b50d25c11e92c8a89e9ee1bce19c2c95ed7b --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/basic.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../../../src/vendor/type-fest/basic.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AACF,MAAM,MAAM,UAAU,GAAG;KAAG,GAAG,IAAI,MAAM,GAAG,SAAS;CAAE,GAAG;KAAG,GAAG,IAAI,MAAM,CAAC,CAAC,EAAE,SAAS,GAAG,SAAS;CAAE,CAAC;AAEtG;;;;EAIE;AACF,MAAM,MAAM,SAAS,GAAG,SAAS,EAAE,GAAG,SAAS,SAAS,EAAE,CAAC;AAE3D;;;;EAIE;AACF,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE7D;;;;;;EAME;AACF,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/type-fest/entries.d.ts b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/entries.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..400567db2d5865d041eab92aac280623c2203f48 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/entries.d.ts @@ -0,0 +1,57 @@ +import type { ArrayEntry, MapEntry, ObjectEntry, SetEntry } from "./entry"; +type ArrayEntries = Array>; +type MapEntries = Array>; +type ObjectEntries = Array>; +type SetEntries> = Array>; +/** +Many collections have an `entries` method which returns an array of a given object's own enumerable string-keyed property [key, value] pairs. The `Entries` type will return the type of that collection's entries. + +For example the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`}, and {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`} collections all have this method. Note that `WeakMap` and `WeakSet` do not have this method since their entries are not enumerable. + +@see `Entry` if you want to just access the type of a single entry. + +@example +``` +import type {Entries} from 'type-fest'; + +interface Example { + someKey: number; +} + +const manipulatesEntries = (examples: Entries) => examples.map(example => [ + // Does some arbitrary processing on the key (with type information available) + example[0].toUpperCase(), + + // Does some arbitrary processing on the value (with type information available) + example[1].toFixed() +]); + +const example: Example = {someKey: 1}; +const entries = Object.entries(example) as Entries; +const output = manipulatesEntries(entries); + +// Objects +const objectExample = {a: 1}; +const objectEntries: Entries = [['a', 1]]; + +// Arrays +const arrayExample = ['a', 1]; +const arrayEntries: Entries = [[0, 'a'], [1, 1]]; + +// Maps +const mapExample = new Map([['a', 1]]); +const mapEntries: Entries = [['a', 1]]; + +// Sets +const setExample = new Set(['a', 1]); +const setEntries: Entries = [['a', 'a'], [1, 1]]; +``` + +@category Object +@category Map +@category Set +@category Array +*/ +export type Entries = BaseType extends Map ? MapEntries : BaseType extends Set ? SetEntries : BaseType extends readonly unknown[] ? ArrayEntries : BaseType extends object ? ObjectEntries : never; +export {}; +//# sourceMappingURL=entries.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/type-fest/entries.d.ts.map b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/entries.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..a225268a8eed76c85b076d1c289b470f51fe1352 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/entries.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"entries.d.ts","sourceRoot":"","sources":["../../../../src/vendor/type-fest/entries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE3E,KAAK,YAAY,CAAC,QAAQ,SAAS,SAAS,OAAO,EAAE,IAAI,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;AACrF,KAAK,UAAU,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtD,KAAK,aAAa,CAAC,QAAQ,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5D,KAAK,UAAU,CAAC,QAAQ,SAAS,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgDE;AACF,MAAM,MAAM,OAAO,CAAC,QAAQ,IAC3B,QAAQ,SAAS,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,GACnC,UAAU,CAAC,QAAQ,CAAC,GACpB,QAAQ,SAAS,GAAG,CAAC,OAAO,CAAC,GAC5B,UAAU,CAAC,QAAQ,CAAC,GACpB,QAAQ,SAAS,SAAS,OAAO,EAAE,GAClC,YAAY,CAAC,QAAQ,CAAC,GACtB,QAAQ,SAAS,MAAM,GACtB,aAAa,CAAC,QAAQ,CAAC,GACvB,KAAK,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/type-fest/entry.d.ts b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/entry.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8b3a5f48de6771db03dd5df3223a24267ec3f2bc --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/entry.d.ts @@ -0,0 +1,60 @@ +type MapKey = BaseType extends Map ? KeyType : never; +type MapValue = BaseType extends Map ? ValueType : never; +export type ArrayEntry = [number, BaseType[number]]; +export type MapEntry = [MapKey, MapValue]; +export type ObjectEntry = [keyof BaseType, BaseType[keyof BaseType]]; +export type SetEntry = BaseType extends Set ? [ItemType, ItemType] : never; +/** +Many collections have an `entries` method which returns an array of a given object's own enumerable string-keyed property [key, value] pairs. The `Entry` type will return the type of that collection's entry. + +For example the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`}, and {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`} collections all have this method. Note that `WeakMap` and `WeakSet` do not have this method since their entries are not enumerable. + +@see `Entries` if you want to just access the type of the array of entries (which is the return of the `.entries()` method). + +@example +``` +import type {Entry} from 'type-fest'; + +interface Example { + someKey: number; +} + +const manipulatesEntry = (example: Entry) => [ + // Does some arbitrary processing on the key (with type information available) + example[0].toUpperCase(), + + // Does some arbitrary processing on the value (with type information available) + example[1].toFixed(), +]; + +const example: Example = {someKey: 1}; +const entry = Object.entries(example)[0] as Entry; +const output = manipulatesEntry(entry); + +// Objects +const objectExample = {a: 1}; +const objectEntry: Entry = ['a', 1]; + +// Arrays +const arrayExample = ['a', 1]; +const arrayEntryString: Entry = [0, 'a']; +const arrayEntryNumber: Entry = [1, 1]; + +// Maps +const mapExample = new Map([['a', 1]]); +const mapEntry: Entry = ['a', 1]; + +// Sets +const setExample = new Set(['a', 1]); +const setEntryString: Entry = ['a', 'a']; +const setEntryNumber: Entry = [1, 1]; +``` + +@category Object +@category Map +@category Array +@category Set +*/ +export type Entry = BaseType extends Map ? MapEntry : BaseType extends Set ? SetEntry : BaseType extends readonly unknown[] ? ArrayEntry : BaseType extends object ? ObjectEntry : never; +export {}; +//# sourceMappingURL=entry.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/type-fest/entry.d.ts.map b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/entry.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..f9c31621eaf9ef1ded5fc674b32f40737f78b6ae --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/entry.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../../../src/vendor/type-fest/entry.ts"],"names":[],"mappings":"AAAA,KAAK,MAAM,CAAC,QAAQ,IAAI,QAAQ,SAAS,GAAG,CAAC,MAAM,OAAO,EAAE,OAAO,CAAC,GAAG,OAAO,GAAG,KAAK,CAAC;AACvF,KAAK,QAAQ,CAAC,QAAQ,IAAI,QAAQ,SAAS,GAAG,CAAC,OAAO,EAAE,MAAM,SAAS,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC;AAE7F,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,SAAS,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AACzF,MAAM,MAAM,QAAQ,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AACxE,MAAM,MAAM,WAAW,CAAC,QAAQ,IAAI,CAAC,MAAM,QAAQ,EAAE,QAAQ,CAAC,MAAM,QAAQ,CAAC,CAAC,CAAC;AAC/E,MAAM,MAAM,QAAQ,CAAC,QAAQ,IAAI,QAAQ,SAAS,GAAG,CAAC,MAAM,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC;AAErG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkDE;AACF,MAAM,MAAM,KAAK,CAAC,QAAQ,IACzB,QAAQ,SAAS,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,GACnC,QAAQ,CAAC,QAAQ,CAAC,GAClB,QAAQ,SAAS,GAAG,CAAC,OAAO,CAAC,GAC5B,QAAQ,CAAC,QAAQ,CAAC,GAClB,QAAQ,SAAS,SAAS,OAAO,EAAE,GAClC,UAAU,CAAC,QAAQ,CAAC,GACpB,QAAQ,SAAS,MAAM,GACtB,WAAW,CAAC,QAAQ,CAAC,GACrB,KAAK,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/type-fest/except.d.ts b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/except.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6086c8f26a8e3766ec2ff7c8a3649b2a9365fba7 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/except.d.ts @@ -0,0 +1,67 @@ +import type { IsEqual } from "./is-equal"; +/** +Filter out keys from an object. + +Returns `never` if `Exclude` is strictly equal to `Key`. +Returns `never` if `Key` extends `Exclude`. +Returns `Key` otherwise. + +@example +``` +type Filtered = Filter<'foo', 'foo'>; +//=> never +``` + +@example +``` +type Filtered = Filter<'bar', string>; +//=> never +``` + +@example +``` +type Filtered = Filter<'bar', 'foo'>; +//=> 'bar' +``` + +@see {Except} +*/ +type Filter = IsEqual extends true ? never : KeyType extends ExcludeType ? never : KeyType; +/** +Create a type from an object type without certain keys. + +We recommend setting the `requireExactProps` option to `true`. + +This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically. + +This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)). + +@example +``` +import type {Except} from 'type-fest'; + +type Foo = { + a: number; + b: string; +}; + +type FooWithoutA = Except; +//=> {b: string} + +const fooWithoutA: FooWithoutA = {a: 1, b: '2'}; +//=> errors: 'a' does not exist in type '{ b: string; }' + +type FooWithoutB = Except; +//=> {a: number} & Partial> + +const fooWithoutB: FooWithoutB = {a: 1, b: '2'}; +//=> errors at 'b': Type 'string' is not assignable to type 'undefined'. +``` + +@category Object +*/ +export type Except = { + [KeyType in keyof ObjectType as Filter]: ObjectType[KeyType]; +}; +export {}; +//# sourceMappingURL=except.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/type-fest/except.d.ts.map b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/except.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..f8626d74797a3a748c421a8125bb0477587591b3 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/except.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"except.d.ts","sourceRoot":"","sources":["../../../../src/vendor/type-fest/except.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BE;AACF,KAAK,MAAM,CAAC,OAAO,EAAE,WAAW,IAC/B,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,SAAS,IAAI,GAAG,KAAK,GAAG,OAAO,SAAS,WAAW,GAAG,KAAK,GAAG,OAAO,CAAC;AAEpG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCE;AACF,MAAM,MAAM,MAAM,CAAC,UAAU,EAAE,QAAQ,SAAS,MAAM,UAAU,IAAI;KAClE,OAAO,IAAI,MAAM,UAAU,IAAI,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC;CAC/E,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/type-fest/is-equal.d.ts b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/is-equal.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..379e2bcde32c2f236ef6e29a1f9eef18b1e029d4 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/is-equal.d.ts @@ -0,0 +1,28 @@ +/** +Returns a boolean for whether the two given types are equal. + +@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650 +@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796 + +Use-cases: +- If you want to make a conditional branch based on the result of a comparison of two types. + +@example +``` +import type {IsEqual} from 'type-fest'; + +// This type returns a boolean for whether the given array includes the given item. +// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal. +type Includes = + Value extends readonly [Value[0], ...infer rest] + ? IsEqual extends true + ? true + : Includes + : false; +``` + +@category Type Guard +@category Utilities +*/ +export type IsEqual = (() => G extends A ? 1 : 2) extends () => G extends B ? 1 : 2 ? true : false; +//# sourceMappingURL=is-equal.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/type-fest/is-equal.d.ts.map b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/is-equal.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..4459d190f6c8e6fd72b602a418672b8cbd263e4a --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/is-equal.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"is-equal.d.ts","sourceRoot":"","sources":["../../../../src/vendor/type-fest/is-equal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;EAyBE;AACF,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/type-fest/set-required.d.ts b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/set-required.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a5db5b2e7bab99032aa7de0e1eac925a5e5a2f80 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/set-required.d.ts @@ -0,0 +1,29 @@ +import type { Except } from "./except"; +import type { Simplify } from "./simplify"; +/** +Create a type that makes the given keys required. The remaining keys are kept as is. The sister of the `SetOptional` type. + +Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required. + +@example +``` +import type {SetRequired} from 'type-fest'; + +type Foo = { + a?: number; + b: string; + c?: boolean; +} + +type SomeRequired = SetRequired; +// type SomeRequired = { +// a?: number; +// b: string; // Was already required and still is. +// c: boolean; // Is now required. +// } +``` + +@category Object +*/ +export type SetRequired = Simplify & Required>>; +//# sourceMappingURL=set-required.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/type-fest/set-required.d.ts.map b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/set-required.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..69f1d38f92b485da1d1b2f166e65668fbfac06a3 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/set-required.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"set-required.d.ts","sourceRoot":"","sources":["../../../../src/vendor/type-fest/set-required.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;EAwBE;AACF,MAAM,MAAM,WAAW,CAAC,QAAQ,EAAE,IAAI,SAAS,MAAM,QAAQ,IAAI,QAAQ,CAExE,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,GAErB,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAC/B,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/type-fest/simplify.d.ts b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/simplify.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1fd7581d344fef70c7c423e3ec805b7b604181ff --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/simplify.d.ts @@ -0,0 +1,61 @@ +/** +Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability. + +@example +``` +import type {Simplify} from 'type-fest'; + +type PositionProps = { + top: number; + left: number; +}; + +type SizeProps = { + width: number; + height: number; +}; + +// In your editor, hovering over `Props` will show a flattened object with all the properties. +type Props = Simplify; +``` + +Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface. + +If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify` if you can't re-declare the `value`. + +@example +``` +import type {Simplify} from 'type-fest'; + +interface SomeInterface { + foo: number; + bar?: string; + baz: number | undefined; +} + +type SomeType = { + foo: number; + bar?: string; + baz: number | undefined; +}; + +const literal = {foo: 123, bar: 'hello', baz: 456}; +const someType: SomeType = literal; +const someInterface: SomeInterface = literal; + +function fn(object: Record): void {} + +fn(literal); // Good: literal object type is sealed +fn(someType); // Good: type is sealed +fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened +fn(someInterface as Simplify); // Good: transform an `interface` into a `type` +``` + +@link https://github.com/microsoft/TypeScript/issues/15300 + +@category Object +*/ +export type Simplify = { + [KeyType in keyof T]: T[KeyType]; +} & {}; +//# sourceMappingURL=simplify.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/type-fest/simplify.d.ts.map b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/simplify.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..fdcf4ee12d0336ecd5d484fd90d1dd63c893f3c5 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/type-fest/simplify.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"simplify.d.ts","sourceRoot":"","sources":["../../../../src/vendor/type-fest/simplify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDE;AAEF,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;KAAG,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;CAAE,GAAG,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/xet-chunk/chunker_wasm.d.ts b/node_modules/@huggingface/hub/dist/src/vendor/xet-chunk/chunker_wasm.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5254467e432fc2b19703fd48bab862bdca4409b1 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/xet-chunk/chunker_wasm.d.ts @@ -0,0 +1,4 @@ +declare function init(): Promise; +export { init }; +export { compute_xorb_hash, compute_file_hash, Chunker, compute_verification_hash, compute_hmac, } from "./chunker_wasm_bg.js"; +//# sourceMappingURL=chunker_wasm.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/xet-chunk/chunker_wasm.d.ts.map b/node_modules/@huggingface/hub/dist/src/vendor/xet-chunk/chunker_wasm.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..fc7a1aa35282ce0a9335da33cc759c8481e68eb5 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/xet-chunk/chunker_wasm.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"chunker_wasm.d.ts","sourceRoot":"","sources":["../../../../src/vendor/xet-chunk/chunker_wasm.ts"],"names":[],"mappings":"AASA,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CA0CnC;AAID,OAAO,EAAE,IAAI,EAAE,CAAC;AAEhB,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EACjB,OAAO,EACP,yBAAyB,EACzB,YAAY,GACZ,MAAM,sBAAsB,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/xet-chunk/chunker_wasm_bg.wasm.base64.d.ts b/node_modules/@huggingface/hub/dist/src/vendor/xet-chunk/chunker_wasm_bg.wasm.base64.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c981ebe5d9e137046e18fa895dfb0fb15d37b2da --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/xet-chunk/chunker_wasm_bg.wasm.base64.d.ts @@ -0,0 +1,4 @@ +export declare const wasmBase64: string; +declare const wasmBinary: Uint8Array; +export { wasmBinary }; +//# sourceMappingURL=chunker_wasm_bg.wasm.base64.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/src/vendor/xet-chunk/chunker_wasm_bg.wasm.base64.d.ts.map b/node_modules/@huggingface/hub/dist/src/vendor/xet-chunk/chunker_wasm_bg.wasm.base64.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..58c78a5b69b8b5d4e544bcf8709ef26c6c272d81 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/src/vendor/xet-chunk/chunker_wasm_bg.wasm.base64.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"chunker_wasm_bg.wasm.base64.d.ts","sourceRoot":"","sources":["../../../../src/vendor/xet-chunk/chunker_wasm_bg.wasm.base64.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,UAAU,QA60CtB,CAAC;AACF,QAAA,MAAM,UAAU,yBAAoC,CAAC;AAIrD,OAAO,EAAE,UAAU,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/dist/sub-paths-JTJURQDM.mjs b/node_modules/@huggingface/hub/dist/sub-paths-JTJURQDM.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ee3facd93ef934717f1c0f8062eaf4c5794fde83 --- /dev/null +++ b/node_modules/@huggingface/hub/dist/sub-paths-JTJURQDM.mjs @@ -0,0 +1,30 @@ +import "./chunk-GAR7ORU2.mjs"; + +// src/utils/sub-paths.ts +import { readdir, stat } from "fs/promises"; +import { fileURLToPath, pathToFileURL } from "url"; +async function subPaths(path, maxDepth = 10) { + const state = await stat(path); + if (!state.isDirectory()) { + return [{ path, relativePath: "." }]; + } + const files = await readdir(path, { withFileTypes: true }); + const ret = []; + for (const file of files) { + const filePath = pathToFileURL(fileURLToPath(path) + "/" + file.name); + if (file.isDirectory()) { + ret.push( + ...(await subPaths(filePath, maxDepth - 1)).map((subPath) => ({ + ...subPath, + relativePath: `${file.name}/${subPath.relativePath}` + })) + ); + } else { + ret.push({ path: filePath, relativePath: file.name }); + } + } + return ret; +} +export { + subPaths +}; diff --git a/node_modules/@huggingface/hub/index.ts b/node_modules/@huggingface/hub/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..3bd16e178a03831ae8cbf9578aa6df4b8be5926d --- /dev/null +++ b/node_modules/@huggingface/hub/index.ts @@ -0,0 +1 @@ +export * from "./src"; diff --git a/node_modules/@huggingface/hub/package.json b/node_modules/@huggingface/hub/package.json new file mode 100644 index 0000000000000000000000000000000000000000..545699c244f6ff4bb17a3f57388bc3adae3835c9 --- /dev/null +++ b/node_modules/@huggingface/hub/package.json @@ -0,0 +1,74 @@ +{ + "name": "@huggingface/hub", + "version": "2.10.1", + "description": "Utilities to interact with the Hugging Face hub", + "keywords": [ + "api", + "client", + "face", + "hub", + "hugging", + "huggingface" + ], + "license": "MIT", + "author": "Hugging Face", + "repository": "https://github.com/huggingface/huggingface.js.git", + "bin": { + "hfjs": "./dist/cli.js" + }, + "source": "index.ts", + "files": [ + "dist", + "index.ts", + "src", + "tsconfig.json" + ], + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "browser": { + "./src/utils/sha256-node.ts": false, + "./src/utils/sub-paths.ts": false, + "./src/utils/FileBlob.ts": false, + "./src/lib/cache-management.ts": false, + "./src/lib/download-file-to-cache-dir.ts": false, + "./src/lib/snapshot-download.ts": false, + "./dist/index.js": "./dist/browser/index.js", + "./dist/index.mjs": "./dist/browser/index.mjs" + }, + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "require": "./dist/index.js", + "import": "./dist/index.mjs" + } + }, + "publishConfig": { + "access": "public" + }, + "dependencies": { + "@huggingface/tasks": "^0.19.85" + }, + "devDependencies": { + "@types/cli-progress": "^3.11.6" + }, + "optionalDependencies": { + "cli-progress": "^3.12.0" + }, + "engines": { + "node": ">=18" + }, + "scripts": { + "lint": "eslint --quiet --fix --ext .cjs,.ts .", + "lint:check": "eslint --ext .cjs,.ts .", + "format": "oxfmt .", + "format:check": "oxfmt --check .", + "build": "tsup && tsc --emitDeclarationOnly --declaration", + "test": "vitest run", + "test:browser": "vitest run --browser.name=chrome --browser.headless --config vitest-browser.config.mts", + "check": "tsc", + "build:xet-wasm": "./scripts/build-xet-wasm.sh -t bundler --clean", + "bench": "tsx scripts/bench.ts", + "debug-xet": "tsx scripts/debug-xet.ts" + } +} \ No newline at end of file diff --git a/node_modules/@huggingface/hub/src/consts.ts b/node_modules/@huggingface/hub/src/consts.ts new file mode 100644 index 0000000000000000000000000000000000000000..5d34e9caecf3f843e34c24f341de91f6c715f17e --- /dev/null +++ b/node_modules/@huggingface/hub/src/consts.ts @@ -0,0 +1 @@ +export const HUB_URL = "https://huggingface.co"; diff --git a/node_modules/@huggingface/hub/src/error.ts b/node_modules/@huggingface/hub/src/error.ts new file mode 100644 index 0000000000000000000000000000000000000000..9c3c675d8755f0f4f14d4786db9a809074df3b6e --- /dev/null +++ b/node_modules/@huggingface/hub/src/error.ts @@ -0,0 +1,49 @@ +import type { JsonObject } from "./vendor/type-fest/basic"; + +export async function createApiError( + response: Response, + opts?: { requestId?: string; message?: string }, +): Promise { + const error = new HubApiError(response.url, response.status, response.headers.get("X-Request-Id") ?? opts?.requestId); + + error.message = `Api error with status ${error.statusCode}${opts?.message ? `. ${opts.message}` : ""}`; + + const trailer = [`URL: ${error.url}`, error.requestId ? `Request ID: ${error.requestId}` : undefined] + .filter(Boolean) + .join(". "); + + if (response.headers.get("Content-Type")?.startsWith("application/json")) { + const json = await response.json(); + error.message = json.error || json.message || error.message; + if (json.error_description) { + error.message = error.message ? error.message + `: ${json.error_description}` : json.error_description; + } + error.data = json; + } else { + error.data = { message: await response.text() }; + } + + error.message += `. ${trailer}`; + + throw error; +} + +/** + * Error thrown when an API call to the Hugging Face Hub fails. + */ +export class HubApiError extends Error { + statusCode: number; + url: string; + requestId?: string; + data?: JsonObject; + + constructor(url: string, statusCode: number, requestId?: string, message?: string) { + super(message); + + this.statusCode = statusCode; + this.requestId = requestId; + this.url = url; + } +} + +export class InvalidApiResponseFormatError extends Error {} diff --git a/node_modules/@huggingface/hub/src/index.ts b/node_modules/@huggingface/hub/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..6e26804c37d48c5a086673ac3e5d1f377680291b --- /dev/null +++ b/node_modules/@huggingface/hub/src/index.ts @@ -0,0 +1,27 @@ +export * from "./lib"; +// Typescript 5 will add 'export type *' +export type { + AccessToken, + AccessTokenRole, + AuthType, + Credentials, + PipelineType, + RepoDesignation, + RepoFullName, + RepoId, + RepoType, + SpaceHardwareFlavor, + SpaceResourceConfig, + SpaceResourceRequirement, + SpaceRuntime, + SpaceSdk, + SpaceStage, +} from "./types/public"; +export { HubApiError, InvalidApiResponseFormatError } from "./error"; +export { HUB_URL } from "./consts"; +/** + * Only exported for E2Es convenience + */ +export { sha256 as __internal_sha256 } from "./utils/sha256"; +export { XetBlob as __internal_XetBlob } from "./utils/XetBlob"; +export type { XetReadToken } from "./utils/XetBlob"; diff --git a/node_modules/@huggingface/hub/src/lib/add-collection-item.spec.ts b/node_modules/@huggingface/hub/src/lib/add-collection-item.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..8261e2e9124dddc1e05afbc69e02af1976ca8604 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/add-collection-item.spec.ts @@ -0,0 +1,84 @@ +import { it, describe, expect } from "vitest"; + +import { TEST_HUB_URL, TEST_ACCESS_TOKEN, TEST_USER } from "../test/consts"; +import { addCollectionItem } from "./add-collection-item"; +import { collectionInfo } from "./collection-info"; +import { deleteCollectionItem } from "./delete-collection-item"; +import { createCollection } from "./create-collection"; +import { deleteCollection } from "./delete-collection"; + +describe("addCollectionItem", () => { + it("should add a item to a collection", async () => { + let slug: string = ""; + + const randomString = crypto.randomUUID(); + const title = `Test Collection ${randomString}`; + + try { + const result = await createCollection({ + collection: { + title, + namespace: TEST_USER, + description: "This is a test collection", + private: false, + }, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + + slug = result.slug; + + expect(result.slug.startsWith(`${TEST_USER}/test-collection-${randomString}`)).toBe(true); + + await addCollectionItem({ + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + slug, + item: { + type: "collection", + // temporary, later the slug should work on its own + id: result.slug.slice(-24), + }, + note: "This is a test item", + }); + + const items = await collectionInfo({ + slug, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + + expect(items.items.length).toBe(1); + expect(items.items[0].type).toBe("collection"); + // temporary, later the slug should work on its own right? + expect(items.items[0].id).toBe(result.slug.slice(-24)); + expect(items.items[0].note).toEqual({ + html: "This is a test item", + text: "This is a test item", + }); + + await deleteCollectionItem({ + slug, + itemId: items.items[0]._id, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + + const items2 = await collectionInfo({ + slug, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + + expect(items2.items.length).toBe(0); + } finally { + if (slug) { + await deleteCollection({ + slug, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + } + } + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/add-collection-item.ts b/node_modules/@huggingface/hub/src/lib/add-collection-item.ts new file mode 100644 index 0000000000000000000000000000000000000000..27e926bca96c31da836ede834400b7fbe6568fb6 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/add-collection-item.ts @@ -0,0 +1,51 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { CredentialsParams } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; + +export async function addCollectionItem( + params: { + /** + * The slug of the collection to add the item to. + */ + slug: string; + /** + * The item to add to the collection. + */ + item: { + type: "paper" | "collection" | "space" | "model" | "dataset"; + id: string; + }; + /** + * A note to attach to the item in the collection. The maximum size for a note is 500 characters. + */ + note?: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise { + if (!params.slug) { + throw new TypeError("slug is required"); + } + + const accessToken = checkCredentials(params); + + const res = await (params.fetch ?? fetch)(`${params.hubUrl ?? HUB_URL}/api/collections/${params.slug}/items`, { + method: "POST", + body: JSON.stringify({ + item: params.item, + note: params.note, + }), + headers: { + Authorization: `Bearer ${accessToken}`, + "Content-Type": "application/json", + }, + }); + + if (!res.ok) { + throw await createApiError(res); + } +} diff --git a/node_modules/@huggingface/hub/src/lib/cache-management.spec.ts b/node_modules/@huggingface/hub/src/lib/cache-management.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..a4a6544114b4851c24155b265445da0983ef9241 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/cache-management.spec.ts @@ -0,0 +1,139 @@ +import { describe, test, expect, vi, beforeEach } from "vitest"; +import { + scanCacheDir, + scanCachedRepo, + scanSnapshotDir, + parseRepoType, + getBlobStat, + type CachedFileInfo, +} from "./cache-management"; +import { stat, readdir, realpath, lstat } from "node:fs/promises"; +import type { Stats } from "node:fs"; +import { join } from "node:path"; + +// Mocks +vi.mock("node:fs/promises"); + +beforeEach(() => { + vi.resetAllMocks(); + vi.restoreAllMocks(); +}); + +describe("scanCacheDir", () => { + test("should throw an error if cacheDir is not a directory", async () => { + vi.mocked(stat).mockResolvedValueOnce({ + isDirectory: () => false, + } as Stats); + + await expect(scanCacheDir("/fake/dir")).rejects.toThrow("Scan cache expects a directory"); + }); + + test("empty directory should return an empty set of repository and no warnings", async () => { + vi.mocked(stat).mockResolvedValueOnce({ + isDirectory: () => true, + } as Stats); + + // mock empty cache folder + vi.mocked(readdir).mockResolvedValue([]); + + const result = await scanCacheDir("/fake/dir"); + + // cacheDir must have been read + expect(readdir).toHaveBeenCalledWith("/fake/dir"); + + expect(result.warnings.length).toBe(0); + expect(result.repos).toHaveLength(0); + expect(result.size).toBe(0); + }); +}); + +describe("scanCachedRepo", () => { + test("should throw an error for invalid repo path", async () => { + await expect(() => { + return scanCachedRepo("/fake/repo_path"); + }).rejects.toThrow("Repo path is not a valid HuggingFace cache directory"); + }); + + test("should throw an error if the snapshot folder does not exist", async () => { + vi.mocked(readdir).mockResolvedValue([]); + vi.mocked(stat).mockResolvedValue({ + isDirectory: () => false, + } as Stats); + + await expect(() => { + return scanCachedRepo("/fake/cacheDir/models--hello-world--name"); + }).rejects.toThrow("Snapshots dir doesn't exist in cached repo"); + }); + + test("should properly parse the repository name", async () => { + const repoPath = "/fake/cacheDir/models--hello-world--name"; + vi.mocked(readdir).mockResolvedValue([]); + vi.mocked(stat).mockResolvedValue({ + isDirectory: () => true, + } as Stats); + + const result = await scanCachedRepo(repoPath); + expect(readdir).toHaveBeenCalledWith(join(repoPath, "refs"), { + withFileTypes: true, + }); + + expect(result.id.name).toBe("hello-world/name"); + expect(result.id.type).toBe("model"); + }); +}); + +describe("scanSnapshotDir", () => { + test("should scan a valid snapshot directory", async () => { + const cachedFiles: CachedFileInfo[] = []; + const blobStats = new Map(); + vi.mocked(readdir).mockResolvedValueOnce([ + { name: "file1", isDirectory: () => false } as unknown as Awaited>[0], + ]); + + vi.mocked(realpath).mockResolvedValueOnce("/fake/realpath"); + vi.mocked(lstat).mockResolvedValueOnce({ size: 1024, atimeMs: Date.now(), mtimeMs: Date.now() } as Stats); + + await scanSnapshotDir("/fake/revision", cachedFiles, blobStats); + + expect(cachedFiles).toHaveLength(1); + expect(blobStats.size).toBe(1); + }); +}); + +describe("getBlobStat", () => { + test("should retrieve blob stat if already cached", async () => { + const blobStats = new Map([["/fake/blob", { size: 1024 } as Stats]]); + const result = await getBlobStat("/fake/blob", blobStats); + + expect(lstat).not.toHaveBeenCalled(); + expect(result.size).toBe(1024); + }); + + test("should fetch and cache blob stat if not cached", async () => { + const blobStats = new Map(); + vi.mocked(lstat).mockResolvedValueOnce({ size: 2048 } as Stats); + + const result = await getBlobStat("/fake/blob", blobStats); + + expect(result.size).toBe(2048); + expect(blobStats.size).toBe(1); + }); +}); + +describe("parseRepoType", () => { + test("should parse models repo type", () => { + expect(parseRepoType("models")).toBe("model"); + }); + + test("should parse dataset repo type", () => { + expect(parseRepoType("datasets")).toBe("dataset"); + }); + + test("should parse space repo type", () => { + expect(parseRepoType("spaces")).toBe("space"); + }); + + test("should throw an error for invalid repo type", () => { + expect(() => parseRepoType("invalid")).toThrowError("Invalid repo type: invalid"); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/cache-management.ts b/node_modules/@huggingface/hub/src/lib/cache-management.ts new file mode 100644 index 0000000000000000000000000000000000000000..e658bc7138fe788c1550dc45dc34ac97acf43597 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/cache-management.ts @@ -0,0 +1,265 @@ +import { homedir } from "node:os"; +import { join, basename } from "node:path"; +import { stat, readdir, readFile, realpath, lstat } from "node:fs/promises"; +import type { Stats } from "node:fs"; +import type { RepoType, RepoId } from "../types/public"; + +function getDefaultHome(): string { + return join(homedir(), ".cache"); +} + +function getDefaultCachePath(): string { + return join(process.env["HF_HOME"] ?? join(process.env["XDG_CACHE_HOME"] ?? getDefaultHome(), "huggingface"), "hub"); +} + +function getHuggingFaceHubCache(): string { + return process.env["HUGGINGFACE_HUB_CACHE"] ?? getDefaultCachePath(); +} + +export function getHFHubCachePath(): string { + return process.env["HF_HUB_CACHE"] ?? getHuggingFaceHubCache(); +} + +const FILES_TO_IGNORE: string[] = [".DS_Store"]; + +export const REPO_ID_SEPARATOR: string = "--"; + +export function getRepoFolderName({ name, type }: RepoId): string { + const parts = [`${type}s`, ...name.split("/")]; + return parts.join(REPO_ID_SEPARATOR); +} + +export interface CachedFileInfo { + path: string; + /** + * Underlying file - which `path` is symlinked to + */ + blob: { + size: number; + path: string; + lastModifiedAt: Date; + lastAccessedAt: Date; + }; +} + +export interface CachedRevisionInfo { + commitOid: string; + path: string; + size: number; + files: CachedFileInfo[]; + refs: string[]; + + lastModifiedAt: Date; +} + +export interface CachedRepoInfo { + id: RepoId; + path: string; + size: number; + filesCount: number; + revisions: CachedRevisionInfo[]; + + lastAccessedAt: Date; + lastModifiedAt: Date; +} + +export interface HFCacheInfo { + size: number; + repos: CachedRepoInfo[]; + warnings: Error[]; +} + +export async function scanCacheDir(cacheDir: string | undefined = undefined): Promise { + if (!cacheDir) cacheDir = getHFHubCachePath(); + + const s = await stat(cacheDir); + if (!s.isDirectory()) { + throw new Error( + `Scan cache expects a directory but found a file: ${cacheDir}. Please use \`cacheDir\` argument or set \`HF_HUB_CACHE\` environment variable.`, + ); + } + + const repos: CachedRepoInfo[] = []; + const warnings: Error[] = []; + + const directories = await readdir(cacheDir); + for (const repo of directories) { + // skip .locks folder + if (repo === ".locks") continue; + + // get the absolute path of the repo + const absolute = join(cacheDir, repo); + + // ignore non-directory element + const s = await stat(absolute); + if (!s.isDirectory()) { + continue; + } + + try { + const cached = await scanCachedRepo(absolute); + repos.push(cached); + } catch (err: unknown) { + warnings.push(err as Error); + } + } + + return { + repos: repos, + size: [...repos.values()].reduce((sum, repo) => sum + repo.size, 0), + warnings: warnings, + }; +} + +export async function scanCachedRepo(repoPath: string): Promise { + // get the directory name + const name = basename(repoPath); + if (!name.includes(REPO_ID_SEPARATOR)) { + throw new Error(`Repo path is not a valid HuggingFace cache directory: ${name}`); + } + + // parse the repoId from directory name + const [type, ...remaining] = name.split(REPO_ID_SEPARATOR); + const repoType = parseRepoType(type); + const repoId = remaining.join("/"); + + const snapshotsPath = join(repoPath, "snapshots"); + const refsPath = join(repoPath, "refs"); + + const snapshotStat = await stat(snapshotsPath); + if (!snapshotStat.isDirectory()) { + throw new Error(`Snapshots dir doesn't exist in cached repo ${snapshotsPath}`); + } + + // Check if the refs directory exists and scan it + const refsByHash: Map = new Map(); + const refsStat = await stat(refsPath); + if (refsStat.isDirectory()) { + await scanRefsDir(refsPath, refsByHash); + } + + // Scan snapshots directory and collect cached revision information + const cachedRevisions: CachedRevisionInfo[] = []; + const blobStats: Map = new Map(); // Store blob stats + + const snapshotDirs = await readdir(snapshotsPath); + for (const dir of snapshotDirs) { + if (FILES_TO_IGNORE.includes(dir)) continue; // Ignore unwanted files + + const revisionPath = join(snapshotsPath, dir); + const revisionStat = await stat(revisionPath); + if (!revisionStat.isDirectory()) { + throw new Error(`Snapshots folder corrupted. Found a file: ${revisionPath}`); + } + + const cachedFiles: CachedFileInfo[] = []; + await scanSnapshotDir(revisionPath, cachedFiles, blobStats); + + const revisionLastModified = + cachedFiles.length > 0 + ? Math.max(...[...cachedFiles].map((file) => file.blob.lastModifiedAt.getTime())) + : revisionStat.mtimeMs; + + cachedRevisions.push({ + commitOid: dir, + files: cachedFiles, + refs: refsByHash.get(dir) || [], + size: [...cachedFiles].reduce((sum, file) => sum + file.blob.size, 0), + path: revisionPath, + lastModifiedAt: new Date(revisionLastModified), + }); + + refsByHash.delete(dir); + } + + // Verify that all refs refer to a valid revision + if (refsByHash.size > 0) { + throw new Error( + `Reference(s) refer to missing commit hashes: ${JSON.stringify(Object.fromEntries(refsByHash))} (${repoPath})`, + ); + } + + const repoStats = await stat(repoPath); + const repoLastAccessed = + blobStats.size > 0 ? Math.max(...[...blobStats.values()].map((stat) => stat.atimeMs)) : repoStats.atimeMs; + + const repoLastModified = + blobStats.size > 0 ? Math.max(...[...blobStats.values()].map((stat) => stat.mtimeMs)) : repoStats.mtimeMs; + + // Return the constructed CachedRepoInfo object + return { + id: { + name: repoId, + type: repoType, + }, + path: repoPath, + filesCount: blobStats.size, + revisions: cachedRevisions, + size: [...blobStats.values()].reduce((sum, stat) => sum + stat.size, 0), + lastAccessedAt: new Date(repoLastAccessed), + lastModifiedAt: new Date(repoLastModified), + }; +} + +export async function scanRefsDir(refsPath: string, refsByHash: Map): Promise { + const refFiles = await readdir(refsPath, { withFileTypes: true }); + for (const refFile of refFiles) { + const refFilePath = join(refsPath, refFile.name); + if (refFile.isDirectory()) continue; // Skip directories + + const commitHash = await readFile(refFilePath, "utf-8"); + const refName = refFile.name; + if (!refsByHash.has(commitHash)) { + refsByHash.set(commitHash, []); + } + refsByHash.get(commitHash)?.push(refName); + } +} + +export async function scanSnapshotDir( + revisionPath: string, + cachedFiles: CachedFileInfo[], + blobStats: Map, +): Promise { + const files = await readdir(revisionPath, { withFileTypes: true }); + for (const file of files) { + if (file.isDirectory()) continue; // Skip directories + + const filePath = join(revisionPath, file.name); + const blobPath = await realpath(filePath); + const blobStat = await getBlobStat(blobPath, blobStats); + + cachedFiles.push({ + path: filePath, + blob: { + path: blobPath, + size: blobStat.size, + lastAccessedAt: new Date(blobStat.atimeMs), + lastModifiedAt: new Date(blobStat.mtimeMs), + }, + }); + } +} + +export async function getBlobStat(blobPath: string, blobStats: Map): Promise { + const blob = blobStats.get(blobPath); + if (!blob) { + const statResult = await lstat(blobPath); + blobStats.set(blobPath, statResult); + return statResult; + } + return blob; +} + +export function parseRepoType(type: string): RepoType { + switch (type) { + case "models": + return "model"; + case "datasets": + return "dataset"; + case "spaces": + return "space"; + default: + throw new TypeError(`Invalid repo type: ${type}`); + } +} diff --git a/node_modules/@huggingface/hub/src/lib/check-repo-access.spec.ts b/node_modules/@huggingface/hub/src/lib/check-repo-access.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..12ad5cd92a2cf3549b1e62f4125b875336b55d6a --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/check-repo-access.spec.ts @@ -0,0 +1,34 @@ +import { assert, describe, expect, it } from "vitest"; +import { checkRepoAccess } from "./check-repo-access"; +import { HubApiError } from "../error"; +import { TEST_ACCESS_TOKEN, TEST_HUB_URL } from "../test/consts"; + +describe("checkRepoAccess", () => { + it("should throw 401 when accessing unexisting repo unauthenticated", async () => { + try { + await checkRepoAccess({ repo: { name: "i--d/dont", type: "model" } }); + assert(false, "should have thrown"); + } catch (err) { + expect(err).toBeInstanceOf(HubApiError); + expect((err as HubApiError).statusCode).toBe(401); + } + }); + + it("should throw 404 when accessing unexisting repo authenticated", async () => { + try { + await checkRepoAccess({ + repo: { name: "i--d/dont", type: "model" }, + hubUrl: TEST_HUB_URL, + accessToken: TEST_ACCESS_TOKEN, + }); + assert(false, "should have thrown"); + } catch (err) { + expect(err).toBeInstanceOf(HubApiError); + expect((err as HubApiError).statusCode).toBe(404); + } + }); + + it("should not throw when accessing public repo", async () => { + await checkRepoAccess({ repo: { name: "openai-community/gpt2", type: "model" } }); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/check-repo-access.ts b/node_modules/@huggingface/hub/src/lib/check-repo-access.ts new file mode 100644 index 0000000000000000000000000000000000000000..4c997291b4c78bb77859d7c8ba56c49291eb4f5a --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/check-repo-access.ts @@ -0,0 +1,32 @@ +import { HUB_URL } from "../consts"; +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import { createApiError, type HubApiError } from "../error"; +import type { CredentialsParams, RepoDesignation } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { toRepoId } from "../utils/toRepoId"; + +/** + * Check if we have read access to a repository. + * + * Throw a {@link HubApiError} error if we don't have access. HubApiError.statusCode will be 401, 403 or 404. + */ +export async function checkRepoAccess( + params: { + repo: RepoDesignation; + hubUrl?: string; + fetch?: typeof fetch; + } & Partial, +): Promise { + const accessToken = params && checkCredentials(params); + const repoId = toRepoId(params.repo); + + const response = await (params.fetch || fetch)(`${params?.hubUrl || HUB_URL}/api/${repoId.type}s/${repoId.name}`, { + headers: { + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }); + + if (!response.ok) { + throw await createApiError(response); + } +} diff --git a/node_modules/@huggingface/hub/src/lib/collection-info.spec.ts b/node_modules/@huggingface/hub/src/lib/collection-info.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..559b6bd468a2fdd6d9192980cedf0e4bd9e75c42 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/collection-info.spec.ts @@ -0,0 +1,174 @@ +import { describe, expect, it } from "vitest"; +import { collectionInfo } from "./collection-info"; + +describe("collectionInfo", () => { + it("should return the collection info", async () => { + const collection = await collectionInfo({ + slug: "huggingfacejs/test-collection-690df2897fa1945492b8cf42", + }); + + // Check all properties of the collection except items + expect(collection).toEqual({ + slug: "huggingfacejs/test-collection-690df2897fa1945492b8cf42", + title: "Test Collection", + description: "Only used in E2E tests", + gating: false, + lastUpdated: expect.any(String), + owner: { + _id: "6414d83b385a75d7790d5a58", + avatarUrl: expect.any(String), + fullname: "Huggingface.js", + name: "huggingfacejs", + type: "org", + followerCount: expect.any(Number), + isHf: false, + isHfAdmin: false, + isMod: false, + isUserFollowing: expect.any(Boolean), + }, + items: [ + { + _id: "690df2a467ea25a1a346d0ae", + author: "huggingfacejs", + datasetsServerInfo: { + formats: expect.any(Array), + libraries: expect.any(Array), + modalities: expect.any(Array), + numRows: expect.any(Number), + viewer: expect.any(String), + }, + downloads: expect.any(Number), + gated: false, + id: "huggingfacejs/tasks", + isBenchmark: false, + isLikedByUser: false, + lastModified: expect.any(String), + likes: expect.any(Number), + position: 0, + private: false, + repoType: "dataset", + type: "dataset", + }, + { + _id: "690df2b1954547dac9727da3", + description: "Only used in E2E tests", + id: "690df2897fa1945492b8cf42", + isUpvotedByUser: false, + lastUpdated: "2025-11-07T13:24:26.277Z", + numberItems: 5, + owner: { + _id: "6414d83b385a75d7790d5a58", + avatarUrl: expect.any(String), + followerCount: expect.any(Number), + fullname: "Huggingface.js", + isHf: false, + isHfAdmin: false, + isMod: false, + isUserFollowing: expect.any(Boolean), + name: "huggingfacejs", + type: "org", + }, + position: 1, + shareUrl: "https://hf.co/collections/huggingfacejs/test-collection", + slug: "huggingfacejs/test-collection-690df2897fa1945492b8cf42", + theme: "pink", + title: "Test Collection", + type: "collection", + upvotes: expect.any(Number), + }, + { + _id: "690df2c49f252aa897a873b2", + ai_category: "Model Benchmarking", + ai_short_description: "Upload ML models to Hugging Face Hub from your browser", + author: "huggingfacejs", + authorData: { + _id: "6414d83b385a75d7790d5a58", + avatarUrl: expect.any(String), + followerCount: expect.any(Number), + fullname: "Huggingface.js", + isHf: false, + isHfAdmin: false, + isMod: false, + isUserFollowing: expect.any(Boolean), + name: "huggingfacejs", + type: "org", + }, + colorFrom: "green", + colorTo: "green", + createdAt: "2023-03-17T21:33:16.000Z", + emoji: "🌎", + featured: false, + id: "huggingfacejs/push-model-from-web", + isLikedByUser: false, + lastModified: expect.any(String), + likes: 1, + pinned: false, + position: 2, + private: false, + repoType: "space", + runtime: { + hardware: { + current: null, + requested: null, + }, + replicas: { + current: 1, + requested: 1, + }, + stage: "RUNNING", + storage: null, + }, + sdk: "static", + tags: ["static", "region:us"], + title: "Push Model From Web", + trendingScore: 0, + type: "space", + }, + { + _id: "690df2d0c9390ed6ab0f88b1", + id: "2510.04871", + isUpvotedByUser: false, + position: 3, + publishedAt: "2025-10-06T14:58:08.000Z", + thumbnailUrl: "https://cdn-thumbnails.huggingface.co/social-thumbnails/papers/2510.04871.png", + title: "Less is More: Recursive Reasoning with Tiny Networks", + type: "paper", + upvotes: expect.any(Number), + }, + { + _id: "690df30af2d88fbd705feda5", + author: "huggingfacejs", + authorData: { + _id: "6414d83b385a75d7790d5a58", + avatarUrl: expect.any(String), + followerCount: expect.any(Number), + fullname: "Huggingface.js", + isHf: false, + isHfAdmin: false, + isMod: false, + isUserFollowing: expect.any(Boolean), + name: "huggingfacejs", + type: "org", + }, + availableInferenceProviders: [], + downloads: expect.any(Number), + gated: false, + id: "huggingfacejs/test-model", + isLikedByUser: false, + lastModified: expect.any(String), + likes: expect.any(Number), + position: 4, + private: false, + repoType: "model", + type: "model", + }, + ], + theme: "pink", + private: false, + position: 0, + shareUrl: "https://hf.co/collections/huggingfacejs/test-collection", + upvotes: expect.any(Number), + isUpvotedByUser: false, + }); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/collection-info.ts b/node_modules/@huggingface/hub/src/lib/collection-info.ts new file mode 100644 index 0000000000000000000000000000000000000000..ce46e0ceba872e43a8a25be544f1d7a4919403ec --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/collection-info.ts @@ -0,0 +1,34 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { ApiCollectionInfo } from "../types/api/api-collection"; +import type { CredentialsParams } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; + +export async function collectionInfo( + params: { + /** + * The slug of the collection. + */ + slug: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise { + const accessToken = checkCredentials(params); + + const res = await (params.fetch ?? fetch)(`${params.hubUrl ?? HUB_URL}/api/collections/${params.slug}`, { + headers: { + "Content-Type": "application/json", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : undefined), + }, + }); + + if (!res.ok) { + throw await createApiError(res); + } + + return await res.json(); +} diff --git a/node_modules/@huggingface/hub/src/lib/commit.spec.ts b/node_modules/@huggingface/hub/src/lib/commit.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..1e59201c3ee24c64c5c5bff3e2efecc21c558e5d --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/commit.spec.ts @@ -0,0 +1,271 @@ +import { assert, it, describe } from "vitest"; + +import { TEST_HUB_URL, TEST_ACCESS_TOKEN, TEST_USER } from "../test/consts"; +import type { RepoId } from "../types/public"; +import type { CommitFile } from "./commit"; +import { commit } from "./commit"; +import { createRepo } from "./create-repo"; +import { deleteRepo } from "./delete-repo"; +import { downloadFile } from "./download-file"; +import { fileDownloadInfo } from "./file-download-info"; +import { insecureRandomString } from "../utils/insecureRandomString"; +import { isFrontend } from "../utils/isFrontend"; + +const lfsContent = "O123456789".repeat(100_000); + +describe("commit", () => { + it("should commit to a repo with blobs", async function () { + const tokenizerJsonUrl = new URL( + "https://huggingface.co/spaces/aschen/push-model-from-web/raw/main/mobilenet/model.json", + ); + const repoName = `${TEST_USER}/TEST-${insecureRandomString()}`; + const repo: RepoId = { + name: repoName, + type: "model", + }; + + await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + repo, + license: "mit", + }); + + try { + const readme1 = await downloadFile({ repo, path: "README.md", hubUrl: TEST_HUB_URL }); + assert(readme1, "Readme doesn't exist"); + + const nodeOperation: CommitFile[] = isFrontend + ? [] + : [ + { + operation: "addOrUpdate", + path: "tsconfig.json", + content: (await import("node:url")).pathToFileURL("./tsconfig.json") as URL, + }, + ]; + + await commit({ + repo, + title: "Some commit", + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + operations: [ + { + operation: "addOrUpdate", + content: new Blob(["This is me"]), + path: "test.txt", + }, + { + operation: "addOrUpdate", + content: new Blob([lfsContent]), + path: "test.lfs.txt", + }, + ...nodeOperation, + { + operation: "addOrUpdate", + content: tokenizerJsonUrl, + path: "lamaral.json", + }, + { + operation: "delete", + path: "README.md", + }, + ], + // To test web workers in the front-end + useWebWorkers: { minSize: 5_000 }, + }); + + const fileContent = await downloadFile({ repo, path: "test.txt", hubUrl: TEST_HUB_URL }); + assert.strictEqual(await fileContent?.text(), "This is me"); + + const lfsFileContent = await downloadFile({ repo, path: "test.lfs.txt", hubUrl: TEST_HUB_URL }); + assert.strictEqual(await lfsFileContent?.text(), lfsContent); + + const lfsFileUrl = `${TEST_HUB_URL}/${repoName}/raw/main/test.lfs.txt`; + const lfsFilePointer = await fetch(lfsFileUrl); + assert.strictEqual(lfsFilePointer.status, 200); + assert.strictEqual( + (await lfsFilePointer.text()).trim(), + ` +version https://git-lfs.github.com/spec/v1 +oid sha256:a3bbce7ee1df7233d85b5f4d60faa3755f93f537804f8b540c72b0739239ddf8 +size ${lfsContent.length} + `.trim(), + ); + + if (!isFrontend) { + const fileUrlContent = await downloadFile({ repo, path: "tsconfig.json", hubUrl: TEST_HUB_URL }); + assert.strictEqual( + await fileUrlContent?.text(), + (await import("node:fs")).readFileSync("./tsconfig.json", "utf-8"), + ); + } + + const webResourceContent = await downloadFile({ repo, path: "lamaral.json", hubUrl: TEST_HUB_URL }); + assert.strictEqual(await webResourceContent?.text(), await (await fetch(tokenizerJsonUrl)).text()); + + const readme2 = await downloadFile({ repo, path: "README.md", hubUrl: TEST_HUB_URL }); + assert.strictEqual(readme2, null); + } finally { + await deleteRepo({ + repo: { + name: repoName, + type: "model", + }, + hubUrl: TEST_HUB_URL, + credentials: { accessToken: TEST_ACCESS_TOKEN }, + }); + } + }, 60_000); + + it("should commit a full repo from HF with web urls", async function () { + const repoName = `${TEST_USER}/TEST-${insecureRandomString()}`; + const repo: RepoId = { + name: repoName, + type: "model", + }; + + await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + repo, + hubUrl: TEST_HUB_URL, + }); + + try { + const FILES_TO_UPLOAD = [ + `https://huggingface.co/spaces/huggingfacejs/push-model-from-web/resolve/main/mobilenet/model.json`, + `https://huggingface.co/spaces/huggingfacejs/push-model-from-web/resolve/main/mobilenet/group1-shard1of2`, + `https://huggingface.co/spaces/huggingfacejs/push-model-from-web/resolve/main/mobilenet/group1-shard2of2`, + `https://huggingface.co/spaces/huggingfacejs/push-model-from-web/resolve/main/mobilenet/coffee.jpg`, + `https://huggingface.co/spaces/huggingfacejs/push-model-from-web/resolve/main/mobilenet/README.md`, + ]; + + const operations: CommitFile[] = await Promise.all( + FILES_TO_UPLOAD.map(async (file) => { + return { + operation: "addOrUpdate", + path: file.slice(file.indexOf("main/") + "main/".length), + // upload remote file + content: new URL(file), + }; + }), + ); + await commit({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + title: "upload model", + operations, + }); + + const LFSSize = (await fileDownloadInfo({ repo, path: "mobilenet/group1-shard1of2", hubUrl: TEST_HUB_URL })) + ?.size; + + assert.strictEqual(LFSSize, 4_194_304); + + const pointerFile = await downloadFile({ + repo, + path: "mobilenet/group1-shard1of2", + raw: true, + hubUrl: TEST_HUB_URL, + }); + + // Make sure SHA is computed properly as well + assert.strictEqual( + (await pointerFile?.text())?.trim(), + ` +version https://git-lfs.github.com/spec/v1 +oid sha256:3fb621eb9b37478239504ee083042d5b18699e8b8618e569478b03b119a85a69 +size 4194304 + `.trim(), + ); + } finally { + await deleteRepo({ + repo: { + name: repoName, + type: "model", + }, + hubUrl: TEST_HUB_URL, + credentials: { accessToken: TEST_ACCESS_TOKEN }, + }); + } + // https://huggingfacejs-push-model-from-web.hf.space/ + }, 60_000); + + it("should be able to create a PR and then commit to it", async function () { + const repoName = `${TEST_USER}/TEST-${insecureRandomString()}`; + const repo: RepoId = { + name: repoName, + type: "model", + }; + + await createRepo({ + credentials: { + accessToken: TEST_ACCESS_TOKEN, + }, + repo, + hubUrl: TEST_HUB_URL, + }); + + try { + const pr = await commit({ + repo, + credentials: { + accessToken: TEST_ACCESS_TOKEN, + }, + hubUrl: TEST_HUB_URL, + title: "Create PR", + isPullRequest: true, + operations: [ + { + operation: "addOrUpdate", + content: new Blob(["This is me"]), + path: "test.txt", + }, + ], + }); + + if (!pr) { + throw new Error("PR creation failed"); + } + + if (!pr.pullRequestUrl) { + throw new Error("No pull request url"); + } + + const prNumber = pr.pullRequestUrl.split("/").pop(); + const prRef = `refs/pr/${prNumber}`; + + await commit({ + repo, + credentials: { + accessToken: TEST_ACCESS_TOKEN, + }, + hubUrl: TEST_HUB_URL, + branch: prRef, + title: "Some commit", + operations: [ + { + operation: "addOrUpdate", + content: new URL( + `https://huggingface.co/spaces/huggingfacejs/push-model-from-web/resolve/main/mobilenet/group1-shard1of2`, + ), + path: "mobilenet/group1-shard1of2", + }, + ], + }); + + assert(commit, "PR commit failed"); + } finally { + await deleteRepo({ + repo: { + name: repoName, + type: "model", + }, + hubUrl: TEST_HUB_URL, + credentials: { accessToken: TEST_ACCESS_TOKEN }, + }); + } + }, 60_000); +}); diff --git a/node_modules/@huggingface/hub/src/lib/commit.ts b/node_modules/@huggingface/hub/src/lib/commit.ts new file mode 100644 index 0000000000000000000000000000000000000000..acab75d02398a5ccaa86beb47ba9a9436560174a --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/commit.ts @@ -0,0 +1,993 @@ +import { HUB_URL } from "../consts"; +import { HubApiError, createApiError, InvalidApiResponseFormatError } from "../error"; +import type { + ApiBucketBatchResponse, + ApiCommitHeader, + ApiCommitLfsFile, + ApiCommitOperation, + ApiLfsBatchRequest, + ApiLfsBatchResponse, + ApiLfsCompleteMultipartRequest, + ApiPreuploadRequest, + ApiPreuploadResponse, +} from "../types/api/api-commit"; +import type { CredentialsParams, RepoDesignation } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { chunk } from "../utils/chunk"; +import { promisesQueue } from "../utils/promisesQueue"; +import { promisesQueueStreaming } from "../utils/promisesQueueStreaming"; +import { sha256 } from "../utils/sha256"; +import { toRepoId } from "../utils/toRepoId"; +import { WebBlob } from "../utils/WebBlob"; +import { eventToGenerator } from "../utils/eventToGenerator"; +import { base64FromBytes } from "../utils/base64FromBytes"; +import { isFrontend } from "../utils/isFrontend"; +import { createBlobs } from "../utils/createBlobs"; +import type { XetTokenParams } from "../utils/uploadShards"; +import { uploadShards } from "../utils/uploadShards"; +import { splitAsyncGenerator } from "../utils/splitAsyncGenerator"; +import { SplicedBlob } from "../utils/SplicedBlob"; + +const CONCURRENT_SHAS = 5; +const CONCURRENT_LFS_UPLOADS = 5; +const MULTIPART_PARALLEL_UPLOAD = 5; + +export interface CommitDeletedEntry { + operation: "delete"; + path: string; +} + +export type ContentSource = Blob | URL; + +export interface CommitFile { + operation: "addOrUpdate"; + path: string; + content: ContentSource; + // forceLfs?: boolean +} + +/** + * Opitmized when only the beginning or the end of the file is replaced + * + * todo: handle other cases + */ +export interface CommitEditFile { + operation: "edit"; + path: string; + /** Later, will be ContentSource. For now simpler to just handle blobs */ + originalContent: Blob; + edits: Array<{ + /** + * Later, will be ContentSource. For now simpler to just handle blobs + * + * originalContent from [start, end) will be replaced by this + */ + content: Blob; + /** + * The start position of the edit in the original content + */ + start: number; + /** + * The end position of the edit in the original content + * + * originalContent from [start, end) will be replaced by the edit + */ + end: number; + }>; +} + +type CommitBlob = Omit & { content: Blob }; + +// TODO: find a nice way to handle LFS & non-LFS files in an uniform manner, see https://github.com/huggingface/moon-landing/issues/4370 +// export type CommitRenameFile = { +// operation: "rename"; +// path: string; +// oldPath: string; +// content?: ContentSource; +// }; + +export type CommitOperation = CommitDeletedEntry | CommitFile | CommitEditFile /* | CommitRenameFile */; +type CommitBlobOperation = Exclude | CommitBlob; + +export type CommitParams = { + title: string; + description?: string; + repo: RepoDesignation; + operations: CommitOperation[]; + /** @default "main" */ + branch?: string; + /** + * Parent commit. Optional + * + * - When opening a PR: will use parentCommit as the parent commit + * - When committing on a branch: Will make sure that there were no intermediate commits + */ + parentCommit?: string; + isPullRequest?: boolean; + hubUrl?: string; + /** + * Whether to use web workers to compute SHA256 hashes. + * + * @default false + */ + useWebWorkers?: boolean | { minSize?: number; poolSize?: number }; + /** + * Maximum depth of folders to upload. Files deeper than this will be ignored + * + * @default 5 + */ + maxFolderDepth?: number; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + abortSignal?: AbortSignal; + /** + * @default true + * + * Use xet protocol: https://huggingface.co/blog/xet-on-the-hub to upload, rather than a basic S3 PUT + */ + useXet?: boolean; + // Credentials are optional due to custom fetch functions or cookie auth +} & Partial; + +export interface CommitOutput { + pullRequestUrl?: string; + commit: { + oid: string; + url: string; + }; + hookOutput: string; +} + +function isFileOperation(op: CommitOperation): op is CommitBlob { + const ret = op.operation === "addOrUpdate"; + + if (ret && !(op.content instanceof Blob)) { + throw new TypeError("Precondition failed: op.content should be a Blob"); + } + + return ret; +} + +export type CommitProgressEvent = + | { + event: "phase"; + phase: "preuploading" | "uploadingLargeFiles" | "committing"; + } + | { + event: "fileProgress"; + path: string; + progress: number; + state: "hashing" | "uploading" | "error"; + }; + +/** + * Internal function for now, used by commit. + * + * Can be exposed later to offer fine-tuned progress info + * + * CommitOutput is not present for bucket commits + */ +export async function* commitIter(params: CommitParams): AsyncGenerator { + const accessToken = checkCredentials(params); + const repoId = toRepoId(params.repo); + + if (repoId.type === "bucket") { + return yield* commitIterBucket(params); + } + + yield { event: "phase", phase: "preuploading" }; + + let useXet = params.useXet ?? true; + + const lfsShas = new Map(); + + const abortController = new AbortController(); + const abortSignal = abortController.signal; + + // Polyfill see https://discuss.huggingface.co/t/why-cant-i-upload-a-parquet-file-to-my-dataset-error-o-throwifaborted-is-not-a-function/62245 + if (!abortSignal.throwIfAborted) { + abortSignal.throwIfAborted = () => { + if (abortSignal.aborted) { + throw new DOMException("Aborted", "AbortError"); + } + }; + } + + if (params.abortSignal) { + params.abortSignal.addEventListener("abort", () => abortController.abort()); + } + + try { + const allOperations = ( + await Promise.all( + params.operations.map(async (operation) => { + if (operation.operation === "edit") { + // Convert EditFile operation to a file operation with SplicedBlob + const splicedBlob = SplicedBlob.create( + operation.originalContent, + operation.edits.map((splice) => ({ insert: splice.content, start: splice.start, end: splice.end })), + ); + return { + operation: "addOrUpdate" as const, + path: operation.path, + content: splicedBlob, + }; + } + + if (operation.operation !== "addOrUpdate") { + return operation; + } + + if (!(operation.content instanceof URL)) { + /** TS trick to enforce `content` to be a `Blob` */ + return { ...operation, content: operation.content }; + } + + const lazyBlobs = await createBlobs(operation.content, operation.path, { + fetch: params.fetch, + maxFolderDepth: params.maxFolderDepth, + }); + + abortSignal?.throwIfAborted(); + + return lazyBlobs.map((blob) => ({ + ...operation, + content: blob.blob, + path: blob.path, + })); + }), + ) + ).flat(1); + + const gitAttributes = allOperations.filter(isFileOperation).find((op) => op.path === ".gitattributes")?.content; + + for (const operations of chunk(allOperations.filter(isFileOperation), 100)) { + const payload: ApiPreuploadRequest = { + gitAttributes: gitAttributes && (await gitAttributes.text()), + files: await Promise.all( + operations.map(async (operation) => ({ + path: operation.path, + size: operation.content.size, + sample: base64FromBytes(new Uint8Array(await operation.content.slice(0, 512).arrayBuffer())), + })), + ), + }; + + abortSignal?.throwIfAborted(); + + const res = await (params.fetch ?? fetch)( + `${params.hubUrl ?? HUB_URL}/api/${repoId.type}s/${repoId.name}/preupload/${encodeURIComponent( + params.branch ?? "main", + )}` + (params.isPullRequest ? "?create_pr=1" : ""), + { + method: "POST", + headers: { + ...(accessToken && { Authorization: `Bearer ${accessToken}` }), + "Content-Type": "application/json", + }, + body: JSON.stringify(payload), + signal: abortSignal, + }, + ); + + if (!res.ok) { + throw await createApiError(res); + } + + const json: ApiPreuploadResponse = await res.json(); + + for (const file of json.files) { + if (file.uploadMode === "lfs") { + lfsShas.set(file.path, null); + } + } + } + + yield { event: "phase", phase: "uploadingLargeFiles" }; + + for (const operations of chunk( + allOperations.filter(isFileOperation).filter((op) => lfsShas.has(op.path)), + 100, + )) { + const shas = yield* eventToGenerator< + { event: "fileProgress"; state: "hashing"; path: string; progress: number }, + string[] + >((yieldCallback, returnCallback, rejectCallack) => { + return promisesQueue( + operations.map((op) => async () => { + const iterator = sha256(op.content, { useWebWorker: params.useWebWorkers, abortSignal: abortSignal }); + let res: IteratorResult; + do { + res = await iterator.next(); + if (!res.done) { + yieldCallback({ event: "fileProgress", path: op.path, progress: res.value, state: "hashing" }); + } + } while (!res.done); + const sha = res.value; + lfsShas.set(op.path, res.value); + return sha; + }), + CONCURRENT_SHAS, + ).then(returnCallback, rejectCallack); + }); + + abortSignal?.throwIfAborted(); + + const payload: ApiLfsBatchRequest = { + operation: "upload", + // multipart is a custom protocol for HF + transfers: ["basic", "multipart", ...(useXet ? ["xet" as const] : [])], + hash_algo: "sha_256", + ...(!params.isPullRequest && { + ref: { + name: params.branch ?? "main", + }, + }), + objects: operations.map((op, i) => ({ + oid: shas[i], + size: op.content.size, + })), + }; + + const res = await (params.fetch ?? fetch)( + `${params.hubUrl ?? HUB_URL}/${repoId.type === "model" ? "" : repoId.type + "s/"}${ + repoId.name + }.git/info/lfs/objects/batch`, + { + method: "POST", + headers: { + ...(accessToken && { Authorization: `Bearer ${accessToken}` }), + Accept: "application/vnd.git-lfs+json", + "Content-Type": "application/vnd.git-lfs+json", + }, + body: JSON.stringify(payload), + signal: abortSignal, + }, + ); + + if (!res.ok) { + throw await createApiError(res); + } + + const json: ApiLfsBatchResponse = await res.json(); + const batchRequestId = res.headers.get("X-Request-Id") || undefined; + + const shaToOperation = new Map(operations.map((op, i) => [shas[i], op])); + + if (useXet && json.transfer !== "xet") { + useXet = false; + } + + let xetParams: XetTokenParams | null = null; + + if (useXet) { + // First get all the files that are already uploaded out of the way + for (const obj of json.objects) { + const op = shaToOperation.get(obj.oid); + if (!op) { + throw new InvalidApiResponseFormatError("Unrequested object ID in response"); + } + + if (obj.error) { + const errorMessage = `Error while doing LFS batch call for ${operations[shas.indexOf(obj.oid)].path}: ${ + obj.error.message + }${batchRequestId ? ` - Request ID: ${batchRequestId}` : ""}`; + throw new HubApiError(res.url, obj.error.code, batchRequestId, errorMessage); + } + + if (!obj.actions?.upload) { + // Already uploaded + yield { + event: "fileProgress", + path: op.path, + progress: 1, + state: "uploading", + }; + } else { + const headers = new Headers(obj.actions.upload.header); + + xetParams = { + sessionId: headers.get("X-Xet-Session-Id") ?? undefined, + casUrl: headers.get("X-Xet-Cas-Url") ?? undefined, + accessToken: headers.get("X-Xet-Access-Token") ?? undefined, + expiresAt: headers.get("X-Xet-Token-Expiration") + ? new Date(parseInt(headers.get("X-Xet-Token-Expiration") ?? "0") * 1000) + : undefined, + refreshWriteTokenUrl: obj.actions.upload.href, + }; + } + } + const source = (async function* () { + for (const obj of json.objects) { + const op = shaToOperation.get(obj.oid); + if (!op || !obj.actions?.upload) { + continue; + } + abortSignal?.throwIfAborted(); + yield { content: op.content, path: op.path, sha256: obj.oid }; + } + })(); + if (xetParams) { + const fixedXetParams = xetParams; + const sources = splitAsyncGenerator(source, 5); + yield* eventToGenerator((yieldCallback, returnCallback, rejectCallback) => + Promise.all( + sources.map(async function (source) { + for await (const event of uploadShards(source, { + fetch: params.fetch, + accessToken, + hubUrl: params.hubUrl ?? HUB_URL, + repo: repoId, + xetParams: fixedXetParams, + // todo: maybe leave empty if PR? + rev: params.branch ?? "main", + isPullRequest: params.isPullRequest, + yieldCallback: (event) => yieldCallback({ ...event, state: "uploading" }), + })) { + if (event.event === "file") { + yieldCallback({ + event: "fileProgress" as const, + path: event.path, + progress: 1, + state: "uploading" as const, + }); + } else if (event.event === "fileProgress") { + yieldCallback({ + event: "fileProgress" as const, + path: event.path, + progress: event.progress, + state: "uploading" as const, + }); + } + } + }), + ).then(() => returnCallback(undefined), rejectCallback), + ); + } else { + // No LFS file to upload + } + } else { + yield* eventToGenerator((yieldCallback, returnCallback, rejectCallback) => { + return promisesQueueStreaming( + json.objects.map((obj) => async () => { + const op = shaToOperation.get(obj.oid); + + if (!op) { + throw new InvalidApiResponseFormatError("Unrequested object ID in response"); + } + + abortSignal?.throwIfAborted(); + + if (obj.error) { + const errorMessage = `Error while doing LFS batch call for ${operations[shas.indexOf(obj.oid)].path}: ${ + obj.error.message + }${batchRequestId ? ` - Request ID: ${batchRequestId}` : ""}`; + throw new HubApiError(res.url, obj.error.code, batchRequestId, errorMessage); + } + if (!obj.actions?.upload) { + // Already uploaded + yieldCallback({ + event: "fileProgress", + path: op.path, + progress: 1, + state: "uploading", + }); + return; + } + yieldCallback({ + event: "fileProgress", + path: op.path, + progress: 0, + state: "uploading", + }); + const content = op.content; + + const header = obj.actions.upload.header; + if (header?.chunk_size) { + const chunkSize = parseInt(header.chunk_size); + + // multipart upload + // parts are in upload.header['00001'] to upload.header['99999'] + + const completionUrl = obj.actions.upload.href; + const parts = Object.keys(header).filter((key) => /^[0-9]+$/.test(key)); + + if (parts.length !== Math.ceil(content.size / chunkSize)) { + throw new Error("Invalid server response to upload large LFS file, wrong number of parts"); + } + + const completeReq: ApiLfsCompleteMultipartRequest = { + oid: obj.oid, + parts: parts.map((part) => ({ + partNumber: +part, + etag: "", + })), + }; + + // Defined here so that it's not redefined at each iteration (and the caller can tell it's for the same file) + const progressCallback = (progress: number) => + yieldCallback({ event: "fileProgress", path: op.path, progress, state: "uploading" }); + + await promisesQueueStreaming( + parts.map((part) => async () => { + abortSignal?.throwIfAborted(); + + const index = parseInt(part) - 1; + const slice = content.slice(index * chunkSize, (index + 1) * chunkSize); + + const res = await (params.fetch ?? fetch)(header[part], { + method: "PUT", + /** Unfortunately, browsers don't support our inherited version of Blob in fetch calls */ + body: slice instanceof WebBlob && isFrontend ? await slice.arrayBuffer() : slice, + signal: abortSignal, + ...({ + progressHint: { + path: op.path, + part: index, + numParts: parts.length, + progressCallback, + }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } as any), + }); + + if (!res.ok) { + throw await createApiError(res, { + requestId: batchRequestId, + message: `Error while uploading part ${part} of ${ + operations[shas.indexOf(obj.oid)].path + } to LFS storage`, + }); + } + + const eTag = res.headers.get("ETag"); + + if (!eTag) { + throw new Error("Cannot get ETag of part during multipart upload"); + } + + completeReq.parts[Number(part) - 1].etag = eTag; + }), + MULTIPART_PARALLEL_UPLOAD, + ); + + abortSignal?.throwIfAborted(); + + const res = await (params.fetch ?? fetch)(completionUrl, { + method: "POST", + body: JSON.stringify(completeReq), + headers: { + Accept: "application/vnd.git-lfs+json", + "Content-Type": "application/vnd.git-lfs+json", + }, + signal: abortSignal, + }); + + if (!res.ok) { + throw await createApiError(res, { + requestId: batchRequestId, + message: `Error completing multipart upload of ${ + operations[shas.indexOf(obj.oid)].path + } to LFS storage`, + }); + } + + yieldCallback({ + event: "fileProgress", + path: op.path, + progress: 1, + state: "uploading", + }); + } else { + const res = await (params.fetch ?? fetch)(obj.actions.upload.href, { + method: "PUT", + headers: { + ...(batchRequestId ? { "X-Request-Id": batchRequestId } : undefined), + }, + /** Unfortunately, browsers don't support our inherited version of Blob in fetch calls */ + body: content instanceof WebBlob && isFrontend ? await content.arrayBuffer() : content, + signal: abortSignal, + ...({ + progressHint: { + path: op.path, + progressCallback: (progress: number) => + yieldCallback({ + event: "fileProgress", + path: op.path, + progress, + state: "uploading", + }), + }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } as any), + }); + + if (!res.ok) { + throw await createApiError(res, { + requestId: batchRequestId, + message: `Error while uploading ${operations[shas.indexOf(obj.oid)].path} to LFS storage`, + }); + } + + yieldCallback({ + event: "fileProgress", + path: op.path, + progress: 1, + state: "uploading", + }); + } + }), + CONCURRENT_LFS_UPLOADS, + ).then(returnCallback, rejectCallback); + }); + } + } + + abortSignal?.throwIfAborted(); + + yield { event: "phase", phase: "committing" }; + + return yield* eventToGenerator( + async (yieldCallback, returnCallback, rejectCallback) => + (params.fetch ?? fetch)( + `${params.hubUrl ?? HUB_URL}/api/${repoId.type}s/${repoId.name}/commit/${encodeURIComponent( + params.branch ?? "main", + )}` + (params.isPullRequest ? "?create_pr=1" : ""), + { + method: "POST", + headers: { + ...(accessToken && { Authorization: `Bearer ${accessToken}` }), + "Content-Type": "application/x-ndjson", + }, + body: [ + { + key: "header", + value: { + summary: params.title, + description: params.description, + parentCommit: params.parentCommit, + } satisfies ApiCommitHeader, + }, + ...((await Promise.all( + allOperations.map((operation) => { + if (isFileOperation(operation)) { + const sha = lfsShas.get(operation.path); + if (sha) { + return { + key: "lfsFile", + value: { + path: operation.path, + algo: "sha256", + size: operation.content.size, + oid: sha, + } satisfies ApiCommitLfsFile, + }; + } + } + + return convertOperationToNdJson(operation); + }), + )) satisfies ApiCommitOperation[]), + ] + .map((x) => JSON.stringify(x)) + .join("\n"), + signal: abortSignal, + ...({ + progressHint: { + progressCallback: (progress: number) => { + // For now, we display equal progress for all files + // We could compute the progress based on the size of `convertOperationToNdJson` for each of the files instead + for (const op of allOperations) { + if (isFileOperation(op) && !lfsShas.has(op.path)) { + yieldCallback({ + event: "fileProgress", + path: op.path, + progress, + state: "uploading", + }); + } + } + }, + }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } as any), + }, + ) + .then(async (res) => { + if (!res.ok) { + throw await createApiError(res); + } + + const json = await res.json(); + + returnCallback({ + pullRequestUrl: json.pullRequestUrl, + commit: { + oid: json.commitOid, + url: json.commitUrl, + }, + hookOutput: json.hookOutput, + }); + }) + .catch(rejectCallback), + ); + } catch (err) { + // For parallel requests, cancel them all if one fails + abortController.abort(); + throw err; + } +} + +export async function* commitIterBucket(params: CommitParams): AsyncGenerator { + const accessToken = checkCredentials(params); + const repoId = toRepoId(params.repo); + + if (params.useXet === false) { + throw new Error("useXet must be true or undefined for buckets"); + } + + const abortController = new AbortController(); + const abortSignal = abortController.signal; + + // Polyfill see https://discuss.huggingface.co/t/why-cant-i-upload-a-parquet-file-to-my-dataset-error-o-throwifaborted-is-not-a-function/62245 + if (!abortSignal.throwIfAborted) { + abortSignal.throwIfAborted = () => { + if (abortSignal.aborted) { + throw new DOMException("Aborted", "AbortError"); + } + }; + } + + if (params.abortSignal) { + params.abortSignal.addEventListener("abort", () => abortController.abort()); + } + + try { + const allOperations = ( + await Promise.all( + params.operations.map(async (operation) => { + if (operation.operation === "edit") { + // Convert EditFile operation to a file operation with SplicedBlob + const splicedBlob = SplicedBlob.create( + operation.originalContent, + operation.edits.map((splice) => ({ insert: splice.content, start: splice.start, end: splice.end })), + ); + return { + operation: "addOrUpdate" as const, + path: operation.path, + content: splicedBlob, + }; + } + + if (operation.operation !== "addOrUpdate") { + return operation; + } + + if (!(operation.content instanceof URL)) { + /** TS trick to enforce `content` to be a `Blob` */ + return { ...operation, content: operation.content }; + } + + const lazyBlobs = await createBlobs(operation.content, operation.path, { + fetch: params.fetch, + maxFolderDepth: params.maxFolderDepth, + }); + + abortSignal?.throwIfAborted(); + + return lazyBlobs.map((blob) => ({ + ...operation, + content: blob.blob, + path: blob.path, + })); + }), + ) + ).flat(1); + + yield { event: "phase", phase: "uploadingLargeFiles" }; + + for (const operations of chunk(allOperations.filter(isFileOperation), 100)) { + const xetHashes = new Map(); + abortSignal?.throwIfAborted(); + + // First get all the files that are already uploaded out of the way + + const source = (async function* () { + for (const operation of operations) { + abortSignal?.throwIfAborted(); + yield { content: operation.content, path: operation.path }; + } + })(); + + const xetParams: XetTokenParams = { + sessionId: crypto.randomUUID(), + refreshWriteTokenUrl: `${params.hubUrl ?? HUB_URL}/api/${repoId.type}s/${repoId.name}/xet-write-token`, + }; + const sources = splitAsyncGenerator(source, 5); + yield* eventToGenerator((yieldCallback, returnCallback, rejectCallback) => + Promise.all( + sources.map(async function (source) { + for await (const event of uploadShards(source, { + fetch: params.fetch, + accessToken, + hubUrl: params.hubUrl ?? HUB_URL, + repo: repoId, + xetParams, + rev: params.branch ?? "main", + yieldCallback: (event) => yieldCallback({ ...event, state: "uploading" }), + })) { + if (event.event === "file") { + yieldCallback({ + event: "fileProgress" as const, + path: event.path, + progress: 1, + state: "uploading" as const, + }); + xetHashes.set(event.path, event.xetHash); + } else if (event.event === "fileProgress") { + yieldCallback({ + event: "fileProgress" as const, + path: event.path, + progress: event.progress, + state: "uploading" as const, + }); + } + } + }), + ).then(() => returnCallback(undefined), rejectCallback), + ); + + const resp = await (params.fetch ?? fetch)( + `${params.hubUrl ?? HUB_URL}/api/${repoId.type}s/${repoId.name}/batch`, + { + method: "POST", + headers: { + ...(accessToken && { Authorization: `Bearer ${accessToken}` }), + "Content-Type": "application/x-ndjson", + }, + body: [...xetHashes.entries()] + .map(([path, xetHash]) => + JSON.stringify({ + type: "addFile", + path, + xetHash, + }), + ) + .join("\n"), + signal: abortSignal, + }, + ); + + if (!resp.ok && resp.status !== 422) { + throw await createApiError(resp); + } + + const json = (await resp.json()) as ApiBucketBatchResponse; + + for (const failed of json.failed) { + yield { + event: "fileProgress", + path: failed.path, + progress: 0, + state: "error", + }; + } + } + + abortSignal?.throwIfAborted(); + + const deletedOperations = allOperations.filter((operation) => operation.operation === "delete"); + + if (deletedOperations.length > 0) { + const resp = await (params.fetch ?? fetch)( + `${params.hubUrl ?? HUB_URL}/api/${repoId.type}s/${repoId.name}/batch`, + { + method: "POST", + headers: { + ...(accessToken && { Authorization: `Bearer ${accessToken}` }), + "Content-Type": "application/x-ndjson", + }, + body: deletedOperations + .map((operation) => + JSON.stringify({ + type: "deleteFile", + path: operation.path, + }), + ) + .join("\n"), + signal: abortSignal, + }, + ); + + if (!resp.ok) { + throw await createApiError(resp); + } + + const json = await resp.json(); + + if (json.failed.length > 0) { + const failedPaths = json.failed.slice(0, 5).map((f: { path: string }) => f.path); + throw new Error( + `Failed to delete ${json.failed.length} file(s): ${failedPaths.join(", ")}${json.failed.length > 5 ? "..." : ""}, request ID: ${resp.headers.get("X-Request-Id")}`, + ); + } + } + + abortSignal?.throwIfAborted(); + } catch (err) { + // For parallel requests, cancel them all if one fails + abortController.abort(); + throw err; + } +} + +/** + * @returns undefined for bucket uploads, CommitOutput otherwise + */ +export async function commit(params: CommitParams): Promise { + const iterator = commitIter(params); + const failedPaths: string[] = []; + let failedCount = 0; + let res = await iterator.next(); + while (!res.done) { + if (res.value.event === "fileProgress" && res.value.state === "error") { + failedCount++; + if (failedPaths.length < 5) { + failedPaths.push(res.value.path); + } + } + res = await iterator.next(); + } + if (failedCount > 0) { + throw new Error( + `Failed to upload ${failedCount} file(s): ${failedPaths.join(", ")}${failedCount > 5 ? "..." : ""}`, + ); + } + return res.value; +} + +async function convertOperationToNdJson(operation: CommitBlobOperation): Promise { + switch (operation.operation) { + case "addOrUpdate": { + // todo: handle LFS + return { + key: "file", + value: { + content: base64FromBytes(new Uint8Array(await operation.content.arrayBuffer())), + path: operation.path, + encoding: "base64", + }, + }; + } + // case "rename": { + // // todo: detect when remote file is already LFS, and in that case rename as LFS + // return { + // key: "file", + // value: { + // content: operation.content, + // path: operation.path, + // oldPath: operation.oldPath + // } + // }; + // } + case "delete": { + return { + key: "deletedFile", + value: { + path: operation.path, + }, + }; + } + case "edit": { + // Note: By the time we get here, splice operations should have been converted to addOrUpdate operations with SplicedBlob + // But we handle this case for completeness + throw new Error( + "Edit operations should be converted to addOrUpdate operations before reaching convertOperationToNdJson", + ); + } + default: + throw new TypeError("Unknown operation: " + (operation as { operation: string }).operation); + } +} diff --git a/node_modules/@huggingface/hub/src/lib/count-commits.spec.ts b/node_modules/@huggingface/hub/src/lib/count-commits.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..f60754789b7a1b6f1c99765e9fa5d77689478eb8 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/count-commits.spec.ts @@ -0,0 +1,16 @@ +import { assert, it, describe } from "vitest"; +import { countCommits } from "./count-commits"; + +describe("countCommits", () => { + it("should fetch paginated commits from the repo", async () => { + const count = await countCommits({ + repo: { + name: "openai-community/gpt2", + type: "model", + }, + revision: "607a30d783dfa663caf39e06633721c8d4cfcd7e", + }); + + assert.equal(count, 26); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/count-commits.ts b/node_modules/@huggingface/hub/src/lib/count-commits.ts new file mode 100644 index 0000000000000000000000000000000000000000..cdfad30740287de0451543ebf6b28c2ad60de1f2 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/count-commits.ts @@ -0,0 +1,35 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { CredentialsParams, RepoDesignation } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { toRepoId } from "../utils/toRepoId"; + +export async function countCommits( + params: { + repo: RepoDesignation; + /** + * Revision to list commits from. Defaults to the default branch. + */ + revision?: string; + hubUrl?: string; + fetch?: typeof fetch; + } & Partial, +): Promise { + const accessToken = checkCredentials(params); + const repoId = toRepoId(params.repo); + + // Could upgrade to 1000 commits per page + const url: string | undefined = `${params.hubUrl ?? HUB_URL}/api/${repoId.type}s/${repoId.name}/commits/${ + params.revision ?? "main" + }?limit=1`; + + const res: Response = await (params.fetch ?? fetch)(url, { + headers: accessToken ? { Authorization: `Bearer ${accessToken}` } : {}, + }); + + if (!res.ok) { + throw await createApiError(res); + } + + return parseInt(res.headers.get("x-total-count") ?? "0", 10); +} diff --git a/node_modules/@huggingface/hub/src/lib/create-branch.spec.ts b/node_modules/@huggingface/hub/src/lib/create-branch.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..b616fb4cebfd888a23c33bfe3a7b7334d575fd2d --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/create-branch.spec.ts @@ -0,0 +1,159 @@ +import { assert, it, describe } from "vitest"; +import { TEST_ACCESS_TOKEN, TEST_HUB_URL, TEST_USER } from "../test/consts"; +import type { RepoId } from "../types/public"; +import { insecureRandomString } from "../utils/insecureRandomString"; +import { createRepo } from "./create-repo"; +import { deleteRepo } from "./delete-repo"; +import { createBranch } from "./create-branch"; +import { uploadFile } from "./upload-file"; +import { downloadFile } from "./download-file"; + +describe("createBranch", () => { + it("should create a new branch from the default branch", async () => { + const repoName = `${TEST_USER}/TEST-${insecureRandomString()}`; + const repo = { type: "model", name: repoName } satisfies RepoId; + + try { + await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + repo, + }); + + await uploadFile({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + file: { + path: "file.txt", + content: new Blob(["file content"]), + }, + }); + + await createBranch({ + repo, + branch: "new-branch", + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + + const content = await downloadFile({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + path: "file.txt", + revision: "new-branch", + }); + + assert.equal(await content?.text(), "file content"); + } finally { + await deleteRepo({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + } + }); + + it("should create an empty branch", async () => { + const repoName = `${TEST_USER}/TEST-${insecureRandomString()}`; + const repo = { type: "model", name: repoName } satisfies RepoId; + + try { + await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + repo, + }); + + await uploadFile({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + file: { + path: "file.txt", + content: new Blob(["file content"]), + }, + }); + + await createBranch({ + repo, + branch: "empty-branch", + empty: true, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + + const content = await downloadFile({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + path: "file.txt", + revision: "empty-branch", + }); + + assert.equal(content, null); + } finally { + await deleteRepo({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + } + }); + + it("should overwrite an existing branch", async () => { + const repoName = `${TEST_USER}/TEST-${insecureRandomString()}`; + const repo = { type: "model", name: repoName } satisfies RepoId; + + try { + await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + repo, + }); + + await uploadFile({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + file: { + path: "file.txt", + content: new Blob(["file content"]), + }, + }); + + await createBranch({ + repo, + branch: "overwrite-branch", + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + + await createBranch({ + repo, + branch: "overwrite-branch", + overwrite: true, + empty: true, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + + const content = await downloadFile({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + path: "file.txt", + revision: "overwrite-branch", + }); + + assert.equal(content, null); + } finally { + await deleteRepo({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + } + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/create-branch.ts b/node_modules/@huggingface/hub/src/lib/create-branch.ts new file mode 100644 index 0000000000000000000000000000000000000000..41dd204ee38e26d2d2d87b10e98dd85be2eba66d --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/create-branch.ts @@ -0,0 +1,54 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { AccessToken, RepoDesignation } from "../types/public"; +import { toRepoId } from "../utils/toRepoId"; + +export async function createBranch(params: { + repo: RepoDesignation; + /** + * Revision to create the branch from. Defaults to the default branch. + * + * Use empty: true to create an empty branch. + */ + revision?: string; + hubUrl?: string; + accessToken?: AccessToken; + fetch?: typeof fetch; + /** + * The name of the branch to create + */ + branch: string; + /** + * Use this to create an empty branch, with no commits. + */ + empty?: boolean; + /** + * Use this to overwrite the branch if it already exists. + * + * If you only specify `overwrite` and no `revision`/`empty`, and the branch already exists, it will be a no-op. + */ + overwrite?: boolean; +}): Promise { + const repoId = toRepoId(params.repo); + const res = await (params.fetch ?? fetch)( + `${params.hubUrl ?? HUB_URL}/api/${repoId.type}s/${repoId.name}/branch/${encodeURIComponent(params.branch)}`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + ...(params.accessToken && { + Authorization: `Bearer ${params.accessToken}`, + }), + }, + body: JSON.stringify({ + startingPoint: params.revision, + ...(params.empty && { emptyBranch: true }), + overwrite: params.overwrite, + }), + }, + ); + + if (!res.ok) { + throw await createApiError(res); + } +} diff --git a/node_modules/@huggingface/hub/src/lib/create-collection.spec.ts b/node_modules/@huggingface/hub/src/lib/create-collection.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf31e59ed915b9681797da5d81558eed1a806f82 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/create-collection.spec.ts @@ -0,0 +1,38 @@ +import { it, describe, expect } from "vitest"; + +import { TEST_HUB_URL, TEST_ACCESS_TOKEN, TEST_USER } from "../test/consts"; +import { createCollection } from "./create-collection"; +import { deleteCollection } from "./delete-collection"; + +describe("createCollection", () => { + it("should create a collection", async () => { + let slug: string = ""; + const randomString = crypto.randomUUID(); + const title = `Test Collection ${randomString}`; + + try { + const result = await createCollection({ + collection: { + title, + namespace: TEST_USER, + description: "This is a test collection", + private: false, + }, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + + expect(result.slug.startsWith(`${TEST_USER}/test-collection-${randomString}`)).toBe(true); + + slug = result.slug; + } finally { + if (slug) { + await deleteCollection({ + slug, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + } + } + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/create-collection.ts b/node_modules/@huggingface/hub/src/lib/create-collection.ts new file mode 100644 index 0000000000000000000000000000000000000000..97f1a626d99127414d2e94da9e812e60cde6cdef --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/create-collection.ts @@ -0,0 +1,35 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { ApiCreateCollectionPayload } from "../types/api/api-create-collection"; +import type { CredentialsParams } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; + +export async function createCollection( + params: { + collection: ApiCreateCollectionPayload; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise<{ slug: string }> { + const accessToken = checkCredentials(params); + + const res = await (params.fetch ?? fetch)(`${params.hubUrl ?? HUB_URL}/api/collections`, { + method: "POST", + body: JSON.stringify(params.collection), + headers: { + Authorization: `Bearer ${accessToken}`, + "Content-Type": "application/json", + }, + }); + + if (!res.ok) { + throw await createApiError(res); + } + + const output = await res.json(); + + return { slug: output.slug }; +} diff --git a/node_modules/@huggingface/hub/src/lib/create-repo.spec.ts b/node_modules/@huggingface/hub/src/lib/create-repo.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..f91e398e040c7714a75cb148f3571e81ecf745c1 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/create-repo.spec.ts @@ -0,0 +1,106 @@ +import { assert, it, describe, expect } from "vitest"; + +import { TEST_HUB_URL, TEST_ACCESS_TOKEN, TEST_USER } from "../test/consts"; +import { insecureRandomString } from "../utils/insecureRandomString"; +import { createRepo } from "./create-repo"; +import { deleteRepo } from "./delete-repo"; +import { downloadFile } from "./download-file"; + +describe("createRepo", () => { + it("should create a repo", async () => { + const repoName = `${TEST_USER}/TEST-${insecureRandomString()}`; + + const result = await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + repo: { + name: repoName, + type: "model", + }, + hubUrl: TEST_HUB_URL, + files: [{ path: ".gitattributes", content: new Blob(["*.html filter=lfs diff=lfs merge=lfs -text"]) }], + }); + + expect(result).toEqual({ + repoUrl: `${TEST_HUB_URL}/${repoName}`, + id: expect.any(String), + }); + + const content = await downloadFile({ + repo: { + name: repoName, + type: "model", + }, + path: ".gitattributes", + hubUrl: TEST_HUB_URL, + }); + + assert(content); + assert.strictEqual(await content.text(), "*.html filter=lfs diff=lfs merge=lfs -text"); + + await deleteRepo({ + repo: { + name: repoName, + type: "model", + }, + credentials: { accessToken: TEST_ACCESS_TOKEN }, + hubUrl: TEST_HUB_URL, + }); + }); + + it("should throw a client error when trying to create a repo without a fully-qualified name", async () => { + const tryCreate = createRepo({ + repo: { name: "canonical", type: "model" }, + credentials: { accessToken: TEST_ACCESS_TOKEN }, + hubUrl: TEST_HUB_URL, + }); + + await expect(tryCreate).rejects.toBeInstanceOf(TypeError); + }); + + it("should create a model with a string as name", async () => { + const repoName = `${TEST_USER}/TEST-${insecureRandomString()}`; + + const result = await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + repo: repoName, + files: [{ path: ".gitattributes", content: new Blob(["*.html filter=lfs diff=lfs merge=lfs -text"]) }], + }); + + expect(result).toEqual({ + repoUrl: `${TEST_HUB_URL}/${repoName}`, + id: expect.any(String), + }); + + await deleteRepo({ + repo: { + name: repoName, + type: "model", + }, + hubUrl: TEST_HUB_URL, + credentials: { accessToken: TEST_ACCESS_TOKEN }, + }); + }); + + it("should create a dataset with a string as name", async () => { + const repoName = `datasets/${TEST_USER}/TEST-${insecureRandomString()}`; + + const result = await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + repo: repoName, + files: [{ path: ".gitattributes", content: new Blob(["*.html filter=lfs diff=lfs merge=lfs -text"]) }], + }); + + expect(result).toEqual({ + repoUrl: `${TEST_HUB_URL}/${repoName}`, + id: expect.any(String), + }); + + await deleteRepo({ + repo: repoName, + hubUrl: TEST_HUB_URL, + credentials: { accessToken: TEST_ACCESS_TOKEN }, + }); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/create-repo.ts b/node_modules/@huggingface/hub/src/lib/create-repo.ts new file mode 100644 index 0000000000000000000000000000000000000000..5d6ac03a894f2bf2345b16adbe460b6fc14a3482 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/create-repo.ts @@ -0,0 +1,96 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { ApiCreateRepoPayload } from "../types/api/api-create-repo"; +import type { CredentialsParams, RepoDesignation, SpaceSdk } from "../types/public"; +import { base64FromBytes } from "../utils/base64FromBytes"; +import { checkCredentials } from "../utils/checkCredentials"; +import { toRepoId } from "../utils/toRepoId"; + +export async function createRepo( + params: { + repo: RepoDesignation; + /** + * If unset, will follow the organization's default setting. (typically public, except for some Enterprise organizations) + */ + private?: boolean; + resourceGroupId?: string; + /** + * Does not work for buckets + */ + license?: string; + /** + * Only a few lightweight files are supported at repo creation - and not for buckets + */ + files?: Array<{ content: ArrayBuffer | Blob; path: string }>; + /** @required for when {@link repo.type} === "space" */ + sdk?: SpaceSdk; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): Promise<{ repoUrl: string; id: string }> { + const accessToken = checkCredentials(params); + const repoId = toRepoId(params.repo); + const [namespace, repoName] = repoId.name.split("/"); + + if (!namespace || !repoName) { + throw new TypeError( + `"${repoId.name}" is not a fully qualified repo name. It should be of the form "{namespace}/{repoName}".`, + ); + } + + const res = + repoId.type === "bucket" + ? await (params.fetch ?? fetch)(`${params.hubUrl ?? HUB_URL}/api/buckets/${namespace}/${repoName}`, { + method: "POST", + body: JSON.stringify({ + private: params.private, + resourceGroupId: params.resourceGroupId, + }), + headers: { + Authorization: `Bearer ${accessToken}`, + "Content-Type": "application/json", + }, + }) + : await (params.fetch ?? fetch)(`${params.hubUrl ?? HUB_URL}/api/repos/create`, { + method: "POST", + body: JSON.stringify({ + name: repoName, + private: params.private, + organization: namespace, + resourceGroupId: params.resourceGroupId, + license: params.license, + ...(repoId.type === "space" + ? { + type: "space", + sdk: params.sdk ?? "static", + } + : { + type: repoId.type, + }), + files: params.files + ? await Promise.all( + params.files.map(async (file) => ({ + encoding: "base64", + path: file.path, + content: base64FromBytes( + new Uint8Array(file.content instanceof Blob ? await file.content.arrayBuffer() : file.content), + ), + })), + ) + : undefined, + } satisfies ApiCreateRepoPayload), + headers: { + Authorization: `Bearer ${accessToken}`, + "Content-Type": "application/json", + }, + }); + + if (!res.ok) { + throw await createApiError(res); + } + const output = await res.json(); + return { repoUrl: output.url, id: output.id }; +} diff --git a/node_modules/@huggingface/hub/src/lib/dataset-info.spec.ts b/node_modules/@huggingface/hub/src/lib/dataset-info.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..ae235e5e83a308a19c0e4f60692651424d02a902 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/dataset-info.spec.ts @@ -0,0 +1,56 @@ +import { describe, expect, it } from "vitest"; +import { datasetInfo } from "./dataset-info"; +import type { DatasetEntry } from "./list-datasets"; +import type { ApiDatasetInfo } from "../types/api/api-dataset"; + +describe("datasetInfo", () => { + it("should return the dataset info", async () => { + const info = await datasetInfo({ + name: "nyu-mll/glue", + }); + expect(info).toEqual({ + id: "621ffdd236468d709f181e3f", + downloads: expect.any(Number), + gated: false, + name: "nyu-mll/glue", + updatedAt: expect.any(Date), + likes: expect.any(Number), + private: false, + }); + }); + + it("should return the dataset info with author", async () => { + const info: DatasetEntry & Pick = await datasetInfo({ + name: "nyu-mll/glue", + additionalFields: ["author"], + }); + expect(info).toEqual({ + id: "621ffdd236468d709f181e3f", + downloads: expect.any(Number), + gated: false, + name: "nyu-mll/glue", + updatedAt: expect.any(Date), + likes: expect.any(Number), + private: false, + author: "nyu-mll", + }); + }); + + it("should return the dataset info for a specific revision", async () => { + const info: DatasetEntry & Pick = await datasetInfo({ + name: "nyu-mll/glue", + revision: "cb2099c76426ff97da7aa591cbd317d91fb5fcb7", + additionalFields: ["sha"], + }); + expect(info).toEqual({ + id: "621ffdd236468d709f181e3f", + downloads: expect.any(Number), + gated: false, + name: "nyu-mll/glue", + updatedAt: expect.any(Date), + likes: expect.any(Number), + private: false, + sha: "cb2099c76426ff97da7aa591cbd317d91fb5fcb7", + }); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/dataset-info.ts b/node_modules/@huggingface/hub/src/lib/dataset-info.ts new file mode 100644 index 0000000000000000000000000000000000000000..fe34334d69c42caaa9f07b907acac1e6a849bf8e --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/dataset-info.ts @@ -0,0 +1,60 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { ApiDatasetInfo } from "../types/api/api-dataset"; +import type { CredentialsParams } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { pick } from "../utils/pick"; +import { type DATASET_EXPANDABLE_KEYS, DATASET_EXPAND_KEYS, type DatasetEntry } from "./list-datasets"; + +export async function datasetInfo< + const T extends Exclude<(typeof DATASET_EXPANDABLE_KEYS)[number], (typeof DATASET_EXPAND_KEYS)[number]> = never, +>( + params: { + name: string; + hubUrl?: string; + additionalFields?: T[]; + /** + * An optional Git revision id which can be a branch name, a tag, or a commit hash. + */ + revision?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise> { + const accessToken = params && checkCredentials(params); + + const search = new URLSearchParams([ + ...DATASET_EXPAND_KEYS.map((val) => ["expand", val] satisfies [string, string]), + ...(params?.additionalFields?.map((val) => ["expand", val] satisfies [string, string]) ?? []), + ]).toString(); + + const response = await (params.fetch || fetch)( + `${params?.hubUrl || HUB_URL}/api/datasets/${params.name}/revision/${encodeURIComponent( + params.revision ?? "HEAD", + )}?${search.toString()}`, + { + headers: { + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }, + ); + + if (!response.ok) { + throw await createApiError(response); + } + + const data = await response.json(); + + return { + ...(params?.additionalFields && pick(data, params.additionalFields)), + id: data._id, + name: data.id, + private: data.private, + downloads: data.downloads, + likes: data.likes, + gated: data.gated, + updatedAt: new Date(data.lastModified), + } as DatasetEntry & Pick; +} diff --git a/node_modules/@huggingface/hub/src/lib/delete-branch.spec.ts b/node_modules/@huggingface/hub/src/lib/delete-branch.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..dcd253214b671d2393a343bd74447495442e659f --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/delete-branch.spec.ts @@ -0,0 +1,43 @@ +import { it, describe } from "vitest"; +import { TEST_ACCESS_TOKEN, TEST_HUB_URL, TEST_USER } from "../test/consts"; +import type { RepoId } from "../types/public"; +import { insecureRandomString } from "../utils/insecureRandomString"; +import { createRepo } from "./create-repo"; +import { deleteRepo } from "./delete-repo"; +import { createBranch } from "./create-branch"; +import { deleteBranch } from "./delete-branch"; + +describe("deleteBranch", () => { + it("should delete an existing branch", async () => { + const repoName = `${TEST_USER}/TEST-${insecureRandomString()}`; + const repo = { type: "model", name: repoName } satisfies RepoId; + + try { + await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + repo, + }); + + await createBranch({ + repo, + branch: "branch-to-delete", + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + + await deleteBranch({ + repo, + branch: "branch-to-delete", + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + } finally { + await deleteRepo({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + } + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/delete-branch.ts b/node_modules/@huggingface/hub/src/lib/delete-branch.ts new file mode 100644 index 0000000000000000000000000000000000000000..76072f2fe2f852f26565dc123c0507f0e9c445bb --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/delete-branch.ts @@ -0,0 +1,32 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { AccessToken, RepoDesignation } from "../types/public"; +import { toRepoId } from "../utils/toRepoId"; + +export async function deleteBranch(params: { + repo: RepoDesignation; + /** + * The name of the branch to delete + */ + branch: string; + hubUrl?: string; + accessToken?: AccessToken; + fetch?: typeof fetch; +}): Promise { + const repoId = toRepoId(params.repo); + const res = await (params.fetch ?? fetch)( + `${params.hubUrl ?? HUB_URL}/api/${repoId.type}s/${repoId.name}/branch/${encodeURIComponent(params.branch)}`, + { + method: "DELETE", + headers: { + ...(params.accessToken && { + Authorization: `Bearer ${params.accessToken}`, + }), + }, + }, + ); + + if (!res.ok) { + throw await createApiError(res); + } +} diff --git a/node_modules/@huggingface/hub/src/lib/delete-collection-item.ts b/node_modules/@huggingface/hub/src/lib/delete-collection-item.ts new file mode 100644 index 0000000000000000000000000000000000000000..4678514f1a92ae20a0b3963d00a5babdafd10bb7 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/delete-collection-item.ts @@ -0,0 +1,40 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { CredentialsParams } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; + +export async function deleteCollectionItem( + params: { + /** + * The slug of the collection to delete the item from. + */ + slug: string; + /** + * The item object id which is different from the repo_id/paper_id provided when adding the item to the collection. + * This should be the _id property of the item. + */ + itemId: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise { + const accessToken = checkCredentials(params); + + const res = await (params.fetch ?? fetch)( + `${params.hubUrl ?? HUB_URL}/api/collections/${params.slug}/items/${params.itemId}`, + { + method: "DELETE", + headers: { + Authorization: `Bearer ${accessToken}`, + "Content-Type": "application/json", + }, + }, + ); + + if (!res.ok) { + throw await createApiError(res); + } +} diff --git a/node_modules/@huggingface/hub/src/lib/delete-collection.ts b/node_modules/@huggingface/hub/src/lib/delete-collection.ts new file mode 100644 index 0000000000000000000000000000000000000000..1bffe064ac43afe20db7f0b58a03da0e865fd2cb --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/delete-collection.ts @@ -0,0 +1,36 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { CredentialsParams } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; + +export async function deleteCollection( + params: { + /** + * The slug of the collection to delete. + */ + slug: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise { + if (!params.slug) { + throw new TypeError("slug is required"); + } + + const accessToken = checkCredentials(params); + + const res = await (params.fetch ?? fetch)(`${params.hubUrl ?? HUB_URL}/api/collections/${params.slug}`, { + method: "DELETE", + headers: { + Authorization: `Bearer ${accessToken}`, + "Content-Type": "application/json", + }, + }); + + if (!res.ok) { + throw await createApiError(res); + } +} diff --git a/node_modules/@huggingface/hub/src/lib/delete-file.spec.ts b/node_modules/@huggingface/hub/src/lib/delete-file.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..67ce0d2dfe1f3169c05bbd66568ade9d73167d8f --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/delete-file.spec.ts @@ -0,0 +1,65 @@ +import { assert, it, describe, expect } from "vitest"; + +import { TEST_ACCESS_TOKEN, TEST_HUB_URL, TEST_USER } from "../test/consts"; +import type { RepoId } from "../types/public"; +import { insecureRandomString } from "../utils/insecureRandomString"; +import { createRepo } from "./create-repo"; +import { deleteRepo } from "./delete-repo"; +import { deleteFile } from "./delete-file"; +import { downloadFile } from "./download-file"; + +describe("deleteFile", () => { + it("should delete a file", async () => { + const repoName = `${TEST_USER}/TEST-${insecureRandomString()}`; + const repo = { type: "model", name: repoName } satisfies RepoId; + + try { + const result = await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + repo, + files: [ + { path: "file1", content: new Blob(["file1"]) }, + { path: "file2", content: new Blob(["file2"]) }, + ], + }); + + expect(result).toEqual({ + repoUrl: `${TEST_HUB_URL}/${repoName}`, + id: expect.any(String), + }); + + let content = await downloadFile({ + hubUrl: TEST_HUB_URL, + repo, + path: "file1", + }); + + assert.strictEqual(await content?.text(), "file1"); + + await deleteFile({ path: "file1", repo, accessToken: TEST_ACCESS_TOKEN, hubUrl: TEST_HUB_URL }); + + content = await downloadFile({ + repo, + path: "file1", + hubUrl: TEST_HUB_URL, + }); + + assert.strictEqual(content, null); + + content = await downloadFile({ + repo, + path: "file2", + hubUrl: TEST_HUB_URL, + }); + + assert.strictEqual(await content?.text(), "file2"); + } finally { + await deleteRepo({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + } + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/delete-file.ts b/node_modules/@huggingface/hub/src/lib/delete-file.ts new file mode 100644 index 0000000000000000000000000000000000000000..36c550dfc88e2afdbaf14c5402290c8e859353e5 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/delete-file.ts @@ -0,0 +1,35 @@ +import type { CredentialsParams } from "../types/public"; +import type { CommitOutput, CommitParams } from "./commit"; +import { commit } from "./commit"; + +export function deleteFile( + params: { + repo: CommitParams["repo"]; + path: string; + commitTitle?: CommitParams["title"]; + commitDescription?: CommitParams["description"]; + hubUrl?: CommitParams["hubUrl"]; + fetch?: CommitParams["fetch"]; + branch?: CommitParams["branch"]; + isPullRequest?: CommitParams["isPullRequest"]; + parentCommit?: CommitParams["parentCommit"]; + } & CredentialsParams, +): Promise { + return commit({ + ...(params.accessToken ? { accessToken: params.accessToken } : { credentials: params.credentials }), + repo: params.repo, + operations: [ + { + operation: "delete", + path: params.path, + }, + ], + title: params.commitTitle ?? `Delete ${params.path}`, + description: params.commitDescription, + hubUrl: params.hubUrl, + branch: params.branch, + isPullRequest: params.isPullRequest, + parentCommit: params.parentCommit, + fetch: params.fetch, + }); +} diff --git a/node_modules/@huggingface/hub/src/lib/delete-files.spec.ts b/node_modules/@huggingface/hub/src/lib/delete-files.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..4d3f0a993c2de26ef9fa4669698aed4b6fcf344f --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/delete-files.spec.ts @@ -0,0 +1,82 @@ +import { assert, it, describe, expect } from "vitest"; + +import { TEST_HUB_URL, TEST_ACCESS_TOKEN, TEST_USER } from "../test/consts"; +import type { RepoId } from "../types/public"; +import { insecureRandomString } from "../utils/insecureRandomString"; +import { createRepo } from "./create-repo"; +import { deleteRepo } from "./delete-repo"; +import { deleteFiles } from "./delete-files"; +import { downloadFile } from "./download-file"; + +describe("deleteFiles", () => { + it("should delete multiple files", async () => { + const repoName = `${TEST_USER}/TEST-${insecureRandomString()}`; + const repo = { type: "model", name: repoName } satisfies RepoId; + + try { + const result = await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + repo, + files: [ + { path: "file1", content: new Blob(["file1"]) }, + { path: "file2", content: new Blob(["file2"]) }, + { path: "file3", content: new Blob(["file3"]) }, + ], + hubUrl: TEST_HUB_URL, + }); + + expect(result).toEqual({ + repoUrl: `${TEST_HUB_URL}/${repoName}`, + id: expect.any(String), + }); + + let content = await downloadFile({ + repo, + path: "file1", + hubUrl: TEST_HUB_URL, + }); + + assert.strictEqual(await content?.text(), "file1"); + + content = await downloadFile({ + repo, + path: "file2", + hubUrl: TEST_HUB_URL, + }); + + assert.strictEqual(await content?.text(), "file2"); + + await deleteFiles({ paths: ["file1", "file2"], repo, accessToken: TEST_ACCESS_TOKEN, hubUrl: TEST_HUB_URL }); + + content = await downloadFile({ + repo, + path: "file1", + hubUrl: TEST_HUB_URL, + }); + + assert.strictEqual(content, null); + + content = await downloadFile({ + repo, + path: "file2", + hubUrl: TEST_HUB_URL, + }); + + assert.strictEqual(content, null); + + content = await downloadFile({ + repo, + path: "file3", + hubUrl: TEST_HUB_URL, + }); + + assert.strictEqual(await content?.text(), "file3"); + } finally { + await deleteRepo({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + } + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/delete-files.ts b/node_modules/@huggingface/hub/src/lib/delete-files.ts new file mode 100644 index 0000000000000000000000000000000000000000..6242c4a99b5f14b30521c8efcc117e5223088b55 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/delete-files.ts @@ -0,0 +1,33 @@ +import type { CredentialsParams } from "../types/public"; +import type { CommitOutput, CommitParams } from "./commit"; +import { commit } from "./commit"; + +export function deleteFiles( + params: { + repo: CommitParams["repo"]; + paths: string[]; + commitTitle?: CommitParams["title"]; + commitDescription?: CommitParams["description"]; + hubUrl?: CommitParams["hubUrl"]; + branch?: CommitParams["branch"]; + isPullRequest?: CommitParams["isPullRequest"]; + parentCommit?: CommitParams["parentCommit"]; + fetch?: CommitParams["fetch"]; + } & CredentialsParams, +): Promise { + return commit({ + ...(params.accessToken ? { accessToken: params.accessToken } : { credentials: params.credentials }), + repo: params.repo, + operations: params.paths.map((path) => ({ + operation: "delete", + path, + })), + title: params.commitTitle ?? `Deletes ${params.paths.length} files`, + description: params.commitDescription, + hubUrl: params.hubUrl, + branch: params.branch, + isPullRequest: params.isPullRequest, + parentCommit: params.parentCommit, + fetch: params.fetch, + }); +} diff --git a/node_modules/@huggingface/hub/src/lib/delete-repo.ts b/node_modules/@huggingface/hub/src/lib/delete-repo.ts new file mode 100644 index 0000000000000000000000000000000000000000..efa2fe985b1bfdbf4b040dc10099cd394eae7167 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/delete-repo.ts @@ -0,0 +1,46 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { CredentialsParams, RepoDesignation } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { toRepoId } from "../utils/toRepoId"; + +export async function deleteRepo( + params: { + repo: RepoDesignation; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): Promise { + const accessToken = checkCredentials(params); + const repoId = toRepoId(params.repo); + const [namespace, repoName] = repoId.name.split("/"); + + const res = + repoId.type === "bucket" + ? await (params.fetch ?? fetch)(`${params.hubUrl ?? HUB_URL}/api/buckets/${namespace}/${repoName}`, { + method: "DELETE", + headers: { + Authorization: `Bearer ${accessToken}`, + "Content-Type": "application/json", + }, + }) + : await (params.fetch ?? fetch)(`${params.hubUrl ?? HUB_URL}/api/repos/delete`, { + method: "DELETE", + body: JSON.stringify({ + name: repoName, + organization: namespace, + type: repoId.type, + }), + headers: { + Authorization: `Bearer ${accessToken}`, + "Content-Type": "application/json", + }, + }); + + if (!res.ok) { + throw await createApiError(res); + } +} diff --git a/node_modules/@huggingface/hub/src/lib/download-file-to-cache-dir.spec.ts b/node_modules/@huggingface/hub/src/lib/download-file-to-cache-dir.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..22213418dc966378e02356d11e5bda68485b47db --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/download-file-to-cache-dir.spec.ts @@ -0,0 +1,306 @@ +import { expect, test, describe, vi, beforeEach } from "vitest"; +import type { RepoDesignation, RepoId } from "../types/public"; +import { dirname, join } from "node:path"; +import { lstat, mkdir, stat, symlink, rename } from "node:fs/promises"; +import { pathsInfo } from "./paths-info"; +import { createWriteStream, type Stats } from "node:fs"; +import { getHFHubCachePath, getRepoFolderName } from "./cache-management"; +import { toRepoId } from "../utils/toRepoId"; +import { downloadFileToCacheDir } from "./download-file-to-cache-dir"; +import { createSymlink } from "../utils/symlink"; + +vi.mock("node:fs/promises", () => ({ + rename: vi.fn(), + symlink: vi.fn(), + lstat: vi.fn(), + mkdir: vi.fn(), + stat: vi.fn(), +})); + +vi.mock("node:fs", () => ({ + createWriteStream: vi.fn(), +})); + +vi.mock("./paths-info", () => ({ + pathsInfo: vi.fn(), +})); + +vi.mock("../utils/symlink", () => ({ + createSymlink: vi.fn(), +})); + +const DUMMY_REPO: RepoId = { + name: "hello-world", + type: "model", +}; + +const DUMMY_ETAG = "dummy-etag"; + +// utility test method to get blob file path +function _getBlobFile(params: { + repo: RepoDesignation; + etag: string; + cacheDir?: string; // default to {@link getHFHubCache} +}) { + return join(params.cacheDir ?? getHFHubCachePath(), getRepoFolderName(toRepoId(params.repo)), "blobs", params.etag); +} + +// utility test method to get snapshot file path +function _getSnapshotFile(params: { + repo: RepoDesignation; + path: string; + revision: string; + cacheDir?: string; // default to {@link getHFHubCache} +}) { + return join( + params.cacheDir ?? getHFHubCachePath(), + getRepoFolderName(toRepoId(params.repo)), + "snapshots", + params.revision, + params.path, + ); +} + +describe("downloadFileToCacheDir", () => { + const fetchMock: typeof fetch = vi.fn(); + beforeEach(() => { + vi.resetAllMocks(); + // mock 200 request + vi.mocked(fetchMock).mockResolvedValue( + new Response("dummy-body", { + status: 200, + headers: { + etag: DUMMY_ETAG, + "Content-Range": "bytes 0-54/55", + }, + }), + ); + + // prevent to use caching + vi.mocked(stat).mockRejectedValue(new Error("Do not exists")); + vi.mocked(lstat).mockRejectedValue(new Error("Do not exists")); + }); + + test("should throw an error if fileDownloadInfo return nothing", async () => { + await expect(async () => { + await downloadFileToCacheDir({ + repo: DUMMY_REPO, + path: "/README.md", + fetch: fetchMock, + }); + }).rejects.toThrowError("cannot get path info for /README.md"); + + expect(pathsInfo).toHaveBeenCalledWith( + expect.objectContaining({ + repo: DUMMY_REPO, + paths: ["/README.md"], + fetch: fetchMock, + }), + ); + }); + + test("existing symlinked and blob should not re-download it", async () => { + // ///snapshots/README.md + const expectPointer = _getSnapshotFile({ + repo: DUMMY_REPO, + path: "/README.md", + revision: "dd4bc8b21efa05ec961e3efc4ee5e3832a3679c7", + }); + // stat ensure a symlink and the pointed file exists + vi.mocked(stat).mockResolvedValue({} as Stats); // prevent default mocked reject + + const output = await downloadFileToCacheDir({ + repo: DUMMY_REPO, + path: "/README.md", + fetch: fetchMock, + revision: "dd4bc8b21efa05ec961e3efc4ee5e3832a3679c7", + }); + + expect(stat).toHaveBeenCalledOnce(); + // Get call argument for stat + const starArg = vi.mocked(stat).mock.calls[0][0]; + + expect(starArg).toBe(expectPointer); + expect(fetchMock).not.toHaveBeenCalledWith(); + + expect(output).toBe(expectPointer); + }); + + test("existing symlinked and blob with default revision should not re-download it", async () => { + // ///snapshots/README.md + const expectPointer = _getSnapshotFile({ + repo: DUMMY_REPO, + path: "/README.md", + revision: "main", + }); + // stat ensure a symlink and the pointed file exists + vi.mocked(stat).mockResolvedValue({} as Stats); // prevent default mocked reject + vi.mocked(lstat).mockResolvedValue({} as Stats); + vi.mocked(pathsInfo).mockResolvedValue([ + { + oid: DUMMY_ETAG, + size: 55, + path: "README.md", + type: "file", + lastCommit: { + date: new Date(), + id: "main", + title: "Commit msg", + }, + }, + ]); + + const output = await downloadFileToCacheDir({ + repo: DUMMY_REPO, + path: "/README.md", + fetch: fetchMock, + }); + + expect(stat).toHaveBeenCalledOnce(); + expect(symlink).not.toHaveBeenCalledOnce(); + // Get call argument for stat + const starArg = vi.mocked(stat).mock.calls[0][0]; + + expect(starArg).toBe(expectPointer); + expect(fetchMock).not.toHaveBeenCalledWith(); + + expect(output).toBe(expectPointer); + }); + + test("existing blob should only create the symlink", async () => { + // ///snapshots/README.md + const expectPointer = _getSnapshotFile({ + repo: DUMMY_REPO, + path: "/README.md", + revision: "dummy-commit-hash", + }); + // //blobs/ + const expectedBlob = _getBlobFile({ + repo: DUMMY_REPO, + etag: DUMMY_ETAG, + }); + + // mock existing blob only no symlink + vi.mocked(lstat).mockResolvedValue({} as Stats); + // mock pathsInfo resolve content + vi.mocked(pathsInfo).mockResolvedValue([ + { + oid: DUMMY_ETAG, + size: 55, + path: "README.md", + type: "file", + lastCommit: { + date: new Date(), + id: "dummy-commit-hash", + title: "Commit msg", + }, + }, + ]); + + const output = await downloadFileToCacheDir({ + repo: DUMMY_REPO, + path: "/README.md", + fetch: fetchMock, + }); + + // should have check for the blob + expect(lstat).toHaveBeenCalled(); + expect(vi.mocked(lstat).mock.calls[0][0]).toBe(expectedBlob); + + // symlink should have been created + expect(createSymlink).toHaveBeenCalledOnce(); + // no download done + expect(fetchMock).not.toHaveBeenCalled(); + + expect(output).toBe(expectPointer); + }); + + test("expect resolve value to be the pointer path of downloaded file", async () => { + // ///snapshots/README.md + const expectPointer = _getSnapshotFile({ + repo: DUMMY_REPO, + path: "/README.md", + revision: "dummy-commit-hash", + }); + // //blobs/ + const expectedBlob = _getBlobFile({ + repo: DUMMY_REPO, + etag: DUMMY_ETAG, + }); + + vi.mocked(pathsInfo).mockResolvedValue([ + { + oid: DUMMY_ETAG, + size: 55, + path: "README.md", + type: "file", + lastCommit: { + date: new Date(), + id: "dummy-commit-hash", + title: "Commit msg", + }, + }, + ]); + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + vi.mocked(createWriteStream).mockReturnValue(async function* () {} as any); + + const output = await downloadFileToCacheDir({ + repo: DUMMY_REPO, + path: "/README.md", + fetch: fetchMock, + }); + + // expect blobs and snapshots folder to have been mkdir + expect(vi.mocked(mkdir).mock.calls[0][0]).toBe(dirname(expectedBlob)); + expect(vi.mocked(mkdir).mock.calls[1][0]).toBe(dirname(expectPointer)); + + expect(output).toBe(expectPointer); + }); + + test("should write fetch response to blob", async () => { + // ///snapshots/README.md + const expectPointer = _getSnapshotFile({ + repo: DUMMY_REPO, + path: "/README.md", + revision: "dummy-commit-hash", + }); + // //blobs/ + const expectedBlob = _getBlobFile({ + repo: DUMMY_REPO, + etag: DUMMY_ETAG, + }); + + // mock pathsInfo resolve content + vi.mocked(pathsInfo).mockResolvedValue([ + { + oid: DUMMY_ETAG, + size: 55, + path: "README.md", + type: "file", + lastCommit: { + date: new Date(), + id: "dummy-commit-hash", + title: "Commit msg", + }, + }, + ]); + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + vi.mocked(createWriteStream).mockReturnValue(async function* () {} as any); + + await downloadFileToCacheDir({ + repo: DUMMY_REPO, + path: "/README.md", + fetch: fetchMock, + }); + + const incomplete = `${expectedBlob}.incomplete`; + // 1. should write fetch#response#body to incomplete file + expect(createWriteStream).toHaveBeenCalledWith(incomplete); + // 2. should rename the incomplete to the blob expected name + expect(rename).toHaveBeenCalledWith(incomplete, expectedBlob); + // 3. should create symlink pointing to blob + expect(createSymlink).toHaveBeenCalledWith({ sourcePath: expectedBlob, finalPath: expectPointer }); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/download-file-to-cache-dir.ts b/node_modules/@huggingface/hub/src/lib/download-file-to-cache-dir.ts new file mode 100644 index 0000000000000000000000000000000000000000..89ca83b56ab8168a410094b6bfa501f00f8d7d9a --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/download-file-to-cache-dir.ts @@ -0,0 +1,138 @@ +import { getHFHubCachePath, getRepoFolderName } from "./cache-management"; +import { dirname, join } from "node:path"; +import { rename, lstat, mkdir, stat } from "node:fs/promises"; +import type { CommitInfo, PathInfo } from "./paths-info"; +import { pathsInfo } from "./paths-info"; +import type { CredentialsParams, RepoDesignation } from "../types/public"; +import { toRepoId } from "../utils/toRepoId"; +import { downloadFile } from "./download-file"; +import { createSymlink } from "../utils/symlink"; +import { Readable } from "node:stream"; +import type { ReadableStream } from "node:stream/web"; +import { pipeline } from "node:stream/promises"; +import { createWriteStream } from "node:fs"; + +export const REGEX_COMMIT_HASH: RegExp = new RegExp("^[0-9a-f]{40}$"); + +function getFilePointer(storageFolder: string, revision: string, relativeFilename: string): string { + const snapshotPath = join(storageFolder, "snapshots"); + return join(snapshotPath, revision, relativeFilename); +} + +/** + * handy method to check if a file exists, or the pointer of a symlinks exists + * @param path + * @param followSymlinks + */ +async function exists(path: string, followSymlinks?: boolean): Promise { + try { + if (followSymlinks) { + await stat(path); + } else { + await lstat(path); + } + return true; + } catch (err: unknown) { + return false; + } +} + +/** + * Download a given file if it's not already present in the local cache. + * @param params + * @return the symlink to the blob object + */ +export async function downloadFileToCacheDir( + params: { + repo: RepoDesignation; + path: string; + /** + * If true, will download the raw git file. + * + * For example, when calling on a file stored with Git LFS, the pointer file will be downloaded instead. + */ + raw?: boolean; + /** + * An optional Git revision id which can be a branch name, a tag, or a commit hash. + * + * @default "main" + */ + revision?: string; + hubUrl?: string; + cacheDir?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise { + // get revision provided or default to main + const revision = params.revision ?? "main"; + const cacheDir = params.cacheDir ?? getHFHubCachePath(); + // get repo id + const repoId = toRepoId(params.repo); + // get storage folder + const storageFolder = join(cacheDir, getRepoFolderName(repoId)); + + let commitHash: string | undefined; + + // if user provides a commitHash as revision, and they already have the file on disk, shortcut everything. + if (REGEX_COMMIT_HASH.test(revision)) { + commitHash = revision; + const pointerPath = getFilePointer(storageFolder, revision, params.path); + if (await exists(pointerPath, true)) return pointerPath; + } + + const pathsInformation: (PathInfo & { lastCommit: CommitInfo })[] = await pathsInfo({ + ...params, + paths: [params.path], + revision: revision, + expand: true, + }); + if (!pathsInformation || pathsInformation.length !== 1) throw new Error(`cannot get path info for ${params.path}`); + + let etag: string; + if (pathsInformation[0].lfs) { + etag = pathsInformation[0].lfs.oid; // get the LFS pointed file oid + } else { + etag = pathsInformation[0].oid; // get the repo file if not a LFS pointer + } + + const pointerPath = getFilePointer(storageFolder, commitHash ?? pathsInformation[0].lastCommit.id, params.path); + const blobPath = join(storageFolder, "blobs", etag); + + // if we have the pointer file, we can shortcut the download + if (await exists(pointerPath, true)) return pointerPath; + + // mkdir blob and pointer path parent directory + await mkdir(dirname(blobPath), { recursive: true }); + await mkdir(dirname(pointerPath), { recursive: true }); + + // We might already have the blob but not the pointer + // shortcut the download if needed + if (await exists(blobPath)) { + // create symlinks in snapshot folder to blob object + await createSymlink({ sourcePath: blobPath, finalPath: pointerPath }); + return pointerPath; + } + + const incomplete = `${blobPath}.incomplete`; + console.debug(`Downloading ${params.path} to ${incomplete}`); + + const blob: Blob | null = await downloadFile({ + ...params, + revision: commitHash, + }); + + if (!blob) { + throw new Error(`invalid response for file ${params.path}`); + } + + await pipeline(Readable.fromWeb(blob.stream() as ReadableStream), createWriteStream(incomplete)); + + // rename .incomplete file to expect blob + await rename(incomplete, blobPath); + // create symlinks in snapshot folder to blob object + await createSymlink({ sourcePath: blobPath, finalPath: pointerPath }); + return pointerPath; +} diff --git a/node_modules/@huggingface/hub/src/lib/download-file.spec.ts b/node_modules/@huggingface/hub/src/lib/download-file.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..30cfb0337a1241b485afceaadc4c55ef0d4d9864 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/download-file.spec.ts @@ -0,0 +1,83 @@ +import { expect, test, describe, assert } from "vitest"; +import { downloadFile } from "./download-file"; +import { deleteRepo } from "./delete-repo"; +import { createRepo } from "./create-repo"; +import { TEST_ACCESS_TOKEN, TEST_HUB_URL, TEST_USER } from "../test/consts"; +import { insecureRandomString } from "../utils/insecureRandomString"; + +describe("downloadFile", () => { + test("should download regular file", async () => { + const blob = await downloadFile({ + repo: { + type: "model", + name: "openai-community/gpt2", + }, + path: "README.md", + }); + + const text = await blob?.slice(0, 1000).text(); + assert( + text?.includes(`--- +language: en +tags: +- exbert + +license: mit +--- + + +# GPT-2 + +Test the whole generation capabilities here: https://transformer.huggingface.co/doc/gpt2-large`), + ); + }); + test("should downoad xet file", async () => { + const blob = await downloadFile({ + repo: { + type: "model", + name: "celinah/xet-experiments", + }, + path: "large_text.txt", + }); + + const text = await blob?.slice(0, 100).text(); + expect(text).toMatch("this is a text file.".repeat(10).slice(0, 100)); + }); + + test("should download private file", async () => { + const repoName = `datasets/${TEST_USER}/TEST-${insecureRandomString()}`; + + const result = await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + private: true, + repo: repoName, + files: [{ path: ".gitattributes", content: new Blob(["*.html filter=lfs diff=lfs merge=lfs -text"]) }], + }); + + expect(result).toEqual({ + repoUrl: `${TEST_HUB_URL}/${repoName}`, + id: expect.any(String), + }); + + try { + const blob = await downloadFile({ + repo: repoName, + path: ".gitattributes", + hubUrl: TEST_HUB_URL, + accessToken: TEST_ACCESS_TOKEN, + }); + + assert(blob, "File should be found"); + + const text = await blob?.text(); + assert.strictEqual(text, "*.html filter=lfs diff=lfs merge=lfs -text"); + } finally { + await deleteRepo({ + repo: repoName, + hubUrl: TEST_HUB_URL, + accessToken: TEST_ACCESS_TOKEN, + }); + } + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/download-file.ts b/node_modules/@huggingface/hub/src/lib/download-file.ts new file mode 100644 index 0000000000000000000000000000000000000000..264cff2ca20aae53e8de918d788cf814806875cf --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/download-file.ts @@ -0,0 +1,78 @@ +import type { CredentialsParams, RepoDesignation } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { WebBlob } from "../utils/WebBlob"; +import { XetBlob } from "../utils/XetBlob"; +import type { XetReadToken } from "../utils/XetBlob"; +import type { FileDownloadInfoOutput } from "./file-download-info"; +import { fileDownloadInfo } from "./file-download-info"; + +/** + * @returns null when the file doesn't exist + */ +export async function downloadFile( + params: { + repo: RepoDesignation; + path: string; + /** + * If true, will download the raw git file. + * + * For example, when calling on a file stored with Git LFS, the pointer file will be downloaded instead. + */ + raw?: boolean; + /** + * An optional Git revision id which can be a branch name, a tag, or a commit hash. + * + * @default "main" + */ + revision?: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + /** + * Whether to use the xet protocol to download the file (if applicable). + * + * When an object with `readToken` is provided along with `downloadInfo`, + * the xet download can skip the token refresh roundtrip. + * + * @default true + */ + xet?: boolean | { readToken: XetReadToken }; + /** + * Can save an http request if provided + */ + downloadInfo?: FileDownloadInfoOutput; + } & Partial, +): Promise { + const accessToken = checkCredentials(params); + + const info = + params.downloadInfo ?? + (await fileDownloadInfo({ + accessToken, + repo: params.repo, + path: params.path, + revision: params.revision, + hubUrl: params.hubUrl, + fetch: params.fetch, + raw: params.raw, + })); + + if (!info) { + return null; + } + + if (info.xet && params.xet !== false) { + return new XetBlob({ + refreshUrl: info.xet.refreshUrl.href, + reconstructionUrl: info.xet.reconstructionUrl.href, + fetch: params.fetch, + accessToken, + size: info.size, + readToken: typeof params.xet === "object" ? params.xet.readToken : undefined, + }); + } + + return new WebBlob(new URL(info.url), 0, info.size, "", true, params.fetch ?? fetch, accessToken); +} diff --git a/node_modules/@huggingface/hub/src/lib/file-download-info.spec.ts b/node_modules/@huggingface/hub/src/lib/file-download-info.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..0a18cc757384513a08f8b2cf23ae6593e191b970 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/file-download-info.spec.ts @@ -0,0 +1,59 @@ +import { assert, it, describe } from "vitest"; +import { fileDownloadInfo } from "./file-download-info"; + +describe("fileDownloadInfo", () => { + it("should fetch LFS file info", async () => { + const info = await fileDownloadInfo({ + repo: { + name: "google-bert/bert-base-uncased", + type: "model", + }, + path: "tf_model.h5", + revision: "dd4bc8b21efa05ec961e3efc4ee5e3832a3679c7", + }); + + assert.strictEqual(info?.size, 536063208); + assert.strictEqual(info?.etag, '"a7a17d6d844b5de815ccab5f42cad6d24496db3850a2a43d8258221018ce87d2"'); + }); + + it("should fetch raw LFS pointer info", async () => { + const info = await fileDownloadInfo({ + repo: { + name: "google-bert/bert-base-uncased", + type: "model", + }, + path: "tf_model.h5", + revision: "dd4bc8b21efa05ec961e3efc4ee5e3832a3679c7", + raw: true, + }); + + assert.strictEqual(info?.size, 134); + assert.strictEqual(info?.etag, '"9eb98c817f04b051b3bcca591bcd4e03cec88018"'); + }); + + it("should fetch non-LFS file info", async () => { + const info = await fileDownloadInfo({ + repo: { + name: "google-bert/bert-base-uncased", + type: "model", + }, + path: "tokenizer_config.json", + revision: "1a7dd4986e3dab699c24ca19b2afd0f5e1a80f37", + }); + + assert.strictEqual(info?.size, 28); + assert.strictEqual(info?.etag, '"a661b1a138dac6dc5590367402d100765010ffd6"'); + }); + + it("should fetch xet file info", async () => { + const info = await fileDownloadInfo({ + repo: { + type: "model", + name: "celinah/xet-experiments", + }, + path: "large_text.txt", + }); + assert.strictEqual(info?.size, 62914580); + assert.strictEqual(info?.etag, '"c27f98578d9363b27db0bc1cbd9c692f8e6e90ae98c38cee7bc0a88829debd17"'); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/file-download-info.ts b/node_modules/@huggingface/hub/src/lib/file-download-info.ts new file mode 100644 index 0000000000000000000000000000000000000000..1ed6f938ae600e821518a04919b6122df10944ac --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/file-download-info.ts @@ -0,0 +1,151 @@ +import { HUB_URL } from "../consts"; +import { createApiError, InvalidApiResponseFormatError } from "../error"; +import type { CredentialsParams, RepoDesignation } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { parseLinkHeader } from "../utils/parseLinkHeader"; +import { toRepoId } from "../utils/toRepoId"; + +export interface XetFileInfo { + hash: string; + refreshUrl: URL; + /** + * Can be directly used instead of the hash. + */ + reconstructionUrl: URL; +} + +export interface FileDownloadInfoOutput { + size: number; + etag: string; + xet?: XetFileInfo; + // URL to fetch (with the access token if private file) + url: string; +} +/** + * @returns null when the file doesn't exist + */ +export async function fileDownloadInfo( + params: { + repo: RepoDesignation; + path: string; + revision?: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + /** + * To get the raw pointer file behind a LFS file + */ + raw?: boolean; + /** + * To avoid the content-disposition header in the `downloadLink` for LFS files + * + * So that on browsers you can use the URL in an iframe for example + */ + noContentDisposition?: boolean; + } & Partial, +): Promise { + const accessToken = checkCredentials(params); + const repoId = toRepoId(params.repo); + + const hubUrl = params.hubUrl ?? HUB_URL; + const url = + `${hubUrl}/${repoId.type === "model" ? "" : `${repoId.type}s/`}${repoId.name}/${ + params.raw ? "raw" : "resolve" + }/${encodeURIComponent(params.revision ?? "main")}/${params.path}` + + (params.noContentDisposition ? "?noContentDisposition=1" : ""); + + const resp = await (params.fetch ?? fetch)(url, { + method: "GET", + headers: { + ...(accessToken && { + Authorization: `Bearer ${accessToken}`, + }), + Range: "bytes=0-0", + Accept: "application/vnd.xet-fileinfo+json, */*", + }, + }); + + if (resp.status === 404 && resp.headers.get("X-Error-Code") === "EntryNotFound") { + return null; + } + + if (!resp.ok) { + throw await createApiError(resp); + } + + let size: number | undefined; + let xetInfo: XetFileInfo | undefined; + + if (resp.headers.get("Content-Type")?.includes("application/vnd.xet-fileinfo+json")) { + size = parseInt(resp.headers.get("X-Linked-Size") ?? "invalid"); + if (isNaN(size)) { + throw new InvalidApiResponseFormatError("Invalid file size received in X-Linked-Size header"); + } + + const hash = resp.headers.get("X-Xet-Hash"); + const links = parseLinkHeader(resp.headers.get("Link") ?? ""); + + const reconstructionUrl = (() => { + try { + return new URL(links["xet-reconstruction-info"]); + } catch { + return null; + } + })(); + const refreshUrl = (() => { + try { + return new URL(links["xet-auth"]); + } catch { + return null; + } + })(); + + if (!hash) { + throw new InvalidApiResponseFormatError("No hash received in X-Xet-Hash header"); + } + + if (!reconstructionUrl || !refreshUrl) { + throw new InvalidApiResponseFormatError("No xet-reconstruction-info or xet-auth link header"); + } + xetInfo = { + hash, + refreshUrl, + reconstructionUrl, + }; + } + + if (size === undefined || isNaN(size)) { + const contentRangeHeader = resp.headers.get("content-range"); + + if (!contentRangeHeader) { + throw new InvalidApiResponseFormatError("Expected size information"); + } + + const [, parsedSize] = contentRangeHeader.split("/"); + size = parseInt(parsedSize); + + if (isNaN(size)) { + throw new InvalidApiResponseFormatError("Invalid file size received"); + } + } + + const etag = resp.headers.get("X-Linked-ETag") ?? resp.headers.get("ETag") ?? undefined; + + if (!etag) { + throw new InvalidApiResponseFormatError("Expected ETag"); + } + + return { + etag, + size, + xet: xetInfo, + // Cannot use resp.url in case it's a S3 url and the user adds an Authorization header to it. + url: + resp.url && + (new URL(resp.url).origin === new URL(hubUrl).origin || resp.headers.get("X-Cache")?.endsWith(" cloudfront")) + ? resp.url + : url, + }; +} diff --git a/node_modules/@huggingface/hub/src/lib/file-exists.spec.ts b/node_modules/@huggingface/hub/src/lib/file-exists.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..54c8ccd90e2623a2790377146128a949006a539f --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/file-exists.spec.ts @@ -0,0 +1,30 @@ +import { assert, it, describe } from "vitest"; +import { fileExists } from "./file-exists"; + +describe("fileExists", () => { + it("should return true for file that exists", async () => { + const info = await fileExists({ + repo: { + name: "google-bert/bert-base-uncased", + type: "model", + }, + path: "tf_model.h5", + revision: "dd4bc8b21efa05ec961e3efc4ee5e3832a3679c7", + }); + + assert(info, "file should exist"); + }); + + it("should return false for file that does not exist", async () => { + const info = await fileExists({ + repo: { + name: "google-bert/bert-base-uncased", + type: "model", + }, + path: "tf_model.h5dadazdzazd", + revision: "dd4bc8b21efa05ec961e3efc4ee5e3832a3679c7", + }); + + assert(!info, "file should not exist"); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/file-exists.ts b/node_modules/@huggingface/hub/src/lib/file-exists.ts new file mode 100644 index 0000000000000000000000000000000000000000..12f67d60fe6367abc1fa8421e48901d9adf555ba --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/file-exists.ts @@ -0,0 +1,41 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { CredentialsParams, RepoDesignation } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { toRepoId } from "../utils/toRepoId"; + +export async function fileExists( + params: { + repo: RepoDesignation; + path: string; + revision?: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise { + const accessToken = checkCredentials(params); + const repoId = toRepoId(params.repo); + + const hubUrl = params.hubUrl ?? HUB_URL; + const url = `${hubUrl}/${repoId.type === "model" ? "" : `${repoId.type}s/`}${repoId.name}/raw/${encodeURIComponent( + params.revision ?? "main", + )}/${params.path}`; + + const resp = await (params.fetch ?? fetch)(url, { + method: "HEAD", + headers: accessToken ? { Authorization: `Bearer ${accessToken}` } : {}, + }); + + if (resp.status === 404) { + return false; + } + + if (!resp.ok) { + throw await createApiError(resp); + } + + return true; +} diff --git a/node_modules/@huggingface/hub/src/lib/index.ts b/node_modules/@huggingface/hub/src/lib/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..283c5ae9ba628d52af9691afd7499c280bbd01c1 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/index.ts @@ -0,0 +1,36 @@ +export * from "./cache-management"; +export * from "./check-repo-access"; +export * from "./commit"; +export * from "./count-commits"; +export * from "./create-repo"; +export * from "./create-branch"; +export * from "./create-collection"; +export * from "./dataset-info"; +export * from "./delete-branch"; +export * from "./delete-file"; +export * from "./delete-files"; +export * from "./delete-repo"; +export * from "./delete-collection"; +export * from "./download-file"; +export * from "./download-file-to-cache-dir"; +export * from "./file-download-info"; +export * from "./file-exists"; +export * from "./jobs"; +export * from "./list-commits"; +export * from "./list-datasets"; +export * from "./list-files"; +export * from "./list-models"; +export * from "./list-spaces"; +export * from "./list-collections"; +export * from "./model-info"; +export * from "./oauth-handle-redirect"; +export * from "./oauth-login-url"; +export * from "./parse-safetensors-metadata"; +export * from "./paths-info"; +export * from "./repo-exists"; +export * from "./snapshot-download"; +export * from "./space-info"; +export * from "./upload-file"; +export * from "./upload-files"; +export * from "./upload-files-with-progress"; +export * from "./who-am-i"; diff --git a/node_modules/@huggingface/hub/src/lib/jobs/cancel-job.ts b/node_modules/@huggingface/hub/src/lib/jobs/cancel-job.ts new file mode 100644 index 0000000000000000000000000000000000000000..52a6a80378445b448fde338e4dccd3e595b20237 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/cancel-job.ts @@ -0,0 +1,45 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; +import type { ApiJob } from "../../types/api/api-jobs"; + +/** + * Cancel a job. + */ +export async function cancelJob( + params: { + /** + * The namespace (username or organization name) + */ + namespace: string; + /** + * The job ID + */ + jobId: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): Promise { + const accessToken = checkCredentials(params); + + const response = await (params.fetch || fetch)( + `${params.hubUrl || HUB_URL}/api/jobs/${params.namespace}/${params.jobId}/cancel`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }, + ); + + if (!response.ok) { + throw await createApiError(response); + } + + return await response.json(); +} diff --git a/node_modules/@huggingface/hub/src/lib/jobs/create-scheduled-job.ts b/node_modules/@huggingface/hub/src/lib/jobs/create-scheduled-job.ts new file mode 100644 index 0000000000000000000000000000000000000000..b4f6981ae3f1dbd699c0b60676698f185d554f65 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/create-scheduled-job.ts @@ -0,0 +1,85 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; +import type { ApiScheduledJob, CreateScheduledJobOptions } from "../../types/api/api-jobs"; + +/** + * Create a scheduled job. + */ +export async function createScheduledJob( + params: { + /** + * The namespace (username or organization name) + */ + namespace: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CreateScheduledJobOptions & + CredentialsParams, +): Promise { + const accessToken = checkCredentials(params); + + const { namespace, hubUrl, fetch: customFetch, ...rest } = params; + + if (!rest.jobSpec.dockerImage && !rest.jobSpec.spaceId) { + throw new Error("Either dockerImage or spaceId must be provided in jobSpec"); + } + + if (rest.jobSpec.dockerImage && rest.jobSpec.spaceId) { + throw new Error("Cannot provide both dockerImage and spaceId in jobSpec"); + } + + const body: Record = { + jobSpec: { + flavor: rest.jobSpec.flavor, + }, + schedule: rest.schedule, + suspend: rest.suspend ?? false, + concurrency: rest.concurrency ?? false, + }; + + if (rest.jobSpec.dockerImage) { + (body.jobSpec as Record).dockerImage = rest.jobSpec.dockerImage; + } + if (rest.jobSpec.spaceId) { + (body.jobSpec as Record).spaceId = rest.jobSpec.spaceId; + } + if (rest.jobSpec.command) { + (body.jobSpec as Record).command = rest.jobSpec.command; + } + (body.jobSpec as Record).environment = rest.jobSpec.environment || {}; + if (rest.jobSpec.secrets) { + (body.jobSpec as Record).secrets = rest.jobSpec.secrets; + } + if (rest.jobSpec.arch) { + (body.jobSpec as Record).arch = rest.jobSpec.arch; + } + if (rest.jobSpec.timeoutSeconds !== undefined) { + (body.jobSpec as Record).timeoutSeconds = rest.jobSpec.timeoutSeconds; + } + if (rest.jobSpec.attempts !== undefined) { + (body.jobSpec as Record).attempts = rest.jobSpec.attempts; + } + if (rest.jobSpec.labels) { + (body.jobSpec as Record).labels = rest.jobSpec.labels; + } + + const response = await (customFetch || fetch)(`${hubUrl || HUB_URL}/api/scheduled-jobs/${namespace}`, { + method: "POST", + headers: { + "Content-Type": "application/json", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + body: JSON.stringify(body), + }); + + if (!response.ok) { + throw await createApiError(response); + } + + return await response.json(); +} diff --git a/node_modules/@huggingface/hub/src/lib/jobs/delete-scheduled-job.ts b/node_modules/@huggingface/hub/src/lib/jobs/delete-scheduled-job.ts new file mode 100644 index 0000000000000000000000000000000000000000..03bfee16fd1a4c1241bcd9e9225c46b944eb21e8 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/delete-scheduled-job.ts @@ -0,0 +1,42 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; + +/** + * Delete a scheduled job. + */ +export async function deleteScheduledJob( + params: { + /** + * The namespace (username or organization name) + */ + namespace: string; + /** + * The scheduled job ID + */ + jobId: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): Promise { + const accessToken = checkCredentials(params); + + const response = await (params.fetch || fetch)( + `${params.hubUrl || HUB_URL}/api/scheduled-jobs/${params.namespace}/${params.jobId}`, + { + method: "DELETE", + headers: { + "Content-Type": "application/json", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }, + ); + + if (!response.ok) { + throw await createApiError(response); + } +} diff --git a/node_modules/@huggingface/hub/src/lib/jobs/duplicate-job.ts b/node_modules/@huggingface/hub/src/lib/jobs/duplicate-job.ts new file mode 100644 index 0000000000000000000000000000000000000000..9e5e444e9d4ca3e051f80801e1f45d842bdf5991 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/duplicate-job.ts @@ -0,0 +1,45 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; +import type { ApiJob } from "../../types/api/api-jobs"; + +/** + * Duplicate a job (re-run with the same spec). + */ +export async function duplicateJob( + params: { + /** + * The namespace (username or organization name) + */ + namespace: string; + /** + * The job ID to duplicate + */ + jobId: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): Promise { + const accessToken = checkCredentials(params); + + const response = await (params.fetch || fetch)( + `${params.hubUrl || HUB_URL}/api/jobs/${params.namespace}/${params.jobId}/duplicate`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }, + ); + + if (!response.ok) { + throw await createApiError(response); + } + + return await response.json(); +} diff --git a/node_modules/@huggingface/hub/src/lib/jobs/get-job.ts b/node_modules/@huggingface/hub/src/lib/jobs/get-job.ts new file mode 100644 index 0000000000000000000000000000000000000000..8a027516ad93867e89bb526f288a813f90f2d80d --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/get-job.ts @@ -0,0 +1,43 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; +import type { ApiJob } from "../../types/api/api-jobs"; + +/** + * Get a specific job by ID. + */ +export async function getJob( + params: { + /** + * The namespace (username or organization name) + */ + namespace: string; + /** + * The job ID + */ + jobId: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): Promise { + const accessToken = checkCredentials(params); + + const response = await (params.fetch || fetch)( + `${params.hubUrl || HUB_URL}/api/jobs/${params.namespace}/${params.jobId}`, + { + headers: { + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }, + ); + + if (!response.ok) { + throw await createApiError(response); + } + + return await response.json(); +} diff --git a/node_modules/@huggingface/hub/src/lib/jobs/get-scheduled-job.ts b/node_modules/@huggingface/hub/src/lib/jobs/get-scheduled-job.ts new file mode 100644 index 0000000000000000000000000000000000000000..de8d152443188a876a1794ed938ce22bd72514c2 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/get-scheduled-job.ts @@ -0,0 +1,43 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; +import type { ApiScheduledJob } from "../../types/api/api-jobs"; + +/** + * Get a specific scheduled job by ID. + */ +export async function getScheduledJob( + params: { + /** + * The namespace (username or organization name) + */ + namespace: string; + /** + * The scheduled job ID + */ + jobId: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): Promise { + const accessToken = checkCredentials(params); + + const response = await (params.fetch || fetch)( + `${params.hubUrl || HUB_URL}/api/scheduled-jobs/${params.namespace}/${params.jobId}`, + { + headers: { + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }, + ); + + if (!response.ok) { + throw await createApiError(response); + } + + return await response.json(); +} diff --git a/node_modules/@huggingface/hub/src/lib/jobs/index.ts b/node_modules/@huggingface/hub/src/lib/jobs/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..c7f9aad3d09cedcc45554cb88f65c90582b990ec --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/index.ts @@ -0,0 +1,16 @@ +export * from "./cancel-job"; +export * from "./create-scheduled-job"; +export * from "./delete-scheduled-job"; +export * from "./duplicate-job"; +export * from "./get-job"; +export * from "./get-scheduled-job"; +export * from "./list-job-hardware"; +export * from "./list-jobs"; +export * from "./list-scheduled-jobs"; +export * from "./resume-scheduled-job"; +export * from "./run-job"; +export * from "./run-scheduled-job"; +export * from "./stream-job-events"; +export * from "./stream-job-logs"; +export * from "./stream-job-metrics"; +export * from "./suspend-scheduled-job"; diff --git a/node_modules/@huggingface/hub/src/lib/jobs/list-job-hardware.ts b/node_modules/@huggingface/hub/src/lib/jobs/list-job-hardware.ts new file mode 100644 index 0000000000000000000000000000000000000000..a6d129a2fc868a8b27fdffc12ce56c1b709ef506 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/list-job-hardware.ts @@ -0,0 +1,37 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; +import type { ApiJobHardware } from "../../types/api/api-jobs"; + +/** + * Get the list of available hardware for jobs. + * This endpoint is public and does not require authentication, but authentication is optional. + */ +export async function listJobHardware( + params?: { + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise { + const accessToken = checkCredentials(params ?? {}); + + const headers: Record = {}; + + if (accessToken) { + headers.Authorization = `Bearer ${accessToken}`; + } + + const response = await (params?.fetch || fetch)(`${params?.hubUrl || HUB_URL}/api/jobs/hardware`, { + headers, + }); + + if (!response.ok) { + throw await createApiError(response); + } + + return await response.json(); +} diff --git a/node_modules/@huggingface/hub/src/lib/jobs/list-jobs.ts b/node_modules/@huggingface/hub/src/lib/jobs/list-jobs.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b214b24f037d7825bea9f518c2763df2aee917b --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/list-jobs.ts @@ -0,0 +1,36 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; +import type { ApiJob } from "../../types/api/api-jobs"; + +/** + * List jobs for a namespace (user or organization). + */ +export async function listJobs( + params: { + /** + * The namespace (username or organization name) + */ + namespace: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): Promise { + const accessToken = checkCredentials(params); + + const response = await (params.fetch || fetch)(`${params.hubUrl || HUB_URL}/api/jobs/${params.namespace}`, { + headers: { + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }); + + if (!response.ok) { + throw await createApiError(response); + } + + return await response.json(); +} diff --git a/node_modules/@huggingface/hub/src/lib/jobs/list-scheduled-jobs.ts b/node_modules/@huggingface/hub/src/lib/jobs/list-scheduled-jobs.ts new file mode 100644 index 0000000000000000000000000000000000000000..47693868326a976977327a6b1f896472c9e71c97 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/list-scheduled-jobs.ts @@ -0,0 +1,36 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; +import type { ApiScheduledJob } from "../../types/api/api-jobs"; + +/** + * List scheduled jobs for a namespace. + */ +export async function listScheduledJobs( + params: { + /** + * The namespace (username or organization name) + */ + namespace: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): Promise { + const accessToken = checkCredentials(params); + + const response = await (params.fetch || fetch)(`${params.hubUrl || HUB_URL}/api/scheduled-jobs/${params.namespace}`, { + headers: { + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }); + + if (!response.ok) { + throw await createApiError(response); + } + + return await response.json(); +} diff --git a/node_modules/@huggingface/hub/src/lib/jobs/resume-scheduled-job.ts b/node_modules/@huggingface/hub/src/lib/jobs/resume-scheduled-job.ts new file mode 100644 index 0000000000000000000000000000000000000000..c7c0aa331b6549e32a9b59d027c5aefe3fa18729 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/resume-scheduled-job.ts @@ -0,0 +1,41 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; + +/** + * Resume a scheduled job. + */ +export async function resumeScheduledJob( + params: { + /** + * The namespace (username or organization name) + */ + namespace: string; + /** + * The scheduled job ID + */ + jobId: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): Promise { + const accessToken = checkCredentials(params); + + const response = await (params.fetch || fetch)( + `${params.hubUrl || HUB_URL}/api/scheduled-jobs/${params.namespace}/${params.jobId}/resume`, + { + method: "POST", + headers: { + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }, + ); + + if (!response.ok) { + throw await createApiError(response); + } +} diff --git a/node_modules/@huggingface/hub/src/lib/jobs/run-job.ts b/node_modules/@huggingface/hub/src/lib/jobs/run-job.ts new file mode 100644 index 0000000000000000000000000000000000000000..a74a37e7d73080b363b5f88481467a6e0486d8c1 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/run-job.ts @@ -0,0 +1,81 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; +import type { ApiJob, CreateJobOptions } from "../../types/api/api-jobs"; + +/** + * Run a new job. + */ +export async function runJob( + params: { + /** + * The namespace (username or organization name) + */ + namespace: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CreateJobOptions & + CredentialsParams, +): Promise { + const accessToken = checkCredentials(params); + + if (!params.dockerImage && !params.spaceId) { + throw new Error("Either dockerImage or spaceId must be provided"); + } + + if (params.dockerImage && params.spaceId) { + throw new Error("Cannot provide both dockerImage and spaceId"); + } + + const body: Record = { + flavor: params.flavor, + environment: params.environment || {}, + }; + + if (params.dockerImage) { + body.dockerImage = params.dockerImage; + } + if (params.spaceId) { + body.spaceId = params.spaceId; + } + if (params.command) { + body.command = params.command; + } + if (params.arguments) { + body.arguments = params.arguments; + } + if (params.secrets) { + body.secrets = params.secrets; + } + if (params.arch) { + body.arch = params.arch; + } + if (params.timeoutSeconds !== undefined) { + body.timeoutSeconds = params.timeoutSeconds; + } + if (params.attempts !== undefined) { + body.attempts = params.attempts; + } + if (params.labels) { + body.labels = params.labels; + } + + const response = await (params.fetch || fetch)(`${params.hubUrl || HUB_URL}/api/jobs/${params.namespace}`, { + method: "POST", + headers: { + "Content-Type": "application/json", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + body: JSON.stringify(body), + }); + + if (!response.ok) { + throw await createApiError(response); + } + + return await response.json(); +} diff --git a/node_modules/@huggingface/hub/src/lib/jobs/run-scheduled-job.ts b/node_modules/@huggingface/hub/src/lib/jobs/run-scheduled-job.ts new file mode 100644 index 0000000000000000000000000000000000000000..3224830b90509ba3c9f88cbb1504e5b075026c72 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/run-scheduled-job.ts @@ -0,0 +1,50 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; +import type { ApiJob } from "../../types/api/api-jobs"; + +/** + * Trigger a scheduled job to run immediately. + * Returns the job that was triggered, or null if another instance is already running. + */ +export async function runScheduledJob( + params: { + /** + * The namespace (username or organization name) + */ + namespace: string; + /** + * The scheduled job ID + */ + jobId: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): Promise { + const accessToken = checkCredentials(params); + + const response = await (params.fetch || fetch)( + `${params.hubUrl || HUB_URL}/api/scheduled-jobs/${params.namespace}/${params.jobId}/run`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }, + ); + + if (!response.ok) { + if (response.status === 409) { + // Another instance is already running + return null; + } + throw await createApiError(response); + } + + return await response.json(); +} diff --git a/node_modules/@huggingface/hub/src/lib/jobs/stream-job-events.ts b/node_modules/@huggingface/hub/src/lib/jobs/stream-job-events.ts new file mode 100644 index 0000000000000000000000000000000000000000..8fd55f18eb429229ddfb32493062c28024ca5d88 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/stream-job-events.ts @@ -0,0 +1,79 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; + +/** + * Stream job events using Server-Sent Events (SSE). + * Returns an async iterable of event chunks. + */ +export async function* streamJobEvents( + params: { + /** + * The namespace (username or organization name) + */ + namespace: string; + /** + * The job ID + */ + jobId: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): AsyncGenerator { + const accessToken = checkCredentials(params); + + const response = await (params.fetch || fetch)( + `${params.hubUrl || HUB_URL}/api/jobs/${params.namespace}/${params.jobId}/events`, + { + headers: { + Accept: "text/event-stream", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }, + ); + + if (!response.ok) { + throw await createApiError(response); + } + + if (!response.body) { + return; + } + + const reader = response.body.getReader(); + const decoder = new TextDecoder(); + let buffer = ""; + + try { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + + buffer += decoder.decode(value, { stream: true }); + const lines = buffer.split("\n"); + buffer = lines.pop() || ""; + + for (const line of lines) { + if (line.startsWith("data: ")) { + yield line.slice(6); + } + } + } + + // Process remaining buffer + if (buffer) { + const lines = buffer.split("\n"); + for (const line of lines) { + if (line.startsWith("data: ")) { + yield line.slice(6); + } + } + } + } finally { + reader.releaseLock(); + } +} diff --git a/node_modules/@huggingface/hub/src/lib/jobs/stream-job-logs.ts b/node_modules/@huggingface/hub/src/lib/jobs/stream-job-logs.ts new file mode 100644 index 0000000000000000000000000000000000000000..1e6b7c038f1c25dcb4d6186e23ee738e2de04bb5 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/stream-job-logs.ts @@ -0,0 +1,89 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; + +/** + * Stream job logs using Server-Sent Events (SSE). + * Returns an async iterable of log chunks. + */ +export async function* streamJobLogs( + params: { + /** + * The namespace (username or organization name) + */ + namespace: string; + /** + * The job ID + */ + jobId: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): AsyncGenerator<{ message: string; timestamp: Date }, void, unknown> { + const accessToken = checkCredentials(params); + + const response = await (params.fetch || fetch)( + `${params.hubUrl || HUB_URL}/api/jobs/${params.namespace}/${params.jobId}/logs`, + { + headers: { + Accept: "text/event-stream", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }, + ); + + if (!response.ok) { + throw await createApiError(response); + } + + if (!response.body) { + return; + } + + const reader = response.body.getReader(); + const decoder = new TextDecoder(); + let buffer = ""; + + try { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + + buffer += decoder.decode(value, { stream: true }); + const lines = buffer.split("\n"); + buffer = lines.pop() || ""; + + for (const line of lines) { + if (line.startsWith("data: ")) { + try { + const data = JSON.parse(line.slice(6)); + yield { message: data.data, timestamp: new Date(data.timestamp) }; + } catch { + yield { message: line.slice(6), timestamp: new Date() }; + } + } + } + } + + // Process remaining buffer + if (buffer) { + const lines = buffer.split("\n"); + for (const line of lines) { + if (line.startsWith("data: ")) { + try { + const data = JSON.parse(line.slice(6)); + yield { message: data.data, timestamp: new Date(data.timestamp) }; + } catch { + yield { message: line.slice(6), timestamp: new Date() }; + } + } + } + } + } finally { + reader.releaseLock(); + } +} diff --git a/node_modules/@huggingface/hub/src/lib/jobs/stream-job-metrics.ts b/node_modules/@huggingface/hub/src/lib/jobs/stream-job-metrics.ts new file mode 100644 index 0000000000000000000000000000000000000000..b0b2834c6b5e8dba04b6f890b48faf4b65fa7575 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/stream-job-metrics.ts @@ -0,0 +1,79 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; + +/** + * Stream job metrics using Server-Sent Events (SSE). + * Returns an async iterable of metric chunks. + */ +export async function* streamJobMetrics( + params: { + /** + * The namespace (username or organization name) + */ + namespace: string; + /** + * The job ID + */ + jobId: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): AsyncGenerator { + const accessToken = checkCredentials(params); + + const response = await (params.fetch || fetch)( + `${params.hubUrl || HUB_URL}/api/jobs/${params.namespace}/${params.jobId}/metrics`, + { + headers: { + Accept: "text/event-stream", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }, + ); + + if (!response.ok) { + throw await createApiError(response); + } + + if (!response.body) { + return; + } + + const reader = response.body.getReader(); + const decoder = new TextDecoder(); + let buffer = ""; + + try { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + + buffer += decoder.decode(value, { stream: true }); + const lines = buffer.split("\n"); + buffer = lines.pop() || ""; + + for (const line of lines) { + if (line.startsWith("data: ")) { + yield line.slice(6); + } + } + } + + // Process remaining buffer + if (buffer) { + const lines = buffer.split("\n"); + for (const line of lines) { + if (line.startsWith("data: ")) { + yield line.slice(6); + } + } + } + } finally { + reader.releaseLock(); + } +} diff --git a/node_modules/@huggingface/hub/src/lib/jobs/suspend-scheduled-job.ts b/node_modules/@huggingface/hub/src/lib/jobs/suspend-scheduled-job.ts new file mode 100644 index 0000000000000000000000000000000000000000..dcf4a5e3dded753073aa094a9c12cbd03a46112f --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/jobs/suspend-scheduled-job.ts @@ -0,0 +1,42 @@ +import { HUB_URL } from "../../consts"; +import { createApiError } from "../../error"; +import type { CredentialsParams } from "../../types/public"; +import { checkCredentials } from "../../utils/checkCredentials"; + +/** + * Suspend (pause) a scheduled job. + */ +export async function suspendScheduledJob( + params: { + /** + * The namespace (username or organization name) + */ + namespace: string; + /** + * The scheduled job ID + */ + jobId: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): Promise { + const accessToken = checkCredentials(params); + + const response = await (params.fetch || fetch)( + `${params.hubUrl || HUB_URL}/api/scheduled-jobs/${params.namespace}/${params.jobId}/suspend`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }, + ); + + if (!response.ok) { + throw await createApiError(response); + } +} diff --git a/node_modules/@huggingface/hub/src/lib/list-collections.spec.ts b/node_modules/@huggingface/hub/src/lib/list-collections.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..35f9e98270296f80b3d5a2fe95beb28f4141c0d0 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/list-collections.spec.ts @@ -0,0 +1,156 @@ +import { describe, expect, it } from "vitest"; +import { listCollections } from "./list-collections"; +import type { ApiCollectionInfo } from "../types/api/api-collection"; + +describe("listCollections", () => { + it("should list collections", async () => { + const results: ApiCollectionInfo[] = []; + + for await (const entry of listCollections({ + search: { owner: ["huggingfacejs"] }, + })) { + results.push(entry); + } + + expect(results.length).toBe(1); + + const itemTypes = results[0].items.map((item) => item.type); + expect(itemTypes).toEqual(["dataset", "collection", "space", "paper"]); + + expect(results).toEqual([ + { + slug: "huggingfacejs/test-collection-690df2897fa1945492b8cf42", + title: "Test Collection", + description: "Only used in E2E tests", + gating: false, + lastUpdated: expect.any(String), + owner: { + _id: "6414d83b385a75d7790d5a58", + avatarUrl: expect.any(String), + fullname: "Huggingface.js", + name: "huggingfacejs", + type: "org", + followerCount: expect.any(Number), + isHf: false, + isHfAdmin: false, + isMod: false, + isUserFollowing: expect.any(Boolean), + }, + items: [ + { + _id: "690df2a467ea25a1a346d0ae", + author: "huggingfacejs", + datasetsServerInfo: { + formats: expect.any(Array), + libraries: expect.any(Array), + modalities: expect.any(Array), + numRows: expect.any(Number), + viewer: expect.any(String), + }, + downloads: expect.any(Number), + gated: false, + id: "huggingfacejs/tasks", + isBenchmark: false, + isLikedByUser: false, + lastModified: expect.any(String), + likes: expect.any(Number), + position: 0, + private: false, + repoType: "dataset", + type: "dataset", + }, + { + _id: "690df2b1954547dac9727da3", + description: "Only used in E2E tests", + id: "690df2897fa1945492b8cf42", + isUpvotedByUser: false, + lastUpdated: expect.any(String), + numberItems: 5, + owner: { + _id: "6414d83b385a75d7790d5a58", + avatarUrl: expect.any(String), + followerCount: expect.any(Number), + fullname: "Huggingface.js", + isHf: false, + isHfAdmin: false, + isMod: false, + isUserFollowing: expect.any(Boolean), + name: "huggingfacejs", + type: "org", + }, + position: 1, + shareUrl: "https://hf.co/collections/huggingfacejs/test-collection", + slug: "huggingfacejs/test-collection-690df2897fa1945492b8cf42", + theme: "pink", + title: "Test Collection", + type: "collection", + upvotes: expect.any(Number), + }, + { + _id: "690df2c49f252aa897a873b2", + ai_category: "Model Benchmarking", + ai_short_description: "Upload ML models to Hugging Face Hub from your browser", + author: "huggingfacejs", + authorData: { + _id: "6414d83b385a75d7790d5a58", + avatarUrl: expect.any(String), + followerCount: expect.any(Number), + fullname: "Huggingface.js", + isHf: false, + isHfAdmin: false, + isMod: false, + isUserFollowing: expect.any(Boolean), + name: "huggingfacejs", + type: "org", + }, + colorFrom: "green", + colorTo: "green", + createdAt: "2023-03-17T21:33:16.000Z", + emoji: "🌎", + featured: false, + id: "huggingfacejs/push-model-from-web", + isLikedByUser: false, + lastModified: expect.any(String), + likes: 1, + pinned: false, + position: 2, + private: false, + repoType: "space", + runtime: { + hardware: { + current: null, + requested: null, + }, + replicas: { + current: 1, + requested: 1, + }, + stage: "RUNNING", + storage: null, + }, + sdk: "static", + tags: ["static", "region:us"], + title: "Push Model From Web", + trendingScore: 0, + type: "space", + }, + { + _id: "690df2d0c9390ed6ab0f88b1", + id: "2510.04871", + isUpvotedByUser: false, + position: 3, + publishedAt: "2025-10-06T14:58:08.000Z", + thumbnailUrl: "https://cdn-thumbnails.huggingface.co/social-thumbnails/papers/2510.04871.png", + title: "Less is More: Recursive Reasoning with Tiny Networks", + type: "paper", + upvotes: expect.any(Number), + }, + ], + theme: "pink", + private: false, + upvotes: expect.any(Number), + isUpvotedByUser: false, + }, + ]); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/list-collections.ts b/node_modules/@huggingface/hub/src/lib/list-collections.ts new file mode 100644 index 0000000000000000000000000000000000000000..613499cad3c00f76bd4c02a1a4c71c6f3dd8a701 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/list-collections.ts @@ -0,0 +1,102 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { CredentialsParams } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { parseLinkHeader } from "../utils/parseLinkHeader"; +import type { ApiCollectionInfo } from "../types/api/api-collection"; + +/* + * When listing collections, the item list per collection is truncated to 4 items maximum. + * To retrieve all items from a collection, you need to make an additional call using its collection slug. + */ +export async function* listCollections( + params?: { + search?: { + /** + * Filter collections created by specific owners (users or organizations). + */ + owner?: string[]; + /** + * Filter collections containing specific items. + * Value must be the item_type and item_id concatenated. + * Example: "models/teknium/OpenHermes-2.5-Mistral-7B", "datasets/rajpurkar/squad" or "papers/2311.12983". + */ + item?: string[]; + /** + * Filter based on substrings for titles & descriptions. + */ + q?: string; + }; + /** + * Sort the returned collections. Supported values are "lastModified", "trending" (default) and "upvotes". + */ + sort?: "lastModified" | "trending" | "upvotes"; + /** + * Set to limit the number of collections returned. + */ + limit?: number; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): AsyncGenerator { + const accessToken = params && checkCredentials(params); + + const searchParams = new URLSearchParams(); + + let totalToFetch = params?.limit ?? Infinity; + searchParams.append("limit", String(Math.min(totalToFetch, 100))); + + if (params?.sort) { + searchParams.append("sort", params.sort); + } + + if (params?.search?.owner) { + for (const owner of params.search.owner) { + searchParams.append("owner", owner); + } + } + + if (params?.search?.item) { + for (const item of params.search.item) { + searchParams.append("item", item); + } + } + + if (params?.search?.q) { + searchParams.append("q", params.search.q); + } + + let url: string | undefined = `${params?.hubUrl || HUB_URL}/api/collections?${searchParams}`; + + while (url) { + const res: Response = await (params?.fetch ?? fetch)(url, { + headers: { + accept: "application/json", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : undefined), + }, + }); + + if (!res.ok) { + throw await createApiError(res); + } + + const collections: ApiCollectionInfo[] = await res.json(); + + for (const collection of collections) { + yield collection; + + totalToFetch--; + + if (totalToFetch <= 0) { + return; + } + } + + const linkHeader = res.headers.get("Link"); + + url = linkHeader ? parseLinkHeader(linkHeader).next : undefined; + } +} diff --git a/node_modules/@huggingface/hub/src/lib/list-commits.spec.ts b/node_modules/@huggingface/hub/src/lib/list-commits.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..a1f4dd5e5555923c40d02fc2024d765fea07b4ff --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/list-commits.spec.ts @@ -0,0 +1,117 @@ +import { assert, it, describe } from "vitest"; +import type { CommitData } from "./list-commits"; +import { listCommits } from "./list-commits"; + +describe("listCommits", () => { + it("should fetch paginated commits from the repo", async () => { + const commits: CommitData[] = []; + for await (const commit of listCommits({ + repo: { + name: "openai-community/gpt2", + type: "model", + }, + revision: "607a30d783dfa663caf39e06633721c8d4cfcd7e", + batchSize: 5, + })) { + commits.push(commit); + } + + assert.equal(commits.length, 26); + assert.deepEqual(commits.slice(0, 6), [ + { + oid: "607a30d783dfa663caf39e06633721c8d4cfcd7e", + title: "Adds the tokenizer configuration file (#80)", + message: "\n\n\n- Adds tokenizer_config.json file (db6d57930088fb63e52c010bd9ac77c955ac55e7)\n\n", + authors: [ + { + username: "lysandre", + avatarUrl: + "https://cdn-avatars.huggingface.co/v1/production/uploads/5e3aec01f55e2b62848a5217/PMKS0NNB4MJQlTSFzh918.jpeg", + }, + ], + date: new Date("2024-02-19T10:57:45.000Z"), + }, + { + oid: "11c5a3d5811f50298f278a704980280950aedb10", + title: "Adding ONNX file of this model (#60)", + message: "\n\n\n- Adding ONNX file of this model (9411f419c589519e1a46c94ac7789ea20fd7c322)\n\n", + authors: [ + { + username: "fxmarty", + avatarUrl: + "https://cdn-avatars.huggingface.co/v1/production/uploads/1651743336129-624c60cba8ec93a7ac188b56.png", + }, + ], + date: new Date("2023-06-30T02:19:43.000Z"), + }, + { + oid: "e7da7f221d5bf496a48136c0cd264e630fe9fcc8", + title: "Update generation_config.json", + message: "", + authors: [ + { + username: "joaogante", + avatarUrl: "https://cdn-avatars.huggingface.co/v1/production/uploads/1641203017724-noauth.png", + }, + ], + date: new Date("2022-12-16T15:44:21.000Z"), + }, + { + oid: "f27b190eeac4c2302d24068eabf5e9d6044389ae", + title: "Add note that this is the smallest version of the model (#18)", + message: + "\n\n\n- Add note that this is the smallest version of the model (611838ef095a5bb35bf2027d05e1194b7c9d37ac)\n\n\nCo-authored-by: helen \n", + authors: [ + { + username: "sgugger", + avatarUrl: + "https://cdn-avatars.huggingface.co/v1/production/uploads/1593126474392-5ef50182b71947201082a4e5.jpeg", + }, + { + username: "mathemakitten", + avatarUrl: + "https://cdn-avatars.huggingface.co/v1/production/uploads/1658248499901-6079afe2d2cd8c150e6ae05e.jpeg", + }, + ], + date: new Date("2022-11-23T12:55:26.000Z"), + }, + { + oid: "0dd7bcc7a64e4350d8859c9a2813132fbf6ae591", + title: "Our very first generation_config.json (#17)", + message: + "\n\n\n- Our very first generation_config.json (671851b7e9d56ef062890732065d7bd5f4628bd6)\n\n\nCo-authored-by: Joao Gante \n", + authors: [ + { + username: "sgugger", + avatarUrl: + "https://cdn-avatars.huggingface.co/v1/production/uploads/1593126474392-5ef50182b71947201082a4e5.jpeg", + }, + { + username: "joaogante", + avatarUrl: "https://cdn-avatars.huggingface.co/v1/production/uploads/1641203017724-noauth.png", + }, + ], + date: new Date("2022-11-18T18:19:30.000Z"), + }, + { + oid: "75e09b43581151bd1d9ef6700faa605df408979f", + title: "Upload model.safetensors with huggingface_hub (#12)", + message: + "\n\n\n- Upload model.safetensors with huggingface_hub (ba2f794b2e4ea09ef932a6628fa0815dfaf09661)\n\n\nCo-authored-by: Nicolas Patry \n", + authors: [ + { + username: "julien-c", + avatarUrl: + "https://cdn-avatars.huggingface.co/v1/production/uploads/5dd96eb166059660ed1ee413/NQtzmrDdbG0H8qkZvRyGk.jpeg", + }, + { + username: "Narsil", + avatarUrl: + "https://cdn-avatars.huggingface.co/v1/production/uploads/1608285816082-5e2967b819407e3277369b95.png", + }, + ], + date: new Date("2022-10-20T09:34:54.000Z"), + }, + ]); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/list-commits.ts b/node_modules/@huggingface/hub/src/lib/list-commits.ts new file mode 100644 index 0000000000000000000000000000000000000000..4d641eb63039581d3d02cc7514def7d36feb9739 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/list-commits.ts @@ -0,0 +1,70 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { ApiCommitData } from "../types/api/api-commit"; +import type { CredentialsParams, RepoDesignation } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { parseLinkHeader } from "../utils/parseLinkHeader"; +import { toRepoId } from "../utils/toRepoId"; + +export interface CommitData { + oid: string; + title: string; + message: string; + authors: Array<{ username: string; avatarUrl: string }>; + date: Date; +} + +export async function* listCommits( + params: { + repo: RepoDesignation; + /** + * Revision to list commits from. Defaults to the default branch. + */ + revision?: string; + hubUrl?: string; + /** + * Number of commits to fetch from the hub each http call. Defaults to 100. Can be set to 1000. + */ + batchSize?: number; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): AsyncGenerator { + const accessToken = checkCredentials(params); + const repoId = toRepoId(params.repo); + + // Could upgrade to 1000 commits per page + let url: string | undefined = `${params.hubUrl ?? HUB_URL}/api/${repoId.type}s/${repoId.name}/commits/${ + params.revision ?? "main" + }?limit=${params.batchSize ?? 100}`; + + while (url) { + const res: Response = await (params.fetch ?? fetch)(url, { + headers: accessToken ? { Authorization: `Bearer ${accessToken}` } : {}, + }); + + if (!res.ok) { + throw await createApiError(res); + } + + const resJson: ApiCommitData[] = await res.json(); + for (const commit of resJson) { + yield { + oid: commit.id, + title: commit.title, + message: commit.message, + authors: commit.authors.map((author) => ({ + username: author.user, + avatarUrl: author.avatar, + })), + date: new Date(commit.date), + }; + } + + const linkHeader = res.headers.get("Link"); + + url = linkHeader ? parseLinkHeader(linkHeader).next : undefined; + } +} diff --git a/node_modules/@huggingface/hub/src/lib/list-datasets.spec.ts b/node_modules/@huggingface/hub/src/lib/list-datasets.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..9b8c42cdd97840488f01a472febba8661312b319 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/list-datasets.spec.ts @@ -0,0 +1,47 @@ +import { describe, expect, it } from "vitest"; +import type { DatasetEntry } from "./list-datasets"; +import { listDatasets } from "./list-datasets"; + +describe("listDatasets", () => { + it("should list datasets from hf-doc-builder", async () => { + const results: DatasetEntry[] = []; + + for await (const entry of listDatasets({ search: { owner: "hf-doc-build" } })) { + if (entry.name !== "hf-doc-build/doc-build" && entry.name !== "hf-doc-build/doc-build-dev") { + continue; + } + if (typeof entry.downloads === "number") { + entry.downloads = 0; + } + if (typeof entry.likes === "number") { + entry.likes = 0; + } + if (entry.updatedAt instanceof Date && !isNaN(entry.updatedAt.getTime())) { + entry.updatedAt = new Date(0); + } + + results.push(entry); + } + + expect(results.sort((a, b) => a.id.localeCompare(b.id))).to.deep.equal([ + { + id: "6356b19985da6f13863228bd", + name: "hf-doc-build/doc-build", + private: false, + gated: false, + downloads: 0, + likes: 0, + updatedAt: new Date(0), + }, + { + id: "636a1b69f2f9ec4289c4c19e", + name: "hf-doc-build/doc-build-dev", + gated: false, + private: false, + downloads: 0, + likes: 0, + updatedAt: new Date(0), + }, + ]); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/list-datasets.ts b/node_modules/@huggingface/hub/src/lib/list-datasets.ts new file mode 100644 index 0000000000000000000000000000000000000000..f71280cf072538cf2b68b42d1d8fdd8fa7d7f646 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/list-datasets.ts @@ -0,0 +1,135 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { ApiDatasetInfo } from "../types/api/api-dataset"; +import type { CredentialsParams } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { parseLinkHeader } from "../utils/parseLinkHeader"; +import { pick } from "../utils/pick"; + +export const DATASET_EXPAND_KEYS = [ + "private", + "downloads", + "gated", + "likes", + "lastModified", +] as const satisfies readonly (keyof ApiDatasetInfo)[]; + +export const DATASET_EXPANDABLE_KEYS = [ + "author", + "cardData", + "citation", + "createdAt", + "disabled", + "description", + "downloads", + "downloadsAllTime", + "gated", + "gitalyUid", + "lastModified", + "likes", + "paperswithcode_id", + "private", + // "siblings", + "sha", + "tags", +] as const satisfies readonly (keyof ApiDatasetInfo)[]; + +export interface DatasetEntry { + id: string; + name: string; + private: boolean; + downloads: number; + gated: false | "auto" | "manual"; + likes: number; + updatedAt: Date; +} + +export async function* listDatasets< + const T extends Exclude<(typeof DATASET_EXPANDABLE_KEYS)[number], (typeof DATASET_EXPAND_KEYS)[number]> = never, +>( + params?: { + search?: { + /** + * Will search in the dataset name for matches + */ + query?: string; + owner?: string; + tags?: string[]; + }; + hubUrl?: string; + additionalFields?: T[]; + /** + * Set to limit the number of datasets returned. + */ + limit?: number; + /** + * Sort datasets by a specific field. + */ + sort?: + | "createdAt" + | "downloads" + | "likes" + | "lastModified" + | "likes30d" + | "trendingScore" + | "datasetsServerInfo.numRows" + | "mainSize" + | "id"; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): AsyncGenerator> { + const accessToken = params && checkCredentials(params); + let totalToFetch = params?.limit ?? Infinity; + const search = new URLSearchParams([ + ...Object.entries({ + limit: String(Math.min(totalToFetch, 500)), + ...(params?.search?.owner ? { author: params.search.owner } : undefined), + ...(params?.search?.query ? { search: params.search.query } : undefined), + ...(params?.sort ? { sort: params.sort } : undefined), + }), + ...(params?.search?.tags?.map((tag) => ["filter", tag]) ?? []), + ...DATASET_EXPAND_KEYS.map((val) => ["expand", val] satisfies [string, string]), + ...(params?.additionalFields?.map((val) => ["expand", val] satisfies [string, string]) ?? []), + ]).toString(); + let url: string | undefined = `${params?.hubUrl || HUB_URL}/api/datasets` + (search ? "?" + search : ""); + + while (url) { + const res: Response = await (params?.fetch ?? fetch)(url, { + headers: { + accept: "application/json", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : undefined), + }, + }); + + if (!res.ok) { + throw await createApiError(res); + } + + const items: ApiDatasetInfo[] = await res.json(); + + for (const item of items) { + yield { + ...(params?.additionalFields && pick(item, params.additionalFields)), + id: item._id, + name: item.id, + private: item.private, + downloads: item.downloads, + likes: item.likes, + gated: item.gated, + updatedAt: new Date(item.lastModified), + } as DatasetEntry & Pick; + totalToFetch--; + if (totalToFetch <= 0) { + return; + } + } + + const linkHeader = res.headers.get("Link"); + + url = linkHeader ? parseLinkHeader(linkHeader).next : undefined; + // Could update limit in url to fetch less items if not all items of next page are needed. + } +} diff --git a/node_modules/@huggingface/hub/src/lib/list-files.spec.ts b/node_modules/@huggingface/hub/src/lib/list-files.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..00d3777de8f05a034db5d589c1e2113795598d55 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/list-files.spec.ts @@ -0,0 +1,173 @@ +import { assert, it, describe } from "vitest"; +import type { ListFileEntry } from "./list-files"; +import { listFiles } from "./list-files"; + +describe("listFiles", () => { + it("should fetch the list of files from the repo", async () => { + const cursor = listFiles({ + repo: { + name: "google-bert/bert-base-uncased", + type: "model", + }, + revision: "dd4bc8b21efa05ec961e3efc4ee5e3832a3679c7", + }); + + const files: ListFileEntry[] = []; + + for await (const entry of cursor) { + files.push(entry); + } + + assert.deepStrictEqual(files, [ + { + oid: "dc08351d4dc0732d9c8af04070ced089b201ce2f", + path: ".gitattributes", + size: 345, + type: "file", + }, + { + oid: "fca794a5f07ff8f963fe8b61e3694b0fb7f955df", + path: "config.json", + size: 313, + type: "file", + }, + { + lfs: { + oid: "097417381d6c7230bd9e3557456d726de6e83245ec8b24f529f60198a67b203a", + size: 440473133, + pointerSize: 134, + }, + xetHash: "2d8408d3a894d02517d04956e2f7546ff08362594072f3527ce144b5212a3296", + oid: "ba5d19791be1dd7992e33bd61f20207b0f7f50a5", + path: "pytorch_model.bin", + size: 440473133, + type: "file", + }, + { + lfs: { + oid: "a7a17d6d844b5de815ccab5f42cad6d24496db3850a2a43d8258221018ce87d2", + size: 536063208, + pointerSize: 134, + }, + xetHash: "879c5715c18a0b7f051dd33f70f0a5c8dd1522e0a43f6f75520f16167f29279b", + oid: "9eb98c817f04b051b3bcca591bcd4e03cec88018", + path: "tf_model.h5", + size: 536063208, + type: "file", + }, + { + oid: "fb140275c155a9c7c5a3b3e0e77a9e839594a938", + path: "vocab.txt", + size: 231508, + type: "file", + }, + ]); + }); + + it("should fetch the list of files from the repo, including last commit", async () => { + const cursor = listFiles({ + repo: { + name: "google-bert/bert-base-uncased", + type: "model", + }, + revision: "dd4bc8b21efa05ec961e3efc4ee5e3832a3679c7", + expand: true, + }); + + const files: ListFileEntry[] = []; + + for await (const entry of cursor) { + delete entry.securityFileStatus; // flaky + files.push(entry); + } + + assert.deepStrictEqual(files, [ + { + lastCommit: { + date: "2018-11-14T23:35:08.000Z", + id: "504939aa53e8ce310dba3dd2296dbe266c575de4", + title: "initial commit", + }, + oid: "dc08351d4dc0732d9c8af04070ced089b201ce2f", + path: ".gitattributes", + size: 345, + type: "file", + }, + { + lastCommit: { + date: "2019-06-18T09:06:51.000Z", + id: "bb3c1c3256d2598217df9889a14a2e811587891d", + title: "Update config.json", + }, + oid: "fca794a5f07ff8f963fe8b61e3694b0fb7f955df", + path: "config.json", + size: 313, + type: "file", + }, + { + lastCommit: { + date: "2019-06-18T09:06:34.000Z", + id: "3d2477d72b675a999d1b13ca822aaaf4908634ad", + title: "Update pytorch_model.bin", + }, + lfs: { + oid: "097417381d6c7230bd9e3557456d726de6e83245ec8b24f529f60198a67b203a", + size: 440473133, + pointerSize: 134, + }, + xetHash: "2d8408d3a894d02517d04956e2f7546ff08362594072f3527ce144b5212a3296", + oid: "ba5d19791be1dd7992e33bd61f20207b0f7f50a5", + path: "pytorch_model.bin", + size: 440473133, + type: "file", + }, + { + lastCommit: { + date: "2019-09-23T19:48:44.000Z", + id: "dd4bc8b21efa05ec961e3efc4ee5e3832a3679c7", + title: "Update tf_model.h5", + }, + lfs: { + oid: "a7a17d6d844b5de815ccab5f42cad6d24496db3850a2a43d8258221018ce87d2", + size: 536063208, + pointerSize: 134, + }, + xetHash: "879c5715c18a0b7f051dd33f70f0a5c8dd1522e0a43f6f75520f16167f29279b", + oid: "9eb98c817f04b051b3bcca591bcd4e03cec88018", + path: "tf_model.h5", + size: 536063208, + type: "file", + }, + { + lastCommit: { + date: "2018-11-14T23:35:08.000Z", + id: "2f07d813ca87c8c709147704c87210359ccf2309", + title: "Update vocab.txt", + }, + oid: "fb140275c155a9c7c5a3b3e0e77a9e839594a938", + path: "vocab.txt", + size: 231508, + type: "file", + }, + ]); + }); + + it("should fetch the list of files from the repo, including subfolders", async () => { + const cursor = listFiles({ + repo: { + name: "xsum", + type: "dataset", + }, + revision: "0f3ea2f2b55fcb11e71fb1e3aec6822e44ddcb0f", + recursive: true, + }); + + const files: ListFileEntry[] = []; + + for await (const entry of cursor) { + files.push(entry); + } + + assert(files.some((file) => file.path === "data/XSUM-EMNLP18-Summary-Data-Original.tar.gz")); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/list-files.ts b/node_modules/@huggingface/hub/src/lib/list-files.ts new file mode 100644 index 0000000000000000000000000000000000000000..648a6463a9786bc972394b95da95d9fd4c342b5c --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/list-files.ts @@ -0,0 +1,94 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { ApiIndexTreeEntry } from "../types/api/api-index-tree"; +import type { CredentialsParams, RepoDesignation } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { parseLinkHeader } from "../utils/parseLinkHeader"; +import { toRepoId } from "../utils/toRepoId"; + +export interface ListFileEntry { + type: "file" | "directory" | "unknown"; + size: number; + path: string; + oid: string; + lfs?: { + oid: string; + size: number; + /** Size of the raw pointer file, 100~200 bytes */ + pointerSize: number; + }; + /** + * Xet-backed hash, a new protocol replacing LFS for big files. + */ + xetHash?: string; + /** + * Only fetched if `expand` is set to `true` in the `listFiles` call. + */ + lastCommit?: { + date: string; + id: string; + title: string; + }; + /** + * Only fetched if `expand` is set to `true` in the `listFiles` call. + */ + securityFileStatus?: unknown; +} + +/** + * List files in a folder. To list ALL files in the directory, call it + * with {@link params.recursive} set to `true`. + */ +export async function* listFiles( + params: { + repo: RepoDesignation; + /** + * Do we want to list files in subdirectories? + */ + recursive?: boolean; + /** + * Eg 'data' for listing all files in the 'data' folder. Leave it empty to list all + * files in the repo. + */ + path?: string; + /** + * Fetch `lastCommit` and `securityFileStatus` for each file. + */ + expand?: boolean; + revision?: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): AsyncGenerator { + const accessToken = checkCredentials(params); + const repoId = toRepoId(params.repo); + let url: string | undefined = `${params.hubUrl || HUB_URL}/api/${repoId.type}s/${repoId.name}/tree/${ + params.revision || "main" + }${params.path ? "/" + params.path : ""}?recursive=${!!params.recursive}&expand=${!!params.expand}`; + + while (url) { + const res: Response = await (params.fetch ?? fetch)(url, { + headers: { + accept: "application/json", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : undefined), + }, + }); + + if (!res.ok) { + throw await createApiError(res); + } + + const items: ApiIndexTreeEntry[] = await res.json(); + + for (const item of items) { + yield item; + } + + const linkHeader = res.headers.get("Link"); + + url = linkHeader ? parseLinkHeader(linkHeader).next : undefined; + } +} diff --git a/node_modules/@huggingface/hub/src/lib/list-models.spec.ts b/node_modules/@huggingface/hub/src/lib/list-models.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..8307031c6a4f5853ba0feb1c7bf81282dd3b34da --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/list-models.spec.ts @@ -0,0 +1,151 @@ +import { describe, expect, it } from "vitest"; +import type { ModelEntry } from "./list-models"; +import { listModels } from "./list-models"; + +describe("listModels", () => { + it("should list models for depth estimation", async () => { + const results: ModelEntry[] = []; + + for await (const entry of listModels({ + search: { owner: "Intel", task: "depth-estimation" }, + })) { + if (typeof entry.downloads === "number") { + entry.downloads = 0; + } + if (typeof entry.likes === "number") { + entry.likes = 0; + } + if (entry.updatedAt instanceof Date && !isNaN(entry.updatedAt.getTime())) { + entry.updatedAt = new Date(0); + } + + if (!["Intel/dpt-large", "Intel/dpt-hybrid-midas"].includes(entry.name)) { + expect(entry.task).to.equal("depth-estimation"); + continue; + } + + results.push(entry); + } + + results.sort((a, b) => a.id.localeCompare(b.id)); + + expect(results).deep.equal([ + { + id: "621ffdc136468d709f17e709", + name: "Intel/dpt-large", + private: false, + gated: false, + downloads: 0, + likes: 0, + task: "depth-estimation", + updatedAt: new Date(0), + }, + { + id: "638f07977559bf9a2b2b04ac", + name: "Intel/dpt-hybrid-midas", + gated: false, + private: false, + downloads: 0, + likes: 0, + task: "depth-estimation", + updatedAt: new Date(0), + }, + ]); + }); + + it("should list indonesian models with gguf format", async () => { + let count = 0; + for await (const entry of listModels({ + search: { tags: ["gguf", "id"] }, + additionalFields: ["tags"], + limit: 2, + })) { + count++; + expect(entry.tags).to.include("gguf"); + expect(entry.tags).to.include("id"); + } + + expect(count).to.equal(2); + }); + + it("should search model by name", async () => { + let count = 0; + for await (const entry of listModels({ + search: { query: "t5" }, + limit: 10, + })) { + count++; + expect(entry.name.toLocaleLowerCase()).to.include("t5"); + } + + expect(count).to.equal(10); + }); + + it("should search model by inference provider", async () => { + let count = 0; + for await (const entry of listModels({ + search: { inferenceProviders: ["together"] }, + additionalFields: ["inferenceProviderMapping"], + limit: 10, + })) { + count++; + if (Array.isArray(entry.inferenceProviderMapping)) { + expect(entry.inferenceProviderMapping.map(({ provider }) => provider)).to.include("together"); + } + } + + expect(count).to.equal(10); + }); + + it("should search model by several inference providers", async () => { + let count = 0; + const inferenceProviders = ["together", "replicate"]; + for await (const entry of listModels({ + search: { inferenceProviders }, + additionalFields: ["inferenceProviderMapping"], + limit: 10, + })) { + count++; + if (Array.isArray(entry.inferenceProviderMapping)) { + expect( + entry.inferenceProviderMapping.filter(({ provider }) => inferenceProviders.includes(provider)).length, + ).toBeGreaterThan(0); + } + } + + expect(count).to.equal(10); + }); + + it("should list meta-llama models with inference provider mapping", async () => { + let count = 0; + for await (const entry of listModels({ + search: { owner: "meta-llama" }, + additionalFields: ["inferenceProviderMapping"], + limit: 1, + })) { + count++; + expect(entry.inferenceProviderMapping).to.be.an("array").that.is.not.empty; + for (const item of entry.inferenceProviderMapping ?? []) { + expect(item).to.have.property("provider").that.is.a("string").and.is.not.empty; + expect(item).to.have.property("hfModelId").that.is.a("string").and.is.not.empty; + expect(item).to.have.property("providerId").that.is.a("string").and.is.not.empty; + } + } + + expect(count).to.equal(1); + }); + + it("should search models by apps", async () => { + let count = 0; + for await (const entry of listModels({ + search: { apps: ["mlx-lm"] }, + additionalFields: ["tags"], + limit: 10, + })) { + count++; + expect(entry.tags).to.include("mlx"); + } + + expect(count).to.equal(10); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/list-models.ts b/node_modules/@huggingface/hub/src/lib/list-models.ts new file mode 100644 index 0000000000000000000000000000000000000000..8a8e1e41c80263c2d931455ec3abdc820078df19 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/list-models.ts @@ -0,0 +1,171 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { ApiModelInfo } from "../types/api/api-model"; +import type { CredentialsParams, PipelineType } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { parseLinkHeader } from "../utils/parseLinkHeader"; +import { pick } from "../utils/pick"; +import { normalizeInferenceProviderMapping } from "../utils/normalizeInferenceProviderMapping"; + +export const MODEL_EXPAND_KEYS = [ + "pipeline_tag", + "private", + "gated", + "downloads", + "likes", + "lastModified", +] as const satisfies readonly (keyof ApiModelInfo)[]; + +export const MODEL_EXPANDABLE_KEYS = [ + "author", + "cardData", + "config", + "createdAt", + "disabled", + "downloads", + "downloadsAllTime", + "gated", + "gitalyUid", + "inferenceProviderMapping", + "lastModified", + "library_name", + "likes", + "model-index", + "pipeline_tag", + "private", + "safetensors", + "sha", + // "siblings", + "spaces", + "tags", + "transformersInfo", +] as const satisfies readonly (keyof ApiModelInfo)[]; + +export interface ModelEntry { + id: string; + name: string; + private: boolean; + gated: false | "auto" | "manual"; + task?: PipelineType; + likes: number; + downloads: number; + updatedAt: Date; +} + +export async function* listModels< + const T extends Exclude<(typeof MODEL_EXPANDABLE_KEYS)[number], (typeof MODEL_EXPAND_KEYS)[number]> = never, +>( + params?: { + search?: { + /** + * Will search in the model name for matches + */ + query?: string; + owner?: string; + task?: PipelineType; + tags?: string[]; + /** + * Will search for models that have one of the inference providers in the list. + */ + inferenceProviders?: string[]; + /** + * Will search for models that support at least one of those local apps (eg "lmstudio", "mlx-lm", ...) + */ + apps?: string[]; + }; + hubUrl?: string; + additionalFields?: T[]; + /** + * Set to limit the number of models returned. + */ + limit?: number; + /** + * Sort models by a specific field. + */ + sort?: + | "createdAt" + | "downloads" + | "likes" + | "lastModified" + | "likes30d" + | "trendingScore" + | "num_parameters" + | "mainSize" + | "id"; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): AsyncGenerator> { + const accessToken = params && checkCredentials(params); + let totalToFetch = params?.limit ?? Infinity; + const search = new URLSearchParams([ + ...Object.entries({ + limit: String(Math.min(totalToFetch, 500)), + ...(params?.search?.owner ? { author: params.search.owner } : undefined), + ...(params?.search?.task ? { pipeline_tag: params.search.task } : undefined), + ...(params?.search?.query ? { search: params.search.query } : undefined), + ...(params?.search?.inferenceProviders + ? { inference_provider: params.search.inferenceProviders.join(",") } + : undefined), + ...(params?.search?.apps ? { apps: params.search.apps.join(",") } : undefined), + ...(params?.sort ? { sort: params.sort } : undefined), + }), + ...(params?.search?.tags?.map((tag) => ["filter", tag]) ?? []), + ...MODEL_EXPAND_KEYS.map((val) => ["expand", val] satisfies [string, string]), + ...(params?.additionalFields?.map((val) => ["expand", val] satisfies [string, string]) ?? []), + ]).toString(); + let url: string | undefined = `${params?.hubUrl || HUB_URL}/api/models?${search}`; + + while (url) { + const res: Response = await (params?.fetch ?? fetch)(url, { + headers: { + accept: "application/json", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : undefined), + }, + }); + + if (!res.ok) { + throw await createApiError(res); + } + + const items: ApiModelInfo[] = await res.json(); + + for (const item of items) { + // Handle inferenceProviderMapping normalization + const normalizedItem = { ...item }; + if ( + (params?.additionalFields as string[])?.includes("inferenceProviderMapping") && + item.inferenceProviderMapping + ) { + normalizedItem.inferenceProviderMapping = normalizeInferenceProviderMapping( + item.id, + item.inferenceProviderMapping, + ); + } + + yield { + ...(params?.additionalFields && pick(normalizedItem, params.additionalFields)), + id: item._id, + name: item.id, + private: item.private, + task: item.pipeline_tag, + downloads: item.downloads, + gated: item.gated, + likes: item.likes, + updatedAt: new Date(item.lastModified), + } as ModelEntry & Pick; + totalToFetch--; + + if (totalToFetch <= 0) { + return; + } + } + + const linkHeader = res.headers.get("Link"); + + url = linkHeader ? parseLinkHeader(linkHeader).next : undefined; + // Could update url to reduce the limit if we don't need the whole 500 of the next batch. + } +} diff --git a/node_modules/@huggingface/hub/src/lib/list-spaces.spec.ts b/node_modules/@huggingface/hub/src/lib/list-spaces.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..3cc5999137a7837ae4312374a7a89ec46985dff3 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/list-spaces.spec.ts @@ -0,0 +1,40 @@ +import { describe, expect, it } from "vitest"; +import type { SpaceEntry } from "./list-spaces"; +import { listSpaces } from "./list-spaces"; + +describe("listSpaces", () => { + it("should list spaces for Microsoft", async () => { + const results: SpaceEntry[] = []; + + for await (const entry of listSpaces({ + search: { owner: "microsoft" }, + additionalFields: ["subdomain"], + })) { + if (entry.name !== "microsoft/visual_chatgpt") { + continue; + } + if (typeof entry.likes === "number") { + entry.likes = 0; + } + if (entry.updatedAt instanceof Date && !isNaN(entry.updatedAt.getTime())) { + entry.updatedAt = new Date(0); + } + + results.push(entry); + } + + results.sort((a, b) => a.id.localeCompare(b.id)); + + expect(results).deep.equal([ + { + id: "6409a392bbc73d022c58c980", + name: "microsoft/visual_chatgpt", + private: false, + likes: 0, + sdk: "gradio", + subdomain: "microsoft-visual-chatgpt", + updatedAt: new Date(0), + }, + ]); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/list-spaces.ts b/node_modules/@huggingface/hub/src/lib/list-spaces.ts new file mode 100644 index 0000000000000000000000000000000000000000..d1bd4d7fa86662dc12c19e58327b4f8d47124abc --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/list-spaces.ts @@ -0,0 +1,116 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { ApiSpaceInfo } from "../types/api/api-space"; +import type { CredentialsParams, SpaceSdk } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { parseLinkHeader } from "../utils/parseLinkHeader"; +import { pick } from "../utils/pick"; + +export const SPACE_EXPAND_KEYS = [ + "sdk", + "likes", + "private", + "lastModified", +] as const satisfies readonly (keyof ApiSpaceInfo)[]; +export const SPACE_EXPANDABLE_KEYS = [ + "author", + "cardData", + "datasets", + "disabled", + "gitalyUid", + "lastModified", + "createdAt", + "likes", + "private", + "runtime", + "sdk", + // "siblings", + "sha", + "subdomain", + "tags", + "models", +] as const satisfies readonly (keyof ApiSpaceInfo)[]; + +export interface SpaceEntry { + id: string; + name: string; + sdk?: SpaceSdk; + likes: number; + private: boolean; + updatedAt: Date; + // Use additionalFields to fetch the fields from ApiSpaceInfo +} + +export async function* listSpaces< + const T extends Exclude<(typeof SPACE_EXPANDABLE_KEYS)[number], (typeof SPACE_EXPAND_KEYS)[number]> = never, +>( + params?: { + search?: { + /** + * Will search in the space name for matches + */ + query?: string; + owner?: string; + tags?: string[]; + }; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + /** + * Additional fields to fetch from huggingface.co. + */ + additionalFields?: T[]; + /** + * Sort spaces by a specific field. + */ + sort?: "createdAt" | "downloads" | "likes" | "lastModified" | "likes30d" | "trendingScore" | "mainSize" | "id"; + } & Partial, +): AsyncGenerator> { + const accessToken = params && checkCredentials(params); + const search = new URLSearchParams([ + ...Object.entries({ + limit: "500", + ...(params?.search?.owner ? { author: params.search.owner } : undefined), + ...(params?.search?.query ? { search: params.search.query } : undefined), + ...(params?.sort ? { sort: params.sort } : undefined), + }), + ...(params?.search?.tags?.map((tag) => ["filter", tag]) ?? []), + ...[...SPACE_EXPAND_KEYS, ...(params?.additionalFields ?? [])].map( + (val) => ["expand", val] satisfies [string, string], + ), + ]).toString(); + let url: string | undefined = `${params?.hubUrl || HUB_URL}/api/spaces?${search}`; + + while (url) { + const res: Response = await (params?.fetch ?? fetch)(url, { + headers: { + accept: "application/json", + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : undefined), + }, + }); + + if (!res.ok) { + throw await createApiError(res); + } + + const items: ApiSpaceInfo[] = await res.json(); + + for (const item of items) { + yield { + ...(params?.additionalFields && pick(item, params.additionalFields)), + id: item._id, + name: item.id, + sdk: item.sdk, + likes: item.likes, + private: item.private, + updatedAt: new Date(item.lastModified), + } as SpaceEntry & Pick; + } + + const linkHeader = res.headers.get("Link"); + + url = linkHeader ? parseLinkHeader(linkHeader).next : undefined; + } +} diff --git a/node_modules/@huggingface/hub/src/lib/model-info.spec.ts b/node_modules/@huggingface/hub/src/lib/model-info.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..e6cbec4338685afd25ee6e4eb7f180bc5740e7b8 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/model-info.spec.ts @@ -0,0 +1,75 @@ +import { describe, expect, it } from "vitest"; +import { modelInfo } from "./model-info"; +import type { ModelEntry } from "./list-models"; +import type { ApiModelInfo } from "../types/api/api-model"; + +describe("modelInfo", () => { + it("should return the model info", async () => { + const info = await modelInfo({ + name: "openai-community/gpt2", + }); + expect(info).toEqual({ + id: "621ffdc036468d709f17434d", + downloads: expect.any(Number), + gated: false, + name: "openai-community/gpt2", + updatedAt: expect.any(Date), + likes: expect.any(Number), + task: "text-generation", + private: false, + }); + }); + + it("should return the model info with author", async () => { + const info: ModelEntry & Pick = await modelInfo({ + name: "openai-community/gpt2", + additionalFields: ["author"], + }); + expect(info).toEqual({ + id: "621ffdc036468d709f17434d", + downloads: expect.any(Number), + author: "openai-community", + gated: false, + name: "openai-community/gpt2", + updatedAt: expect.any(Date), + likes: expect.any(Number), + task: "text-generation", + private: false, + }); + }); + + it("should return the model info for a specific revision", async () => { + const info: ModelEntry & Pick = await modelInfo({ + name: "openai-community/gpt2", + additionalFields: ["sha"], + revision: "f27b190eeac4c2302d24068eabf5e9d6044389ae", + }); + expect(info).toEqual({ + id: "621ffdc036468d709f17434d", + downloads: expect.any(Number), + gated: false, + name: "openai-community/gpt2", + updatedAt: expect.any(Date), + likes: expect.any(Number), + task: "text-generation", + private: false, + sha: "f27b190eeac4c2302d24068eabf5e9d6044389ae", + }); + }); + + it("should return model info deepseek-ai models with inference provider mapping", async () => { + const info = await modelInfo({ + name: "deepseek-ai/DeepSeek-R1-0528", + additionalFields: ["inferenceProviderMapping"], + }); + + expect(info.inferenceProviderMapping).toBeDefined(); + expect(info.inferenceProviderMapping).toBeInstanceOf(Array); + expect(info.inferenceProviderMapping?.length).toBeGreaterThan(0); + info.inferenceProviderMapping?.forEach((item) => { + expect(item).toHaveProperty("provider"); + expect(item).toHaveProperty("hfModelId", "deepseek-ai/DeepSeek-R1-0528"); + expect(item).toHaveProperty("providerId"); + }); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/model-info.ts b/node_modules/@huggingface/hub/src/lib/model-info.ts new file mode 100644 index 0000000000000000000000000000000000000000..413d81a334e47eb6f9d37b9cf744d2c116d65bef --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/model-info.ts @@ -0,0 +1,68 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { ApiModelInfo } from "../types/api/api-model"; +import type { CredentialsParams } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { pick } from "../utils/pick"; +import { normalizeInferenceProviderMapping } from "../utils/normalizeInferenceProviderMapping"; +import { MODEL_EXPAND_KEYS, type MODEL_EXPANDABLE_KEYS, type ModelEntry } from "./list-models"; + +export async function modelInfo< + const T extends Exclude<(typeof MODEL_EXPANDABLE_KEYS)[number], (typeof MODEL_EXPAND_KEYS)[number]> = never, +>( + params: { + name: string; + hubUrl?: string; + additionalFields?: T[]; + /** + * An optional Git revision id which can be a branch name, a tag, or a commit hash. + */ + revision?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise> { + const accessToken = params && checkCredentials(params); + + const search = new URLSearchParams([ + ...MODEL_EXPAND_KEYS.map((val) => ["expand", val] satisfies [string, string]), + ...(params?.additionalFields?.map((val) => ["expand", val] satisfies [string, string]) ?? []), + ]).toString(); + + const response = await (params.fetch || fetch)( + `${params?.hubUrl || HUB_URL}/api/models/${params.name}/revision/${encodeURIComponent( + params.revision ?? "HEAD", + )}?${search.toString()}`, + { + headers: { + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }, + ); + + if (!response.ok) { + throw await createApiError(response); + } + + const data = await response.json(); + + // Handle inferenceProviderMapping normalization + const normalizedData = { ...data }; + if ((params?.additionalFields as string[])?.includes("inferenceProviderMapping") && data.inferenceProviderMapping) { + normalizedData.inferenceProviderMapping = normalizeInferenceProviderMapping(data.id, data.inferenceProviderMapping); + } + + return { + ...(params?.additionalFields && pick(normalizedData, params.additionalFields)), + id: data._id, + name: data.id, + private: data.private, + task: data.pipeline_tag, + downloads: data.downloads, + gated: data.gated, + likes: data.likes, + updatedAt: new Date(data.lastModified), + } as ModelEntry & Pick; +} diff --git a/node_modules/@huggingface/hub/src/lib/oauth-handle-redirect.spec.ts b/node_modules/@huggingface/hub/src/lib/oauth-handle-redirect.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..f06f6a40e0dcdb6621ea75dedd369c3771b11561 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/oauth-handle-redirect.spec.ts @@ -0,0 +1,60 @@ +import { describe, expect, it } from "vitest"; +import { TEST_COOKIE, TEST_HUB_URL } from "../test/consts"; +import { oauthLoginUrl } from "./oauth-login-url"; +import { oauthHandleRedirect } from "./oauth-handle-redirect"; + +describe("oauthHandleRedirect", () => { + it("should work", async () => { + const localStorage = { + nonce: undefined, + codeVerifier: undefined, + }; + const url = await oauthLoginUrl({ + clientId: "dummy-app", + redirectUrl: "http://localhost:3000", + localStorage, + scopes: "openid profile email", + hubUrl: TEST_HUB_URL, + }); + const resp = await fetch(url, { + method: "POST", + headers: { + Cookie: `token=${TEST_COOKIE}`, + }, + redirect: "manual", + }); + if (resp.status !== 303) { + throw new Error(`Failed to fetch url ${url}: ${resp.status} ${resp.statusText}`); + } + const location = resp.headers.get("Location"); + if (!location) { + throw new Error(`No location header in response`); + } + const result = await oauthHandleRedirect({ + redirectedUrl: location, + codeVerifier: localStorage.codeVerifier, + nonce: localStorage.nonce, + hubUrl: TEST_HUB_URL, + }); + + if (!result) { + throw new Error("Expected result to be defined"); + } + expect(result.accessToken).toEqual(expect.any(String)); + expect(result.accessTokenExpiresAt).toBeInstanceOf(Date); + expect(result.accessTokenExpiresAt.getTime()).toBeGreaterThan(Date.now()); + expect(result.scope).toEqual(expect.any(String)); + expect(result.userInfo).toEqual({ + sub: "62f264b9f3c90f4b6514a269", + name: "@huggingface/hub CI bot", + preferred_username: "hub.js", + email_verified: true, + email: "eliott@huggingface.co", + isPro: false, + picture: "https://hub-ci.huggingface.co/avatars/934b830e9fdaa879487852f79eef7165.svg", + profile: "https://hub-ci.huggingface.co/hub.js", + website: "https://github.com/huggingface/hub.js", + orgs: [], + }); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/oauth-handle-redirect.ts b/node_modules/@huggingface/hub/src/lib/oauth-handle-redirect.ts new file mode 100644 index 0000000000000000000000000000000000000000..f5ed66bae8289edc5b1480f0d3870a966ed573d5 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/oauth-handle-redirect.ts @@ -0,0 +1,343 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; + +export interface UserInfo { + /** + * OpenID Connect field. Unique identifier for the user, even in case of rename. + */ + sub: string; + /** + * OpenID Connect field. The user's full name. + */ + name: string; + /** + * OpenID Connect field. The user's username. + */ + preferred_username: string; + /** + * OpenID Connect field, available if scope "email" was granted. + */ + email_verified?: boolean; + /** + * OpenID Connect field, available if scope "email" was granted. + */ + email?: string; + /** + * OpenID Connect field. The user's profile picture URL. + */ + picture: string; + /** + * OpenID Connect field. The user's profile URL. + */ + profile: string; + /** + * OpenID Connect field. The user's website URL. + */ + website?: string; + + /** + * Hugging Face field. Whether the user is a pro user. + */ + isPro: boolean; + /** + * Hugging Face field. Whether the user has a payment method set up. Needs "read-billing" scope. + */ + canPay?: boolean; + /** + * Hugging Face field. The user's orgs + */ + orgs?: Array<{ + /** + * OpenID Connect field. Unique identifier for the org. + */ + sub: string; + /** + * OpenID Connect field. The org's full name. + */ + name: string; + /** + * OpenID Connect field. The org's username. + */ + preferred_username: string; + /** + * OpenID Connect field. The org's profile picture URL. + */ + picture: string; + + /** + * Hugging Face field. The org's plan (e.g., "enterprise", "team"). + */ + plan?: string; + /** + * Hugging Face field. Whether the org has a payment method set up. Needs "read-billing" scope, and the user needs to approve access to the org in the OAuth page. + */ + canPay?: boolean; + /** + * Hugging Face field. The user's role in the org. The user needs to approve access to the org in the OAuth page. + */ + roleInOrg?: string; + /** + * @deprecated Use securityRestrictions instead with "sso" + * HuggingFace field. When the user granted the oauth app access to the org, but didn't complete SSO. + * + * Should never happen directly after the oauth flow. + */ + pendingSSO?: boolean; + /** + * @deprecated Use securityRestrictions instead with "mfa" + * + * HuggingFace field. When the user granted the oauth app access to the org, but didn't complete MFA. + * + * Should never happen directly after the oauth flow. + */ + missingMFA?: boolean; + /** + * HuggingFace field. When the user granted the oauth app access to the org, but didn't complete following security restrictions. + * + * Should never happen directly after the oauth flow. + */ + securityRestrictions?: ("mfa" | "sso" | "ip" | "token-policy")[]; + }>; +} + +export interface OAuthResult { + accessToken: string; + accessTokenExpiresAt: Date; + userInfo: UserInfo; + /** + * State passed to the OAuth provider in the original request to the OAuth provider. + */ + state?: string; + /** + * Granted scope + */ + scope: string; +} + +/** + * To call after the OAuth provider redirects back to the app. + * + * There is also a helper function {@link oauthHandleRedirectIfPresent}, which will call `oauthHandleRedirect` if the URL contains an oauth code + * in the query parameters and return `false` otherwise. + */ +export async function oauthHandleRedirect(opts?: { + /** + * The URL of the hub. Defaults to {@link HUB_URL}. + */ + hubUrl?: string; + /** + * The URL to analyze. + * + * @default window.location.href + */ + redirectedUrl?: string; + /** + * nonce generated by oauthLoginUrl + * + * @default localStorage.getItem("huggingface.co:oauth:nonce") + */ + nonce?: string; + /** + * codeVerifier generated by oauthLoginUrl + * + * @default localStorage.getItem("huggingface.co:oauth:code_verifier") + */ + codeVerifier?: string; +}): Promise { + if (typeof window === "undefined" && !opts?.redirectedUrl) { + throw new Error("oauthHandleRedirect is only available in the browser, unless you provide redirectedUrl"); + } + if (typeof localStorage === "undefined" && (!opts?.nonce || !opts?.codeVerifier)) { + throw new Error( + "oauthHandleRedirect requires localStorage to be available, unless you provide nonce and codeVerifier", + ); + } + + const redirectedUrl = opts?.redirectedUrl ?? window.location.href; + const searchParams = (() => { + try { + return new URL(redirectedUrl).searchParams; + } catch (err) { + throw new Error("Failed to parse redirected URL: " + redirectedUrl); + } + })(); + + const [error, errorDescription] = [searchParams.get("error"), searchParams.get("error_description")]; + + if (error) { + throw new Error(`${error}: ${errorDescription}`); + } + + const code = searchParams.get("code"); + const nonce = opts?.nonce ?? localStorage.getItem("huggingface.co:oauth:nonce"); + + if (!code) { + throw new Error("Missing oauth code from query parameters in redirected URL: " + redirectedUrl); + } + + if (!nonce) { + throw new Error("Missing oauth nonce from localStorage"); + } + + const codeVerifier = opts?.codeVerifier ?? localStorage.getItem("huggingface.co:oauth:code_verifier"); + + if (!codeVerifier) { + throw new Error("Missing oauth code_verifier from localStorage"); + } + + const state = searchParams.get("state"); + + if (!state) { + throw new Error("Missing oauth state from query parameters in redirected URL"); + } + + let parsedState: { nonce: string; redirectUri: string; state?: string }; + + try { + parsedState = JSON.parse(state); + } catch { + throw new Error("Invalid oauth state in redirected URL, unable to parse JSON: " + state); + } + + if (parsedState.nonce !== nonce) { + throw new Error("Invalid oauth state in redirected URL"); + } + + const hubUrl = opts?.hubUrl || HUB_URL; + + const openidConfigUrl = `${new URL(hubUrl).origin}/.well-known/openid-configuration`; + const openidConfigRes = await fetch(openidConfigUrl, { + headers: { + Accept: "application/json", + }, + }); + + if (!openidConfigRes.ok) { + throw await createApiError(openidConfigRes); + } + + const openidConfig: { + authorization_endpoint: string; + token_endpoint: string; + userinfo_endpoint: string; + } = await openidConfigRes.json(); + + const tokenRes = await fetch(openidConfig.token_endpoint, { + method: "POST", + headers: { + "Content-Type": "application/x-www-form-urlencoded", + }, + body: new URLSearchParams({ + grant_type: "authorization_code", + code, + redirect_uri: parsedState.redirectUri, + code_verifier: codeVerifier, + }).toString(), + }); + + if (!opts?.codeVerifier) { + localStorage.removeItem("huggingface.co:oauth:code_verifier"); + } + if (!opts?.nonce) { + localStorage.removeItem("huggingface.co:oauth:nonce"); + } + + if (!tokenRes.ok) { + throw await createApiError(tokenRes); + } + + const token: { + access_token: string; + expires_in: number; + id_token: string; + // refresh_token: string; + scope: string; + token_type: string; + } = await tokenRes.json(); + + const accessTokenExpiresAt = new Date(Date.now() + token.expires_in * 1000); + + const userInfoRes = await fetch(openidConfig.userinfo_endpoint, { + headers: { + Authorization: `Bearer ${token.access_token}`, + }, + }); + + if (!userInfoRes.ok) { + throw await createApiError(userInfoRes); + } + + const userInfo: UserInfo = await userInfoRes.json(); + + return { + accessToken: token.access_token, + accessTokenExpiresAt, + userInfo: userInfo, + state: parsedState.state, + scope: token.scope, + }; +} + +// if (code && !nonce) { +// console.warn("Missing oauth nonce from localStorage"); +// } + +/** + * To call after the OAuth provider redirects back to the app. + * + * It returns false if the URL does not contain an oauth code in the query parameters, otherwise + * it calls {@link oauthHandleRedirect}. + * + * Depending on your app, you may want to call {@link oauthHandleRedirect} directly instead. + */ +export async function oauthHandleRedirectIfPresent(opts?: { + /** + * The URL of the hub. Defaults to {@link HUB_URL}. + */ + hubUrl?: string; + /** + * The URL to analyze. + * + * @default window.location.href + */ + redirectedUrl?: string; + /** + * nonce generated by oauthLoginUrl + * + * @default localStorage.getItem("huggingface.co:oauth:nonce") + */ + nonce?: string; + /** + * codeVerifier generated by oauthLoginUrl + * + * @default localStorage.getItem("huggingface.co:oauth:code_verifier") + */ + codeVerifier?: string; +}): Promise { + if (typeof window === "undefined" && !opts?.redirectedUrl) { + throw new Error("oauthHandleRedirect is only available in the browser, unless you provide redirectedUrl"); + } + if (typeof localStorage === "undefined" && (!opts?.nonce || !opts?.codeVerifier)) { + throw new Error( + "oauthHandleRedirect requires localStorage to be available, unless you provide nonce and codeVerifier", + ); + } + const searchParams = new URLSearchParams(opts?.redirectedUrl ?? window.location.search); + + if (searchParams.has("error")) { + return oauthHandleRedirect(opts); + } + + if (searchParams.has("code")) { + if (!localStorage.getItem("huggingface.co:oauth:nonce")) { + console.warn( + "Missing oauth nonce from localStorage. This can happen when the user refreshes the page after logging in, without changing the URL.", + ); + return false; + } + + return oauthHandleRedirect(opts); + } + + return false; +} diff --git a/node_modules/@huggingface/hub/src/lib/oauth-login-url.ts b/node_modules/@huggingface/hub/src/lib/oauth-login-url.ts new file mode 100644 index 0000000000000000000000000000000000000000..a7ba0b1cdab559be1fef5c8001eb9faacd810ab5 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/oauth-login-url.ts @@ -0,0 +1,166 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import { base64FromBytes } from "../utils/base64FromBytes"; + +/** + * Use "Sign in with Hub" to authenticate a user, and get oauth user info / access token. + * + * Returns an url to redirect to. After the user is redirected back to your app, call `oauthHandleRedirect` to get the oauth user info / access token. + * + * When called from inside a static Space with OAuth enabled, it will load the config from the space, otherwise you need to at least specify + * the client ID of your OAuth App. + * + * @example + * ```ts + * import { oauthLoginUrl, oauthHandleRedirectIfPresent } from "@huggingface/hub"; + * + * const oauthResult = await oauthHandleRedirectIfPresent(); + * + * if (!oauthResult) { + * // If the user is not logged in, redirect to the login page + * window.location.href = await oauthLoginUrl(); + * } + * + * // You can use oauthResult.accessToken, oauthResult.accessTokenExpiresAt and oauthResult.userInfo + * console.log(oauthResult); + * ``` + * + * (Theoretically, this function could be used to authenticate a user for any OAuth provider supporting PKCE and OpenID Connect by changing `hubUrl`, + * but it is currently only tested with the Hugging Face Hub.) + */ +export async function oauthLoginUrl(opts?: { + /** + * OAuth client ID. + * + * For static Spaces, you can omit this and it will be loaded from the Space config, as long as `hf_oauth: true` is present in the README.md's metadata. + * For other Spaces, it is available to the backend in the OAUTH_CLIENT_ID environment variable, as long as `hf_oauth: true` is present in the README.md's metadata. + * + * You can also create a Developer Application at https://huggingface.co/settings/connected-applications and use its client ID. + */ + clientId?: string; + hubUrl?: string; + /** + * OAuth scope, a list of space-separated scopes. + * + * For static Spaces, you can omit this and it will be loaded from the Space config, as long as `hf_oauth: true` is present in the README.md's metadata. + * For other Spaces, it is available to the backend in the OAUTH_SCOPES environment variable, as long as `hf_oauth: true` is present in the README.md's metadata. + * + * Defaults to "openid profile". + * + * You can also create a Developer Application at https://huggingface.co/settings/connected-applications and use its scopes. + * + * See https://huggingface.co/docs/hub/oauth for a list of available scopes. + */ + scopes?: string; + /** + * Redirect URI, defaults to the current URL. + * + * For Spaces, any URL within the Space is allowed. + * + * For Developer Applications, you can add any URL you want to the list of allowed redirect URIs at https://huggingface.co/settings/connected-applications. + */ + redirectUrl?: string; + /** + * State to pass to the OAuth provider, which will be returned in the call to `oauthLogin` after the redirect. + */ + state?: string; + /** + * If provided, will be filled with the code verifier and nonce used for the OAuth flow, + * instead of using localStorage. + * + * When calling {@link `oauthHandleRedirectIfPresent`} or {@link `oauthHandleRedirect`} you will need to provide the same values. + */ + localStorage?: { + codeVerifier?: string; + nonce?: string; + }; +}): Promise { + if (typeof window === "undefined" && (!opts?.redirectUrl || !opts?.clientId)) { + throw new Error("oauthLogin is only available in the browser, unless you provide clientId and redirectUrl"); + } + if (typeof localStorage === "undefined" && !opts?.localStorage) { + throw new Error( + "oauthLogin requires localStorage to be available in the context, unless you provide a localStorage empty object as argument", + ); + } + + const hubUrl = opts?.hubUrl || HUB_URL; + const openidConfigUrl = `${new URL(hubUrl).origin}/.well-known/openid-configuration`; + const openidConfigRes = await fetch(openidConfigUrl, { + headers: { + Accept: "application/json", + }, + }); + + if (!openidConfigRes.ok) { + throw await createApiError(openidConfigRes); + } + + const opendidConfig: { + authorization_endpoint: string; + token_endpoint: string; + userinfo_endpoint: string; + } = await openidConfigRes.json(); + + const newNonce = globalThis.crypto.randomUUID(); + // Two random UUIDs concatenated together, because min length is 43 and max length is 128 + const newCodeVerifier = globalThis.crypto.randomUUID() + globalThis.crypto.randomUUID(); + + if (opts?.localStorage) { + if (opts.localStorage.codeVerifier !== undefined && opts.localStorage.codeVerifier !== null) { + throw new Error( + "localStorage.codeVerifier must be initially set to null or undefined, and will be filled by oauthLoginUrl", + ); + } + if (opts.localStorage.nonce !== undefined && opts.localStorage.nonce !== null) { + throw new Error( + "localStorage.nonce must be initially set to null or undefined, and will be filled by oauthLoginUrl", + ); + } + opts.localStorage.codeVerifier = newCodeVerifier; + opts.localStorage.nonce = newNonce; + } else { + localStorage.setItem("huggingface.co:oauth:nonce", newNonce); + localStorage.setItem("huggingface.co:oauth:code_verifier", newCodeVerifier); + } + + const redirectUri = opts?.redirectUrl || (typeof window !== "undefined" ? window.location.href : undefined); + if (!redirectUri) { + throw new Error("Missing redirectUrl"); + } + const state = JSON.stringify({ + nonce: newNonce, + redirectUri, + state: opts?.state, + }); + + const variables: Record | null = + // @ts-expect-error window.huggingface is defined inside static Spaces. + typeof window !== "undefined" ? (window.huggingface?.variables ?? null) : null; + + const clientId = opts?.clientId || variables?.OAUTH_CLIENT_ID; + + if (!clientId) { + if (variables) { + throw new Error("Missing clientId, please add hf_oauth: true to the README.md's metadata in your static Space"); + } + throw new Error("Missing clientId"); + } + + const challenge = base64FromBytes( + new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(newCodeVerifier))), + ) + .replace(/[+]/g, "-") + .replace(/[/]/g, "_") + .replace(/=/g, ""); + + return `${opendidConfig.authorization_endpoint}?${new URLSearchParams({ + client_id: clientId, + scope: opts?.scopes || variables?.OAUTH_SCOPES || "openid profile", + response_type: "code", + redirect_uri: redirectUri, + state, + code_challenge: challenge, + code_challenge_method: "S256", + }).toString()}`; +} diff --git a/node_modules/@huggingface/hub/src/lib/parse-safetensors-metadata.spec.ts b/node_modules/@huggingface/hub/src/lib/parse-safetensors-metadata.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..4a664c42e22f90ffc9736c939e654ba28ae0f522 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/parse-safetensors-metadata.spec.ts @@ -0,0 +1,326 @@ +import { assert, it, describe } from "vitest"; +import { parseSafetensorsMetadata, parseSafetensorsShardFilename } from "./parse-safetensors-metadata"; +import { sum } from "../utils/sum"; + +describe("parseSafetensorsMetadata", () => { + it("fetch info for single-file (with the default conventional filename)", async () => { + const parse = await parseSafetensorsMetadata({ + repo: "google-bert/bert-base-uncased", + computeParametersCount: true, + revision: "86b5e0934494bd15c9632b12f734a8a67f723594", + }); + + assert(!parse.sharded); + assert.deepStrictEqual(parse.header.__metadata__, { format: "pt" }); + + // Example of one tensor (the header contains many tensors) + + assert.deepStrictEqual(parse.header["bert.embeddings.LayerNorm.beta"], { + dtype: "F32", + shape: [768], + data_offsets: [0, 3072], + }); + + assert.deepStrictEqual(parse.parameterCount, { F32: 110_106_428 }); + assert.deepStrictEqual(sum(Object.values(parse.parameterCount)), 110_106_428); + // total params = 110m + }); + + it("fetch info for sharded (with the default conventional filename)", async () => { + const parse = await parseSafetensorsMetadata({ + repo: "bigscience/bloom", + computeParametersCount: true, + revision: "053d9cd9fbe814e091294f67fcfedb3397b954bb", + }); + + assert(parse.sharded); + + assert.strictEqual(Object.keys(parse.headers).length, 72); + // This model has 72 shards! + + // Example of one tensor inside one file + + assert.deepStrictEqual(parse.headers["model_00012-of-00072.safetensors"]["h.10.input_layernorm.weight"], { + dtype: "BF16", + shape: [14336], + data_offsets: [3288649728, 3288678400], + }); + + assert.deepStrictEqual(parse.parameterCount, { BF16: 176_247_271_424 }); + assert.deepStrictEqual(sum(Object.values(parse.parameterCount)), 176_247_271_424); + // total params = 176B + }); + + it("fetch info for single-file with multiple dtypes", async () => { + const parse = await parseSafetensorsMetadata({ + repo: "roberta-base", + computeParametersCount: true, + revision: "e2da8e2f811d1448a5b465c236feacd80ffbac7b", + }); + + assert(!parse.sharded); + + assert.deepStrictEqual(parse.parameterCount, { F32: 124_697_433, I64: 514 }); + assert.deepStrictEqual(sum(Object.values(parse.parameterCount)), 124_697_947); + // total params = 124m + }); + + it("fetch info for single-file with file path", async () => { + const parse = await parseSafetensorsMetadata({ + repo: "CompVis/stable-diffusion-v1-4", + computeParametersCount: true, + path: "unet/diffusion_pytorch_model.safetensors", + revision: "133a221b8aa7292a167afc5127cb63fb5005638b", + }); + + assert(!parse.sharded); + assert.deepStrictEqual(parse.header.__metadata__, { format: "pt" }); + + // Example of one tensor (the header contains many tensors) + + assert.deepStrictEqual(parse.header["up_blocks.3.resnets.0.norm2.bias"], { + dtype: "F32", + shape: [320], + data_offsets: [3_409_382_416, 3_409_383_696], + }); + + assert.deepStrictEqual(parse.parameterCount, { F32: 859_520_964 }); + assert.deepStrictEqual(sum(Object.values(parse.parameterCount)), 859_520_964); + }); + + it("fetch info for sharded with file path", async () => { + const parse = await parseSafetensorsMetadata({ + repo: "Alignment-Lab-AI/ALAI-gemma-7b", + computeParametersCount: true, + path: "7b/1/model.safetensors.index.json", + revision: "37e307261fe97bbf8b2463d61dbdd1a10daa264c", + }); + + assert(parse.sharded); + + assert.strictEqual(Object.keys(parse.headers).length, 4); + + assert.deepStrictEqual(parse.headers["model-00004-of-00004.safetensors"]["model.layers.24.mlp.up_proj.weight"], { + dtype: "BF16", + shape: [24576, 3072], + data_offsets: [301996032, 452990976], + }); + + assert.deepStrictEqual(parse.parameterCount, { BF16: 8_537_680_896 }); + assert.deepStrictEqual(sum(Object.values(parse.parameterCount)), 8_537_680_896); + }); + + it("fetch info for sharded, but get param count directly from metadata", async () => { + const parse = await parseSafetensorsMetadata({ + repo: "hf-internal-testing/sharded-model-metadata-num-parameters", + computeParametersCount: true, + revision: "999395eb3db277f3d7a0393402b02486ca91cef8", + }); + + assert(parse.sharded); + assert.deepStrictEqual(parse.parameterTotal, 109_482_240); + // total params = 109M + }); + + it("fetch info for single-file, but get param count directly from metadata", async () => { + const parse = await parseSafetensorsMetadata({ + repo: "hf-internal-testing/single-file-model", + computeParametersCount: true, + revision: "75fcd3fed0285ac7f1092897ff2aefdf24bf872e", + }); + + assert(!parse.sharded); + assert.deepStrictEqual(parse.parameterTotal, 109_482_240); + }); + + it("should detect sharded safetensors filename", async () => { + const safetensorsFilename = "model_00005-of-00072.safetensors"; // https://huggingface.co/bigscience/bloom/blob/4d8e28c67403974b0f17a4ac5992e4ba0b0dbb6f/model_00005-of-00072.safetensors + const safetensorsShardFileInfo = parseSafetensorsShardFilename(safetensorsFilename); + + assert.strictEqual(safetensorsShardFileInfo?.prefix, "model_"); + assert.strictEqual(safetensorsShardFileInfo?.basePrefix, "model"); + assert.strictEqual(safetensorsShardFileInfo?.shard, "00005"); + assert.strictEqual(safetensorsShardFileInfo?.total, "00072"); + }); + + it("should detect sharded safetensors filename with 6 digits", async () => { + const safetensorsFilename = "model-00001-of-000163.safetensors"; // https://huggingface.co/deepseek-ai/DeepSeek-V3.2-Exp/blob/main/model-00001-of-000163.safetensors + const safetensorsShardFileInfo = parseSafetensorsShardFilename(safetensorsFilename); + + assert.strictEqual(safetensorsShardFileInfo?.prefix, "model-"); + assert.strictEqual(safetensorsShardFileInfo?.basePrefix, "model"); + assert.strictEqual(safetensorsShardFileInfo?.shard, "00001"); + assert.strictEqual(safetensorsShardFileInfo?.total, "000163"); + }); + + it("should support sub-byte data types", async () => { + const newDataTypes: Array<"F4" | "F6_E2M3" | "F6_E3M2" | "E8M0"> = ["F4", "F6_E2M3", "F6_E3M2", "E8M0"]; + + for (const dtype of newDataTypes) { + const tensorInfo = { + dtype, + shape: [1, 2], + data_offsets: [0, 1] as [number, number], + }; + + assert.ok(typeof tensorInfo.dtype === "string"); + assert.ok(["F4", "F6_E2M3", "F6_E3M2", "E8M0"].includes(tensorInfo.dtype)); + } + }); + + it("should handle parameter counting with sub-byte data types", () => { + const mockHeader = { + tensor_f4: { + dtype: "F4" as const, + shape: [10, 20], + data_offsets: [0, 100] as [number, number], + }, + tensor_f6_e2m3: { + dtype: "F6_E2M3" as const, + shape: [5, 10], + data_offsets: [100, 150] as [number, number], + }, + tensor_f6_e3m2: { + dtype: "F6_E3M2" as const, + shape: [8, 12], + data_offsets: [150, 246] as [number, number], + }, + tensor_e8m0: { + dtype: "E8M0" as const, + shape: [4, 6], + data_offsets: [246, 270] as [number, number], + }, + __metadata__: { format: "pt" }, + }; + + const computeNumOfParamsByDtypeSingleFile = (header: typeof mockHeader) => { + const counter: Partial> = {}; + const tensors = Object.fromEntries(Object.entries(header).filter(([key]) => key !== "__metadata__")); + + for (const [, v] of Object.entries(tensors) as [ + string, + { dtype: string; shape: number[]; data_offsets: [number, number] }, + ][]) { + if (v.shape.length === 0) { + continue; + } + counter[v.dtype] = (counter[v.dtype] ?? 0) + v.shape.reduce((a: number, b: number) => a * b); + } + return counter; + }; + + const parameterCount = computeNumOfParamsByDtypeSingleFile(mockHeader); + + assert.strictEqual(parameterCount.F4, 200); + assert.strictEqual(parameterCount.F6_E2M3, 50); + assert.strictEqual(parameterCount.F6_E3M2, 96); + assert.strictEqual(parameterCount.E8M0, 24); + }); + + it("fetch info for GPTQ quantized 8B model", async () => { + const parse = await parseSafetensorsMetadata({ + repo: "RedHatAI/Meta-Llama-3.1-8B-Instruct-quantized.w4a16", + revision: "3921b6aee65496a708b0af456c964ceca7423193", + computeParametersCount: true, + }); + + const parameterCount = parse.parameterCount; + assert.ok(parameterCount); + assert.ok(parameterCount.I32); + assert.ok(parameterCount.F16); + assert.strictEqual(parameterCount.I32, 6_979_321_856); + assert.strictEqual(parameterCount.F16, 1_052_315_648); + + const parameterCountTotal = + parse.parameterTotal ?? + sum( + Object.entries(parameterCount) + .filter(([, value]) => typeof value === "number") + .map(([, value]) => value as number), + ); + + assert.strictEqual(parameterCountTotal, 8_031_637_504); + }); + + it("fetch info for openai/gpt-oss-20b (large sharded model)", async () => { + const parse = await parseSafetensorsMetadata({ + repo: "openai/gpt-oss-20b", + computeParametersCount: true, + revision: "bbf09307421df45099c1e7dcbd64e3106ce5b403", + }); + + assert(parse.sharded); + + assert.ok(Object.keys(parse.headers).length > 1); + assert.ok(parse.parameterCount); + + const totalParams = parse.parameterTotal || sum(Object.values(parse.parameterCount)); + + assert.strictEqual(totalParams, 21_511_953_984); // 21.5B + + assert.ok(parse.parameterCount.BF16 && parse.parameterCount.U8); + + assert.strictEqual(Object.keys(parse.headers).length, 3); + }); + + it("should support FP4 and UE8 data types in type system", () => { + const newDataTypes: Array<"FP4" | "UE8"> = ["FP4", "UE8"]; + + for (const dtype of newDataTypes) { + const tensorInfo = { + dtype, + shape: [1, 2], + data_offsets: [0, 1] as [number, number], + }; + + assert.ok(typeof tensorInfo.dtype === "string"); + assert.ok(["FP4", "UE8"].includes(tensorInfo.dtype)); + } + + const mockHeader = { + tensor_fp4: { + dtype: "FP4" as const, + shape: [100, 200], + data_offsets: [0, 5000] as [number, number], + }, + tensor_ue8: { + dtype: "UE8" as const, + shape: [50, 100], + data_offsets: [5000, 10000] as [number, number], + }, + __metadata__: { format: "pt" }, + }; + + const computeNumOfParamsByDtypeSingleFile = (header: typeof mockHeader) => { + const counter: Partial> = {}; + const tensors = Object.fromEntries(Object.entries(header).filter(([key]) => key !== "__metadata__")); + + for (const [, v] of Object.entries(tensors) as [ + string, + { dtype: string; shape: number[]; data_offsets: [number, number] }, + ][]) { + if (v.shape.length === 0) { + continue; + } + counter[v.dtype] = (counter[v.dtype] ?? 0) + v.shape.reduce((a: number, b: number) => a * b); + } + return counter; + }; + + const parameterCount = computeNumOfParamsByDtypeSingleFile(mockHeader); + + assert.strictEqual(parameterCount.FP4, 20000); + assert.strictEqual(parameterCount.UE8, 5000); + }); + + it("fetch info for moonshotai/Kimi-K2.5 (large index file >20MB)", async () => { + // This model has a ~23.5MB index file due to having many experts + const parse = await parseSafetensorsMetadata({ + repo: "moonshotai/Kimi-K2.5", + revision: "2426b45b6af0da48d0dcce71bbce6225e5c73adc", + }); + + assert(parse.sharded); + assert.strictEqual(Object.keys(parse.headers).length, 64); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/parse-safetensors-metadata.ts b/node_modules/@huggingface/hub/src/lib/parse-safetensors-metadata.ts new file mode 100644 index 0000000000000000000000000000000000000000..f85e845d5831bd3712f928c53447e0d64d2da259 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/parse-safetensors-metadata.ts @@ -0,0 +1,501 @@ +import type { CredentialsParams, RepoDesignation } from "../types/public"; +import { omit } from "../utils/omit"; +import { toRepoId } from "../utils/toRepoId"; +import { typedEntries } from "../utils/typedEntries"; +import { downloadFile } from "./download-file"; +import { fileExists } from "./file-exists"; +import { promisesQueue } from "../utils/promisesQueue"; +import type { SetRequired } from "../vendor/type-fest/set-required"; + +export const SAFETENSORS_FILE = "model.safetensors"; +export const SAFETENSORS_INDEX_FILE = "model.safetensors.index.json"; +/// We advise model/library authors to use the filenames above for convention inside model repos, +/// but in some situations safetensors weights have different filenames. +export const RE_SAFETENSORS_FILE = /\.safetensors$/; +export const RE_SAFETENSORS_INDEX_FILE = /\.safetensors\.index\.json$/; +export const RE_SAFETENSORS_SHARD_FILE = + /^(?(?.*?)[_-])(?\d{5,6})-of-(?\d{5,6})\.safetensors$/; +export interface SafetensorsShardFileInfo { + prefix: string; + basePrefix: string; + shard: string; + total: string; +} +export function parseSafetensorsShardFilename(filename: string): SafetensorsShardFileInfo | null { + const match = RE_SAFETENSORS_SHARD_FILE.exec(filename); + if (match && match.groups) { + return { + prefix: match.groups["prefix"], + basePrefix: match.groups["basePrefix"], + shard: match.groups["shard"], + total: match.groups["total"], + }; + } + return null; +} + +const PARALLEL_DOWNLOADS = 20; +const MAX_HEADER_LENGTH = 25_000_000; // 25MB +const GPTQ_QWEIGHT_SUFFIX = "qweight"; + +class SafetensorParseError extends Error {} + +type FileName = string; + +export type TensorName = string; +export type Dtype = + | "F64" + | "F32" + | "F16" + | "F8_E4M3" + | "F8_E5M2" + | "E8M0" + | "F6_E3M2" + | "F6_E2M3" + | "F4" + | "FP4" + | "BF16" + | "I64" + | "I32" + | "I16" + | "I8" + | "U16" + | "U8" + | "UE8" + | "BOOL"; + +export interface TensorInfo { + dtype: Dtype; + shape: number[]; + data_offsets: [number, number]; +} + +export type SafetensorsFileHeader = Record & { + __metadata__: { total_parameters?: string | number } & Record; +}; + +export interface SafetensorsIndexJson { + dtype?: string; + /// ^there's sometimes a dtype but it looks inconsistent. + metadata?: { total_parameters?: string | number } & Record; + /// ^ why the naming inconsistency? + weight_map: Record; +} + +export type SafetensorsShardedHeaders = Record; + +export type SafetensorsParseFromRepo = + | { + sharded: false; + header: SafetensorsFileHeader; + parameterCount?: Partial>; + parameterTotal?: number; + } + | { + sharded: true; + index: SafetensorsIndexJson; + headers: SafetensorsShardedHeaders; + parameterCount?: Partial>; + parameterTotal?: number; + }; + +/** + * Fetches and parses model config.json + */ +async function fetchModelConfig( + params: { + repo: RepoDesignation; + revision?: string; + hubUrl?: string; + fetch?: typeof fetch; + } & Partial, +): Promise { + try { + const configBlob = await downloadFile({ + ...params, + path: "config.json", + }); + + if (!configBlob) { + return null; + } + + const config = JSON.parse(await configBlob.text()); + return config as ModelConfig; + } catch (error) { + // Config file might not exist or be inaccessible + return null; + } +} + +async function parseSingleFile( + path: string, + params: { + repo: RepoDesignation; + revision?: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise { + const blob = await downloadFile({ ...params, path }); + + if (!blob) { + throw new SafetensorParseError(`Failed to parse file ${path}: failed to fetch safetensors header length.`); + } + + const bufLengthOfHeaderLE = await blob.slice(0, 8).arrayBuffer(); + const lengthOfHeader = new DataView(bufLengthOfHeaderLE).getBigUint64(0, true); + // ^little-endian + if (lengthOfHeader <= 0) { + throw new SafetensorParseError(`Failed to parse file ${path}: safetensors header is malformed.`); + } + if (lengthOfHeader > MAX_HEADER_LENGTH) { + throw new SafetensorParseError( + `Failed to parse file ${path}: safetensor header is too big. Maximum supported size is ${MAX_HEADER_LENGTH} bytes.`, + ); + } + + try { + // no validation for now, we assume it's a valid FileHeader. + const header: SafetensorsFileHeader = JSON.parse(await blob.slice(8, 8 + Number(lengthOfHeader)).text()); + return header; + } catch (err) { + throw new SafetensorParseError(`Failed to parse file ${path}: safetensors header is not valid JSON.`); + } +} + +async function parseShardedIndex( + path: string, + params: { + repo: RepoDesignation; + revision?: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise { + const indexBlob = await downloadFile({ + ...params, + path, + }); + + if (!indexBlob) { + throw new SafetensorParseError(`Failed to parse file ${path}: failed to fetch safetensors index.`); + } + + try { + // no validation for now, we assume it's a valid IndexJson. + const index = JSON.parse(await indexBlob.slice(0, MAX_HEADER_LENGTH).text()); + return index; + } catch (error) { + throw new SafetensorParseError(`Failed to parse file ${path}: not a valid JSON.`); + } +} + +async function fetchAllHeaders( + path: string, + index: SafetensorsIndexJson, + params: { + repo: RepoDesignation; + revision?: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise { + const pathPrefix = path.slice(0, path.lastIndexOf("/") + 1); + const filenames = [...new Set(Object.values(index.weight_map))]; + const shardedMap: SafetensorsShardedHeaders = Object.fromEntries( + await promisesQueue( + filenames.map( + (filename) => async () => + [filename, await parseSingleFile(pathPrefix + filename, params)] satisfies [string, SafetensorsFileHeader], + ), + PARALLEL_DOWNLOADS, + ), + ); + return shardedMap; +} + +/** + * Analyze model.safetensors.index.json or model.safetensors from a model hosted + * on Hugging Face using smart range requests to extract its metadata. + */ +export async function parseSafetensorsMetadata( + params: { + /** Only models are supported */ + repo: RepoDesignation; + /** + * Relative file path to safetensors file inside `repo`. Defaults to `SAFETENSORS_FILE` or `SAFETENSORS_INDEX_FILE` (whichever one exists). + */ + path?: string; + /** + * Will include SafetensorsParseFromRepo["parameterCount"], an object containing the number of parameters for each DType + * + * @default false + */ + computeParametersCount: true; + hubUrl?: string; + revision?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise>; +export async function parseSafetensorsMetadata( + params: { + /** Only models are supported */ + repo: RepoDesignation; + path?: string; + /** + * Will include SafetensorsParseFromRepo["parameterCount"], an object containing the number of parameters for each DType + * + * @default false + */ + computeParametersCount?: boolean; + hubUrl?: string; + revision?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise; +export async function parseSafetensorsMetadata( + params: { + repo: RepoDesignation; + path?: string; + computeParametersCount?: boolean; + hubUrl?: string; + revision?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise { + const repoId = toRepoId(params.repo); + + if (repoId.type !== "model") { + throw new TypeError("Only model repos should contain safetensors files."); + } + + // Fetch model config for quantization information + const modelConfig = params.computeParametersCount ? await fetchModelConfig(params) : null; + const quantConfig = modelConfig?.quantization_config; + + if ( + (params.path && RE_SAFETENSORS_FILE.test(params.path)) || + (await fileExists({ ...params, path: SAFETENSORS_FILE })) + ) { + const header = await parseSingleFile(params.path ?? SAFETENSORS_FILE, params); + return { + sharded: false, + header, + ...(params.computeParametersCount + ? { + parameterCount: computeNumOfParamsByDtypeSingleFile(header, quantConfig), + parameterTotal: + /// shortcut: get param count directly from metadata + header.__metadata__.total_parameters + ? typeof header.__metadata__.total_parameters === "number" + ? header.__metadata__.total_parameters + : typeof header.__metadata__.total_parameters === "string" + ? parseInt(header.__metadata__.total_parameters) + : undefined + : undefined, + } + : undefined), + }; + } else if ( + (params.path && RE_SAFETENSORS_INDEX_FILE.test(params.path)) || + (await fileExists({ ...params, path: SAFETENSORS_INDEX_FILE })) + ) { + const path = params.path ?? SAFETENSORS_INDEX_FILE; + const index = await parseShardedIndex(path, params); + const shardedMap = await fetchAllHeaders(path, index, params); + + return { + sharded: true, + index, + headers: shardedMap, + ...(params.computeParametersCount + ? { + parameterCount: computeNumOfParamsByDtypeSharded(shardedMap, quantConfig), + parameterTotal: + /// shortcut: get param count directly from metadata + index.metadata?.total_parameters + ? typeof index.metadata.total_parameters === "number" + ? index.metadata.total_parameters + : typeof index.metadata.total_parameters === "string" + ? parseInt(index.metadata.total_parameters) + : undefined + : undefined, + } + : undefined), + }; + } else { + throw new Error("model id does not seem to contain safetensors weights"); + } +} + +export interface QuantizationConfig { + quant_method?: string; + modules_to_not_convert?: string[]; + bits?: number; + load_in_4bit?: boolean; + load_in_8bit?: boolean; +} + +export interface ModelConfig { + quantization_config?: QuantizationConfig; +} + +/** + * Determines if a tensor is quantized based on quantization config and tensor name + */ +function isQuantizedTensor(tensorName: string, quantConfig?: QuantizationConfig): boolean { + if (!quantConfig) { + return false; + } + + if (!quantConfig.modules_to_not_convert || quantConfig.modules_to_not_convert.length === 0) { + return true; + } + + for (const pattern of quantConfig.modules_to_not_convert) { + const regexPattern = pattern.replace(/\*/g, ".*"); + const regex = new RegExp(regexPattern); + if (regex.test(tensorName)) { + return false; + } + } + + return true; +} + +/** + * Gets the parameter multiplier for a quantized tensor based on quantization method + */ +function getQuantizationMultiplier(tensorName: string, dtype: Dtype, quantConfig?: QuantizationConfig): number { + if (!quantConfig || !isQuantizedTensor(tensorName, quantConfig)) { + return 1; + } + + const quantMethod = quantConfig.quant_method?.toLowerCase(); + + switch (quantMethod) { + case "mxfp4": + if (dtype === "U8" && tensorName.includes("_blocks")) { + return 2; + } + return 1; + + case "gptq": + case "awq": + if (getTensorSuffix(tensorName) === GPTQ_QWEIGHT_SUFFIX) { + const bits = quantConfig.bits && quantConfig.bits > 0 ? quantConfig.bits : 4; + return Math.max(1, Math.floor(32 / bits)); + } + if (quantConfig.bits === 4 && dtype === "U8") { + return 2; + } + if (quantConfig.bits === 2 && dtype === "U8") { + return 4; + } + return 1; + + case "bitsandbytes": + if (quantConfig.load_in_4bit && dtype === "U8") { + return 2; + } + if (quantConfig.load_in_8bit) { + return 1; + } + return 1; + + default: + if (quantConfig.load_in_4bit && dtype === "U8") { + return 2; + } + if (quantConfig.bits === 4 && dtype === "U8") { + return 2; + } + return 1; + } +} + +function computeNumOfParamsByDtypeSingleFile( + header: SafetensorsFileHeader, + quantConfig?: QuantizationConfig, +): Partial> { + const counter: Partial> = {}; + const tensors = omit(header, "__metadata__"); + + for (const [tensorName, v] of typedEntries(tensors)) { + if (shouldSkipTensor(tensorName, quantConfig)) { + continue; + } + if (v.shape.length === 0) { + continue; + } + + const elements = v.shape.reduce((a, b) => a * b); + const multiplier = quantConfig ? getQuantizationMultiplier(tensorName, v.dtype, quantConfig) : 1; + if (multiplier === 0) { + continue; + } + counter[v.dtype] = (counter[v.dtype] ?? 0) + elements * multiplier; + } + return counter; +} + +function computeNumOfParamsByDtypeSharded( + shardedMap: SafetensorsShardedHeaders, + quantConfig?: QuantizationConfig, +): Partial> { + const counter: Partial> = {}; + for (const header of Object.values(shardedMap)) { + for (const [k, v] of typedEntries(computeNumOfParamsByDtypeSingleFile(header, quantConfig))) { + counter[k] = (counter[k] ?? 0) + (v ?? 0); + } + } + return counter; +} + +function getTensorSuffix(tensorName: string): string { + const lastDotIndex = tensorName.lastIndexOf("."); + return lastDotIndex === -1 ? tensorName : tensorName.slice(lastDotIndex + 1); +} + +function shouldSkipTensor(tensorName: string, quantConfig?: QuantizationConfig): boolean { + const GPTQ_AWQ_AUXILIARY_SUFFIXES = ["qzeros", "g_idx", "scales"]; + + if (!quantConfig) { + return false; + } + + const quantMethod = quantConfig.quant_method?.toLowerCase(); + if (!quantMethod || (quantMethod !== "gptq" && quantMethod !== "awq")) { + return false; + } + + if (!isQuantizedTensor(tensorName, quantConfig)) { + return false; + } + + const suffix = getTensorSuffix(tensorName); + if (suffix === GPTQ_QWEIGHT_SUFFIX) { + return false; + } + + return GPTQ_AWQ_AUXILIARY_SUFFIXES.includes(suffix); +} diff --git a/node_modules/@huggingface/hub/src/lib/paths-info.spec.ts b/node_modules/@huggingface/hub/src/lib/paths-info.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..7a888251b387f1244bcf4238abcb35a86c0db0e4 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/paths-info.spec.ts @@ -0,0 +1,73 @@ +import { expect, it, describe } from "vitest"; +import type { CommitInfo, PathInfo } from "./paths-info"; +import { pathsInfo } from "./paths-info"; + +describe("pathsInfo", () => { + it("should fetch LFS path info", async () => { + const result: PathInfo[] = await pathsInfo({ + repo: { + name: "google-bert/bert-base-uncased", + type: "model", + }, + paths: ["tf_model.h5"], + revision: "dd4bc8b21efa05ec961e3efc4ee5e3832a3679c7", + }); + + expect(result).toHaveLength(1); + + const modelPathInfo = result[0]; + expect(modelPathInfo.path).toBe("tf_model.h5"); + expect(modelPathInfo.type).toBe("file"); + // lfs pointer, therefore lfs should be defined + expect(modelPathInfo?.lfs).toBeDefined(); + expect(modelPathInfo?.lfs?.oid).toBe("a7a17d6d844b5de815ccab5f42cad6d24496db3850a2a43d8258221018ce87d2"); + expect(modelPathInfo?.lfs?.size).toBe(536063208); + expect(modelPathInfo?.lfs?.pointerSize).toBe(134); + + // should not include expand info + expect(modelPathInfo.lastCommit).toBeUndefined(); + expect(modelPathInfo.securityFileStatus).toBeUndefined(); + }); + + it("expand params should fetch lastCommit", async () => { + const result: (PathInfo & { + lastCommit: CommitInfo; + })[] = await pathsInfo({ + repo: { + name: "google-bert/bert-base-uncased", + type: "model", + }, + paths: ["tf_model.h5"], + revision: "dd4bc8b21efa05ec961e3efc4ee5e3832a3679c7", + expand: true, // include + }); + + expect(result).toHaveLength(1); + + const modelPathInfo = result[0]; + + // should include expand info + expect(modelPathInfo.lastCommit).toBeDefined(); + + expect(modelPathInfo.lastCommit.id).toBe("dd4bc8b21efa05ec961e3efc4ee5e3832a3679c7"); + expect(modelPathInfo.lastCommit.title).toBe("Update tf_model.h5"); + expect(modelPathInfo.lastCommit.date.getTime()).toBe(1569268124000); // 2019-09-23T19:48:44.000Z + }); + + it("non-LFS pointer should have lfs undefined", async () => { + const result: PathInfo[] = await pathsInfo({ + repo: { + name: "google-bert/bert-base-uncased", + type: "model", + }, + paths: ["config.json"], + revision: "dd4bc8b21efa05ec961e3efc4ee5e3832a3679c7", + }); + + expect(result).toHaveLength(1); + + const modelPathInfo = result[0]; + expect(modelPathInfo.path).toBe("config.json"); + expect(modelPathInfo.lfs).toBeUndefined(); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/paths-info.ts b/node_modules/@huggingface/hub/src/lib/paths-info.ts new file mode 100644 index 0000000000000000000000000000000000000000..1f8a60c0489863d704b43de0db344fe7d5aa245e --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/paths-info.ts @@ -0,0 +1,124 @@ +import type { CredentialsParams, RepoDesignation } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { toRepoId } from "../utils/toRepoId"; +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; + +export interface LfsPathInfo { + oid: string; + size: number; + pointerSize: number; +} + +export interface CommitInfo { + id: string; + title: string; + date: Date; +} + +export interface SecurityFileStatus { + status: string; +} + +export interface PathInfo { + path: string; + type: string; + oid: string; + size: number; + /** + * Only defined when path is LFS pointer + */ + lfs?: LfsPathInfo; + lastCommit?: CommitInfo; + securityFileStatus?: SecurityFileStatus; +} + +// Define the overloaded signatures +export function pathsInfo( + params: { + repo: RepoDesignation; + paths: string[]; + expand: true; // if expand true + revision?: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise<(PathInfo & { lastCommit: CommitInfo; securityFileStatus: SecurityFileStatus })[]>; +export function pathsInfo( + params: { + repo: RepoDesignation; + paths: string[]; + expand?: boolean; + revision?: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise; + +export async function pathsInfo( + params: { + repo: RepoDesignation; + paths: string[]; + expand?: boolean; + revision?: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise { + const accessToken = checkCredentials(params); + const repoId = toRepoId(params.repo); + + const hubUrl = params.hubUrl ?? HUB_URL; + + const url = `${hubUrl}/api/${repoId.type}s/${repoId.name}/paths-info/${encodeURIComponent( + params.revision ?? "main", + )}`; + + const resp = await (params.fetch ?? fetch)(url, { + method: "POST", + headers: { + ...(accessToken && { + Authorization: `Bearer ${accessToken}`, + }), + Accept: "application/json", + "Content-Type": "application/json", + }, + body: JSON.stringify({ + paths: params.paths, + expand: params.expand, + }), + }); + + if (!resp.ok) { + throw await createApiError(resp); + } + + const json: unknown = await resp.json(); + if (!Array.isArray(json)) throw new Error("malformed response: expected array"); + + return json.map((item: PathInfo) => ({ + path: item.path, + lfs: item.lfs, + type: item.type, + oid: item.oid, + size: item.size, + // expand fields + securityFileStatus: item.securityFileStatus, + lastCommit: item.lastCommit + ? { + date: new Date(item.lastCommit.date), + title: item.lastCommit.title, + id: item.lastCommit.id, + } + : undefined, + })); +} diff --git a/node_modules/@huggingface/hub/src/lib/repo-exists.spec.ts b/node_modules/@huggingface/hub/src/lib/repo-exists.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..c4bbb192f236db689fbed854df5609d5d6c091e9 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/repo-exists.spec.ts @@ -0,0 +1,13 @@ +import { describe, expect, it } from "vitest"; +import { repoExists } from "./repo-exists"; + +describe("repoExists", () => { + it("should check if a repo exists", async () => { + const exists1 = await repoExists({ repo: { type: "model", name: "openai-community/gpt2" } }); + + expect(exists1).toBe(true); + + const exists2 = await repoExists({ repo: { type: "model", name: "openai-community/gpt9000" } }); + expect(exists2).toBe(false); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/repo-exists.ts b/node_modules/@huggingface/hub/src/lib/repo-exists.ts new file mode 100644 index 0000000000000000000000000000000000000000..8be149df4337adfd02675e2b3f2682c1552f9de8 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/repo-exists.ts @@ -0,0 +1,43 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { RepoDesignation } from "../types/public"; +import { toRepoId } from "../utils/toRepoId"; + +export async function repoExists(params: { + repo: RepoDesignation; + + hubUrl?: string; + /** + * An optional Git revision id which can be a branch name, a tag, or a commit hash. + */ + revision?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + accessToken?: string; +}): Promise { + const repoId = toRepoId(params.repo); + + const res = await (params.fetch ?? fetch)( + `${params.hubUrl ?? HUB_URL}/api/${repoId.type}s/${repoId.name}?expand[]=likes`, + { + method: "GET", + headers: { + ...(params.accessToken && { + Authorization: `Bearer ${params.accessToken}`, + }), + }, + }, + ); + + if (res.status === 404 || res.status === 401) { + return false; + } + + if (!res.ok) { + throw await createApiError(res); + } + + return true; +} diff --git a/node_modules/@huggingface/hub/src/lib/snapshot-download.spec.ts b/node_modules/@huggingface/hub/src/lib/snapshot-download.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..0ecb938117814ec9fc409b7b1c420f8cff14807c --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/snapshot-download.spec.ts @@ -0,0 +1,275 @@ +import { expect, test, describe, vi, beforeEach } from "vitest"; +import { dirname, join } from "node:path"; +import { mkdir, writeFile } from "node:fs/promises"; +import { getHFHubCachePath } from "./cache-management"; +import { downloadFileToCacheDir } from "./download-file-to-cache-dir"; +import { snapshotDownload } from "./snapshot-download"; +import type { ListFileEntry } from "./list-files"; +import { listFiles } from "./list-files"; +import { modelInfo } from "./model-info"; +import type { ModelEntry } from "./list-models"; +import type { ApiModelInfo } from "../types/api/api-model"; +import { datasetInfo } from "./dataset-info"; +import type { DatasetEntry } from "./list-datasets"; +import type { ApiDatasetInfo } from "../types/api/api-dataset"; +import { spaceInfo } from "./space-info"; +import type { SpaceEntry } from "./list-spaces"; +import type { ApiSpaceInfo } from "../types/api/api-space"; + +vi.mock("node:fs/promises", () => ({ + writeFile: vi.fn(), + mkdir: vi.fn(), +})); + +vi.mock("./space-info", () => ({ + spaceInfo: vi.fn(), +})); + +vi.mock("./dataset-info", () => ({ + datasetInfo: vi.fn(), +})); + +vi.mock("./model-info", () => ({ + modelInfo: vi.fn(), +})); + +vi.mock("./list-files", () => ({ + listFiles: vi.fn(), +})); + +vi.mock("./download-file-to-cache-dir", () => ({ + downloadFileToCacheDir: vi.fn(), +})); + +const DUMMY_SHA = "dummy-sha"; + +// utility method to transform an array of ListFileEntry to an AsyncGenerator +async function* toAsyncGenerator(content: ListFileEntry[]): AsyncGenerator { + for (const entry of content) { + yield Promise.resolve(entry); + } +} + +beforeEach(() => { + vi.resetAllMocks(); + vi.mocked(listFiles).mockReturnValue(toAsyncGenerator([])); + + // mock repo info + vi.mocked(modelInfo).mockResolvedValue({ + sha: DUMMY_SHA, + } as ModelEntry & ApiModelInfo); + vi.mocked(datasetInfo).mockResolvedValue({ + sha: DUMMY_SHA, + } as DatasetEntry & ApiDatasetInfo); + vi.mocked(spaceInfo).mockResolvedValue({ + sha: DUMMY_SHA, + } as SpaceEntry & ApiSpaceInfo); +}); + +describe("snapshotDownload", () => { + test("empty AsyncGenerator should not call downloadFileToCacheDir", async () => { + await snapshotDownload({ + repo: { + name: "foo/bar", + type: "space", + }, + }); + + expect(downloadFileToCacheDir).not.toHaveBeenCalled(); + }); + + test("repo type model should use modelInfo", async () => { + await snapshotDownload({ + repo: { + name: "foo/bar", + type: "model", + }, + }); + expect(modelInfo).toHaveBeenCalledOnce(); + expect(modelInfo).toHaveBeenCalledWith({ + name: "foo/bar", + additionalFields: ["sha"], + revision: "main", + repo: { + name: "foo/bar", + type: "model", + }, + }); + }); + + test("repo type dataset should use datasetInfo", async () => { + await snapshotDownload({ + repo: { + name: "foo/bar", + type: "dataset", + }, + }); + expect(datasetInfo).toHaveBeenCalledOnce(); + expect(datasetInfo).toHaveBeenCalledWith({ + name: "foo/bar", + additionalFields: ["sha"], + revision: "main", + repo: { + name: "foo/bar", + type: "dataset", + }, + }); + }); + + test("repo type space should use spaceInfo", async () => { + await snapshotDownload({ + repo: { + name: "foo/bar", + type: "space", + }, + }); + expect(spaceInfo).toHaveBeenCalledOnce(); + expect(spaceInfo).toHaveBeenCalledWith({ + name: "foo/bar", + additionalFields: ["sha"], + revision: "main", + repo: { + name: "foo/bar", + type: "space", + }, + }); + }); + + test("commitHash should be saved to ref folder", async () => { + await snapshotDownload({ + repo: { + name: "foo/bar", + type: "space", + }, + revision: "dummy-revision", + }); + + // cross-platform testing + const expectedPath = join(getHFHubCachePath(), "spaces--foo--bar", "refs", "dummy-revision"); + expect(mkdir).toHaveBeenCalledWith(dirname(expectedPath), { recursive: true }); + expect(writeFile).toHaveBeenCalledWith(expectedPath, DUMMY_SHA); + }); + + test("directory ListFileEntry should mkdir it", async () => { + vi.mocked(listFiles).mockReturnValue( + toAsyncGenerator([ + { + oid: "dummy-etag", + type: "directory", + path: "potatoes", + size: 0, + lastCommit: { + date: new Date().toISOString(), + id: DUMMY_SHA, + title: "feat: best commit", + }, + }, + ]), + ); + + await snapshotDownload({ + repo: { + name: "foo/bar", + type: "space", + }, + }); + + // cross-platform testing + const expectedPath = join(getHFHubCachePath(), "spaces--foo--bar", "snapshots", DUMMY_SHA, "potatoes"); + expect(mkdir).toHaveBeenCalledWith(expectedPath, { recursive: true }); + }); + + test("files in ListFileEntry should download them", async () => { + const entries: ListFileEntry[] = Array.from({ length: 10 }, (_, i) => ({ + oid: `dummy-etag-${i}`, + type: "file", + path: `file-${i}.txt`, + size: i, + lastCommit: { + date: new Date().toISOString(), + id: DUMMY_SHA, + title: "feat: best commit", + }, + })); + vi.mocked(listFiles).mockReturnValue(toAsyncGenerator(entries)); + + await snapshotDownload({ + repo: { + name: "foo/bar", + type: "space", + }, + }); + + for (const entry of entries) { + expect(downloadFileToCacheDir).toHaveBeenCalledWith( + expect.objectContaining({ + repo: { + name: "foo/bar", + type: "space", + }, + path: entry.path, + revision: DUMMY_SHA, + }), + ); + } + }); + + test("custom params should be propagated", async () => { + // fetch mock + const fetchMock: typeof fetch = vi.fn(); + const hubMock = "https://foor.bar"; + const accessTokenMock = "dummy-access-token"; + + vi.mocked(listFiles).mockReturnValue( + toAsyncGenerator([ + { + oid: `dummy-etag`, + type: "file", + path: `file.txt`, + size: 10, + lastCommit: { + date: new Date().toISOString(), + id: DUMMY_SHA, + title: "feat: best commit", + }, + }, + ]), + ); + + await snapshotDownload({ + repo: { + name: "foo/bar", + type: "space", + }, + hubUrl: hubMock, + fetch: fetchMock, + accessToken: accessTokenMock, + }); + + expect(spaceInfo).toHaveBeenCalledWith( + expect.objectContaining({ + fetch: fetchMock, + hubUrl: hubMock, + accessToken: accessTokenMock, + }), + ); + + // list files should receive custom fetch + expect(listFiles).toHaveBeenCalledWith( + expect.objectContaining({ + fetch: fetchMock, + hubUrl: hubMock, + accessToken: accessTokenMock, + }), + ); + + // download file to cache should receive custom fetch + expect(downloadFileToCacheDir).toHaveBeenCalledWith( + expect.objectContaining({ + fetch: fetchMock, + hubUrl: hubMock, + accessToken: accessTokenMock, + }), + ); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/snapshot-download.ts b/node_modules/@huggingface/hub/src/lib/snapshot-download.ts new file mode 100644 index 0000000000000000000000000000000000000000..9b8321fd40a2b49f93c9cfd9a69bf8679abddf6e --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/snapshot-download.ts @@ -0,0 +1,124 @@ +import type { CredentialsParams, RepoDesignation } from "../types/public"; +import { listFiles } from "./list-files"; +import { getHFHubCachePath, getRepoFolderName } from "./cache-management"; +import { spaceInfo } from "./space-info"; +import { datasetInfo } from "./dataset-info"; +import { modelInfo } from "./model-info"; +import { toRepoId } from "../utils/toRepoId"; +import { join, dirname } from "node:path"; +import { mkdir, writeFile } from "node:fs/promises"; +import { downloadFileToCacheDir } from "./download-file-to-cache-dir"; + +export const DEFAULT_REVISION = "main"; + +/** + * Downloads an entire repository at a given revision in the cache directory {@link getHFHubCachePath}. + * You can list all cached repositories using {@link scanCachedRepo} + * @remarks It uses internally {@link downloadFileToCacheDir}. + */ +export async function snapshotDownload( + params: { + repo: RepoDesignation; + cacheDir?: string; + /** + * An optional Git revision id which can be a branch name, a tag, or a commit hash. + * + * @default "main" + */ + revision?: string; + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise { + let cacheDir: string; + if (params.cacheDir) { + cacheDir = params.cacheDir; + } else { + cacheDir = getHFHubCachePath(); + } + + let revision: string; + if (params.revision) { + revision = params.revision; + } else { + revision = DEFAULT_REVISION; + } + + const repoId = toRepoId(params.repo); + + // get repository revision value (sha) + let repoInfo: { sha: string }; + switch (repoId.type) { + case "space": + repoInfo = await spaceInfo({ + ...params, + name: repoId.name, + additionalFields: ["sha"], + revision: revision, + }); + break; + case "dataset": + repoInfo = await datasetInfo({ + ...params, + name: repoId.name, + additionalFields: ["sha"], + revision: revision, + }); + break; + case "model": + repoInfo = await modelInfo({ + ...params, + name: repoId.name, + additionalFields: ["sha"], + revision: revision, + }); + break; + default: + throw new Error(`invalid repository type ${repoId.type}`); + } + + const commitHash: string = repoInfo.sha; + + // get storage folder + const storageFolder = join(cacheDir, getRepoFolderName(repoId)); + const snapshotFolder = join(storageFolder, "snapshots", commitHash); + + // if passed revision is not identical to commit_hash + // then revision has to be a branch name or tag name. + // In that case store a ref. + if (revision !== commitHash) { + const refPath = join(storageFolder, "refs", revision); + await mkdir(dirname(refPath), { recursive: true }); + await writeFile(refPath, commitHash); + } + + const cursor = listFiles({ + ...params, + repo: params.repo, + recursive: true, + revision: repoInfo.sha, + }); + + for await (const entry of cursor) { + switch (entry.type) { + case "file": + await downloadFileToCacheDir({ + ...params, + path: entry.path, + revision: commitHash, + cacheDir: cacheDir, + }); + break; + case "directory": + await mkdir(join(snapshotFolder, entry.path), { recursive: true }); + break; + default: + throw new Error(`unknown entry type: ${entry.type}`); + } + } + + return snapshotFolder; +} diff --git a/node_modules/@huggingface/hub/src/lib/space-info.spec.ts b/node_modules/@huggingface/hub/src/lib/space-info.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..ea966f98bceea2577e268164f8512bc822a8f82e --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/space-info.spec.ts @@ -0,0 +1,53 @@ +import { describe, expect, it } from "vitest"; +import { spaceInfo } from "./space-info"; +import type { SpaceEntry } from "./list-spaces"; +import type { ApiSpaceInfo } from "../types/api/api-space"; + +describe("spaceInfo", () => { + it("should return the space info", async () => { + const info = await spaceInfo({ + name: "huggingfacejs/client-side-oauth", + }); + expect(info).toEqual({ + id: "659835e689010f9c7aed608d", + name: "huggingfacejs/client-side-oauth", + updatedAt: expect.any(Date), + likes: expect.any(Number), + private: false, + sdk: "static", + }); + }); + + it("should return the space info with author", async () => { + const info: SpaceEntry & Pick = await spaceInfo({ + name: "huggingfacejs/client-side-oauth", + additionalFields: ["author"], + }); + expect(info).toEqual({ + id: "659835e689010f9c7aed608d", + name: "huggingfacejs/client-side-oauth", + updatedAt: expect.any(Date), + likes: expect.any(Number), + private: false, + sdk: "static", + author: "huggingfacejs", + }); + }); + + it("should return the space info for a given revision", async () => { + const info: SpaceEntry & Pick = await spaceInfo({ + name: "huggingfacejs/client-side-oauth", + additionalFields: ["sha"], + revision: "e410a9ff348e6bed393b847711e793282d7c672e", + }); + expect(info).toEqual({ + id: "659835e689010f9c7aed608d", + name: "huggingfacejs/client-side-oauth", + updatedAt: expect.any(Date), + likes: expect.any(Number), + private: false, + sdk: "static", + sha: "e410a9ff348e6bed393b847711e793282d7c672e", + }); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/space-info.ts b/node_modules/@huggingface/hub/src/lib/space-info.ts new file mode 100644 index 0000000000000000000000000000000000000000..cbf0fb8555300fd0c77d81d3f4dce0c5563f083e --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/space-info.ts @@ -0,0 +1,60 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { ApiSpaceInfo } from "../types/api/api-space"; +import type { CredentialsParams } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; +import { pick } from "../utils/pick"; +import type { SPACE_EXPANDABLE_KEYS, SpaceEntry } from "./list-spaces"; +import { SPACE_EXPAND_KEYS } from "./list-spaces"; + +export async function spaceInfo< + const T extends Exclude<(typeof SPACE_EXPANDABLE_KEYS)[number], (typeof SPACE_EXPAND_KEYS)[number]> = never, +>( + params: { + name: string; + hubUrl?: string; + additionalFields?: T[]; + /** + * An optional Git revision id which can be a branch name, a tag, or a commit hash. + */ + revision?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & Partial, +): Promise> { + const accessToken = params && checkCredentials(params); + + const search = new URLSearchParams([ + ...SPACE_EXPAND_KEYS.map((val) => ["expand", val] satisfies [string, string]), + ...(params?.additionalFields?.map((val) => ["expand", val] satisfies [string, string]) ?? []), + ]).toString(); + + const response = await (params.fetch || fetch)( + `${params?.hubUrl || HUB_URL}/api/spaces/${params.name}/revision/${encodeURIComponent( + params.revision ?? "HEAD", + )}?${search.toString()}`, + { + headers: { + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + }, + }, + ); + + if (!response.ok) { + throw await createApiError(response); + } + + const data = await response.json(); + + return { + ...(params?.additionalFields && pick(data, params.additionalFields)), + id: data._id, + name: data.id, + sdk: data.sdk, + likes: data.likes, + private: data.private, + updatedAt: new Date(data.lastModified), + } as SpaceEntry & Pick; +} diff --git a/node_modules/@huggingface/hub/src/lib/upload-file.spec.ts b/node_modules/@huggingface/hub/src/lib/upload-file.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..e99e0961593949d4375bb98b6790b9c291e72a5b --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/upload-file.spec.ts @@ -0,0 +1,99 @@ +import { assert, it, describe, expect } from "vitest"; + +import { TEST_ACCESS_TOKEN, TEST_HUB_URL, TEST_USER } from "../test/consts"; +import type { RepoId } from "../types/public"; +import { insecureRandomString } from "../utils/insecureRandomString"; +import { createRepo } from "./create-repo"; +import { deleteRepo } from "./delete-repo"; +import { downloadFile } from "./download-file"; +import { uploadFile } from "./upload-file"; + +describe("uploadFile", () => { + it("should upload a file", async () => { + const repoName = `${TEST_USER}/TEST-${insecureRandomString()}`; + const repo = { type: "model", name: repoName } satisfies RepoId; + + try { + const result = await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + repo, + hubUrl: TEST_HUB_URL, + }); + + expect(result).toEqual({ + repoUrl: `${TEST_HUB_URL}/${repoName}`, + id: expect.any(String), + }); + + await uploadFile({ + accessToken: TEST_ACCESS_TOKEN, + repo, + file: { content: new Blob(["file1"]), path: "file1" }, + hubUrl: TEST_HUB_URL, + }); + await uploadFile({ + accessToken: TEST_ACCESS_TOKEN, + repo, + file: new URL("https://huggingface.co/gpt2/raw/main/config.json"), + hubUrl: TEST_HUB_URL, + }); + + let content = await downloadFile({ + repo, + path: "file1", + hubUrl: TEST_HUB_URL, + }); + + assert.strictEqual(await content?.text(), "file1"); + + content = await downloadFile({ + repo, + path: "config.json", + hubUrl: TEST_HUB_URL, + }); + + assert.strictEqual( + (await content?.text())?.trim(), + ` +{ + "activation_function": "gelu_new", + "architectures": [ + "GPT2LMHeadModel" + ], + "attn_pdrop": 0.1, + "bos_token_id": 50256, + "embd_pdrop": 0.1, + "eos_token_id": 50256, + "initializer_range": 0.02, + "layer_norm_epsilon": 1e-05, + "model_type": "gpt2", + "n_ctx": 1024, + "n_embd": 768, + "n_head": 12, + "n_layer": 12, + "n_positions": 1024, + "resid_pdrop": 0.1, + "summary_activation": null, + "summary_first_dropout": 0.1, + "summary_proj_to_labels": true, + "summary_type": "cls_index", + "summary_use_proj": true, + "task_specific_params": { + "text-generation": { + "do_sample": true, + "max_length": 50 + } + }, + "vocab_size": 50257 +} + `.trim(), + ); + } finally { + await deleteRepo({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + } + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/upload-file.ts b/node_modules/@huggingface/hub/src/lib/upload-file.ts new file mode 100644 index 0000000000000000000000000000000000000000..e02f5ce38ac54adb8ce72e3d3faf90ceb54e75f6 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/upload-file.ts @@ -0,0 +1,49 @@ +import type { CredentialsParams } from "../types/public"; +import type { CommitOutput, CommitParams, ContentSource } from "./commit"; +import { commit } from "./commit"; + +export function uploadFile( + params: { + repo: CommitParams["repo"]; + file: URL | File | { path: string; content: ContentSource }; + commitTitle?: CommitParams["title"]; + commitDescription?: CommitParams["description"]; + hubUrl?: CommitParams["hubUrl"]; + branch?: CommitParams["branch"]; + isPullRequest?: CommitParams["isPullRequest"]; + parentCommit?: CommitParams["parentCommit"]; + fetch?: CommitParams["fetch"]; + useWebWorkers?: CommitParams["useWebWorkers"]; + abortSignal?: CommitParams["abortSignal"]; + useXet?: CommitParams["useXet"]; + } & Partial, +): Promise { + const path = + params.file instanceof URL + ? (params.file.pathname.split("/").at(-1) ?? "file") + : "path" in params.file + ? params.file.path + : params.file.name; + + return commit({ + ...(params.accessToken ? { accessToken: params.accessToken } : { credentials: params.credentials }), + repo: params.repo, + operations: [ + { + operation: "addOrUpdate", + path, + content: "content" in params.file ? params.file.content : params.file, + }, + ], + title: params.commitTitle ?? `Add ${path}`, + description: params.commitDescription, + hubUrl: params.hubUrl, + branch: params.branch, + isPullRequest: params.isPullRequest, + parentCommit: params.parentCommit, + fetch: params.fetch, + useWebWorkers: params.useWebWorkers, + abortSignal: params.abortSignal, + useXet: params.useXet, + }); +} diff --git a/node_modules/@huggingface/hub/src/lib/upload-files-with-progress.spec.ts b/node_modules/@huggingface/hub/src/lib/upload-files-with-progress.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..a5f19bb48600d9fe2dd6bbf8c5bf5458970f5668 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/upload-files-with-progress.spec.ts @@ -0,0 +1,178 @@ +import { assert, it, describe, expect } from "vitest"; + +import { TEST_HUB_URL, TEST_ACCESS_TOKEN, TEST_USER } from "../test/consts"; +import type { RepoId } from "../types/public"; +import { insecureRandomString } from "../utils/insecureRandomString"; +import { createRepo } from "./create-repo"; +import { deleteRepo } from "./delete-repo"; +import { downloadFile } from "./download-file"; +import { uploadFilesWithProgress } from "./upload-files-with-progress"; +import type { CommitOutput, CommitProgressEvent } from "./commit"; + +describe("uploadFilesWithProgress", () => { + for (const useXet of [false, true]) { + describe(`useXet: ${useXet}`, () => { + it("should upload files", async () => { + const repoName = `${TEST_USER}/TEST-${insecureRandomString()}`; + const repo = { type: "model", name: repoName } satisfies RepoId; + const lfsContent = "O123456789".repeat(100_000); + + try { + const result = await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + repo, + hubUrl: TEST_HUB_URL, + }); + + expect(result).toEqual({ + repoUrl: `${TEST_HUB_URL}/${repoName}`, + id: expect.any(String), + }); + + const it = uploadFilesWithProgress({ + accessToken: TEST_ACCESS_TOKEN, + repo, + files: [ + { content: new Blob(["file1"]), path: "file1" }, + new URL("https://huggingface.co/gpt2/raw/main/config.json"), + // Large file + { + content: new Blob([lfsContent]), + path: "test.lfs.txt", + }, + ], + useWebWorkers: { + minSize: 1_000, + }, + hubUrl: TEST_HUB_URL, + useXet, + }); + + let res: IteratorResult; + let progressEvents: CommitProgressEvent[] = []; + + do { + res = await it.next(); + if (!res.done) { + progressEvents.push(res.value); + } + } while (!res.done); + + // const intermediateHashingEvents = progressEvents.filter( + // (e) => e.event === "fileProgress" && e.type === "hashing" && e.progress !== 0 && e.progress !== 1 + // ); + // if (isFrontend) { + // assert(intermediateHashingEvents.length > 0); + // } + // const intermediateUploadEvents = progressEvents.filter( + // (e) => e.event === "fileProgress" && e.type === "uploading" && e.progress !== 0 && e.progress !== 1 + // ); + // if (isFrontend) { + // assert(intermediateUploadEvents.length > 0, "There should be at least one intermediate upload event"); + // } + progressEvents = progressEvents.filter( + (e, i) => + (e.event !== "fileProgress" || e.progress === 0 || e.progress === 1) && + (i === 0 || JSON.stringify(e) !== JSON.stringify(progressEvents[i - 1])), + ); + + assert.deepStrictEqual(progressEvents, [ + { + event: "phase", + phase: "preuploading", + }, + { + event: "phase", + phase: "uploadingLargeFiles", + }, + { + event: "fileProgress", + path: "test.lfs.txt", + progress: 0, + state: "hashing", + }, + { + event: "fileProgress", + path: "test.lfs.txt", + progress: 1, + state: "hashing", + }, + { + event: "fileProgress", + path: "test.lfs.txt", + progress: 0, + state: "uploading", + }, + { + event: "fileProgress", + path: "test.lfs.txt", + progress: 1, + state: "uploading", + }, + { + event: "phase", + phase: "committing", + }, + ]); + + let content = await downloadFile({ + repo, + path: "file1", + hubUrl: TEST_HUB_URL, + }); + + assert.strictEqual(await content?.text(), "file1"); + + content = await downloadFile({ + repo, + path: "config.json", + hubUrl: TEST_HUB_URL, + }); + + assert.strictEqual( + (await content?.text())?.trim(), + ` +{ + "activation_function": "gelu_new", + "architectures": [ + "GPT2LMHeadModel" + ], + "attn_pdrop": 0.1, + "bos_token_id": 50256, + "embd_pdrop": 0.1, + "eos_token_id": 50256, + "initializer_range": 0.02, + "layer_norm_epsilon": 1e-05, + "model_type": "gpt2", + "n_ctx": 1024, + "n_embd": 768, + "n_head": 12, + "n_layer": 12, + "n_positions": 1024, + "resid_pdrop": 0.1, + "summary_activation": null, + "summary_first_dropout": 0.1, + "summary_proj_to_labels": true, + "summary_type": "cls_index", + "summary_use_proj": true, + "task_specific_params": { + "text-generation": { + "do_sample": true, + "max_length": 50 + } + }, + "vocab_size": 50257 +} + `.trim(), + ); + } finally { + await deleteRepo({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + } + }); + }); + } +}); diff --git a/node_modules/@huggingface/hub/src/lib/upload-files-with-progress.ts b/node_modules/@huggingface/hub/src/lib/upload-files-with-progress.ts new file mode 100644 index 0000000000000000000000000000000000000000..364aabdb9ecf0418bdce4b70425155135c6b03ba --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/upload-files-with-progress.ts @@ -0,0 +1,159 @@ +import type { CredentialsParams } from "../types/public"; +import { typedInclude } from "../utils/typedInclude"; +import type { CommitOutput, CommitParams, CommitProgressEvent, ContentSource } from "./commit"; +import { commitIter } from "./commit"; + +const multipartUploadTracking = new WeakMap< + (progress: number) => void, + { + numParts: number; + partsProgress: Record; + } +>(); + +/** + * Uploads with progress + * + * Needs XMLHttpRequest to be available for progress events for uploads on models, datasets and spaces. + * Set useWebWorkers to true in order to have progress events for hashing for models, datasets and spaces. + */ +export async function* uploadFilesWithProgress( + params: { + repo: CommitParams["repo"]; + files: Array; + commitTitle?: CommitParams["title"]; + commitDescription?: CommitParams["description"]; + hubUrl?: CommitParams["hubUrl"]; + branch?: CommitParams["branch"]; + isPullRequest?: CommitParams["isPullRequest"]; + parentCommit?: CommitParams["parentCommit"]; + abortSignal?: CommitParams["abortSignal"]; + maxFolderDepth?: CommitParams["maxFolderDepth"]; + useXet?: CommitParams["useXet"]; + /** + * Set this to true in order to have progress events for hashing + */ + useWebWorkers?: CommitParams["useWebWorkers"]; + } & Partial, +): AsyncGenerator { + return yield* commitIter({ + ...(params.accessToken ? { accessToken: params.accessToken } : { credentials: params.credentials }), + repo: params.repo, + operations: params.files.map((file) => ({ + operation: "addOrUpdate", + path: file instanceof URL ? (file.pathname.split("/").at(-1) ?? "file") : "path" in file ? file.path : file.name, + content: "content" in file ? file.content : file, + })), + title: params.commitTitle ?? `Add ${params.files.length} files`, + description: params.commitDescription, + hubUrl: params.hubUrl, + branch: params.branch, + isPullRequest: params.isPullRequest, + parentCommit: params.parentCommit, + useWebWorkers: params.useWebWorkers, + abortSignal: params.abortSignal, + useXet: params.useXet, + fetch: async (input, init) => { + if (!init) { + return fetch(input); + } + + if ( + !typedInclude(["PUT", "POST"], init.method) || + !("progressHint" in init) || + !init.progressHint || + typeof XMLHttpRequest === "undefined" || + typeof input !== "string" || + (!(init.body instanceof ArrayBuffer) && + !(init.body instanceof Blob) && + !(init.body instanceof File) && + typeof init.body !== "string") + ) { + return fetch(input, init); + } + + const progressHint = init.progressHint as { + progressCallback: (progress: number) => void; + } & (Record | { part: number; numParts: number }); + const progressCallback = progressHint.progressCallback; + + const xhr = new XMLHttpRequest(); + + xhr.upload.addEventListener("progress", (event) => { + if (event.lengthComputable) { + if (progressHint.part !== undefined) { + let tracking = multipartUploadTracking.get(progressCallback); + if (!tracking) { + tracking = { numParts: progressHint.numParts, partsProgress: {} }; + multipartUploadTracking.set(progressCallback, tracking); + } + tracking.partsProgress[progressHint.part] = event.loaded / event.total; + let totalProgress = 0; + for (const partProgress of Object.values(tracking.partsProgress)) { + totalProgress += partProgress; + } + if (totalProgress === tracking.numParts) { + progressCallback(0.9999999999); + } else { + progressCallback(totalProgress / tracking.numParts); + } + } else { + if (event.loaded === event.total) { + progressCallback(0.9999999999); + } else { + progressCallback(event.loaded / event.total); + } + } + } + }); + + xhr.open(init.method, input, true); + + if (init.headers) { + const headers = new Headers(init.headers); + headers.forEach((value, key) => { + xhr.setRequestHeader(key, value); + }); + } + + init.signal?.throwIfAborted(); + xhr.send(init.body); + + return new Promise((resolve, reject) => { + xhr.addEventListener("load", () => { + resolve( + new Response(xhr.responseText, { + status: xhr.status, + statusText: xhr.statusText, + headers: Object.fromEntries( + xhr + .getAllResponseHeaders() + .trim() + .split("\n") + .map((header) => [ + header.slice(0, header.indexOf(":")), + header.slice(header.indexOf(":") + 1).trim(), + ]), + ), + }), + ); + }); + xhr.addEventListener("error", () => { + reject(new Error(xhr.statusText)); + }); + + if (init.signal) { + init.signal.addEventListener("abort", () => { + xhr.abort(); + + try { + init.signal?.throwIfAborted(); + } catch (err) { + reject(err); + } + }); + } + }); + }, + }); +} diff --git a/node_modules/@huggingface/hub/src/lib/upload-files.fs.spec.ts b/node_modules/@huggingface/hub/src/lib/upload-files.fs.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..6692c67d33d01d2f94e9a12ad7d863636a4b8853 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/upload-files.fs.spec.ts @@ -0,0 +1,72 @@ +import { assert, it, describe, expect } from "vitest"; + +import { TEST_ACCESS_TOKEN, TEST_HUB_URL, TEST_USER } from "../test/consts"; +import type { RepoId } from "../types/public"; +import { insecureRandomString } from "../utils/insecureRandomString"; +import { createRepo } from "./create-repo"; +import { deleteRepo } from "./delete-repo"; +import { downloadFile } from "./download-file"; +import { uploadFiles } from "./upload-files"; +import { mkdir } from "fs/promises"; +import { writeFile } from "fs/promises"; +import { pathToFileURL } from "url"; +import { tmpdir } from "os"; + +describe("uploadFiles", () => { + it("should upload local folder", async () => { + const tmpDir = tmpdir(); + + await mkdir(`${tmpDir}/test-folder/sub`, { recursive: true }); + + await writeFile(`${tmpDir}/test-folder/sub/file1.txt`, "file1"); + await writeFile(`${tmpDir}/test-folder/sub/file2.txt`, "file2"); + + await writeFile(`${tmpDir}/test-folder/file3.txt`, "file3"); + await writeFile(`${tmpDir}/test-folder/file4.txt`, "file4"); + + const repoName = `${TEST_USER}/TEST-${insecureRandomString()}`; + const repo = { type: "model", name: repoName } satisfies RepoId; + + try { + const result = await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + repo, + hubUrl: TEST_HUB_URL, + }); + + expect(result).toEqual({ + repoUrl: `${TEST_HUB_URL}/${repoName}`, + id: expect.any(String), + }); + + await uploadFiles({ + accessToken: TEST_ACCESS_TOKEN, + repo, + files: [pathToFileURL(`${tmpDir}/test-folder`)], + hubUrl: TEST_HUB_URL, + }); + + let content = await downloadFile({ + repo, + path: "test-folder/sub/file1.txt", + hubUrl: TEST_HUB_URL, + }); + + assert.strictEqual(await content?.text(), "file1"); + + content = await downloadFile({ + repo, + path: "test-folder/file3.txt", + hubUrl: TEST_HUB_URL, + }); + + assert.strictEqual(await content?.text(), `file3`); + } finally { + await deleteRepo({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + } + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/upload-files.spec.ts b/node_modules/@huggingface/hub/src/lib/upload-files.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..58cb24fe3476d295bd198e1299bcee8ecededa27 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/upload-files.spec.ts @@ -0,0 +1,96 @@ +import { assert, it, describe, expect } from "vitest"; + +import { TEST_ACCESS_TOKEN, TEST_HUB_URL, TEST_USER } from "../test/consts"; +import type { RepoId } from "../types/public"; +import { insecureRandomString } from "../utils/insecureRandomString"; +import { createRepo } from "./create-repo"; +import { deleteRepo } from "./delete-repo"; +import { downloadFile } from "./download-file"; +import { uploadFiles } from "./upload-files"; + +describe("uploadFiles", () => { + it("should upload files", async () => { + const repoName = `${TEST_USER}/TEST-${insecureRandomString()}`; + const repo = { type: "model", name: repoName } satisfies RepoId; + + try { + const result = await createRepo({ + accessToken: TEST_ACCESS_TOKEN, + repo, + hubUrl: TEST_HUB_URL, + }); + + expect(result).toEqual({ + repoUrl: `${TEST_HUB_URL}/${repoName}`, + id: expect.any(String), + }); + + await uploadFiles({ + accessToken: TEST_ACCESS_TOKEN, + repo, + files: [ + { content: new Blob(["file1"]), path: "file1" }, + new URL("https://huggingface.co/gpt2/raw/main/config.json"), + ], + hubUrl: TEST_HUB_URL, + }); + + let content = await downloadFile({ + repo, + path: "file1", + hubUrl: TEST_HUB_URL, + }); + + assert.strictEqual(await content?.text(), "file1"); + + content = await downloadFile({ + repo, + path: "config.json", + hubUrl: TEST_HUB_URL, + }); + + assert.strictEqual( + (await content?.text())?.trim(), + ` +{ + "activation_function": "gelu_new", + "architectures": [ + "GPT2LMHeadModel" + ], + "attn_pdrop": 0.1, + "bos_token_id": 50256, + "embd_pdrop": 0.1, + "eos_token_id": 50256, + "initializer_range": 0.02, + "layer_norm_epsilon": 1e-05, + "model_type": "gpt2", + "n_ctx": 1024, + "n_embd": 768, + "n_head": 12, + "n_layer": 12, + "n_positions": 1024, + "resid_pdrop": 0.1, + "summary_activation": null, + "summary_first_dropout": 0.1, + "summary_proj_to_labels": true, + "summary_type": "cls_index", + "summary_use_proj": true, + "task_specific_params": { + "text-generation": { + "do_sample": true, + "max_length": 50 + } + }, + "vocab_size": 50257 +} + `.trim(), + ); + } finally { + await deleteRepo({ + repo, + accessToken: TEST_ACCESS_TOKEN, + hubUrl: TEST_HUB_URL, + }); + } + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/upload-files.ts b/node_modules/@huggingface/hub/src/lib/upload-files.ts new file mode 100644 index 0000000000000000000000000000000000000000..f400cf298a14d4f9ebb435056d1d18300d020e51 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/upload-files.ts @@ -0,0 +1,41 @@ +import type { CredentialsParams } from "../types/public"; +import type { CommitOutput, CommitParams, ContentSource } from "./commit"; +import { commit } from "./commit"; + +export function uploadFiles( + params: { + repo: CommitParams["repo"]; + files: Array; + commitTitle?: CommitParams["title"]; + commitDescription?: CommitParams["description"]; + hubUrl?: CommitParams["hubUrl"]; + branch?: CommitParams["branch"]; + isPullRequest?: CommitParams["isPullRequest"]; + parentCommit?: CommitParams["parentCommit"]; + fetch?: CommitParams["fetch"]; + useWebWorkers?: CommitParams["useWebWorkers"]; + maxFolderDepth?: CommitParams["maxFolderDepth"]; + abortSignal?: CommitParams["abortSignal"]; + useXet?: CommitParams["useXet"]; + } & Partial, +): Promise { + return commit({ + ...(params.accessToken ? { accessToken: params.accessToken } : { credentials: params.credentials }), + repo: params.repo, + operations: params.files.map((file) => ({ + operation: "addOrUpdate", + path: file instanceof URL ? (file.pathname.split("/").at(-1) ?? "file") : "path" in file ? file.path : file.name, + content: "content" in file ? file.content : file, + })), + title: params.commitTitle ?? `Add ${params.files.length} files`, + description: params.commitDescription, + hubUrl: params.hubUrl, + branch: params.branch, + isPullRequest: params.isPullRequest, + parentCommit: params.parentCommit, + fetch: params.fetch, + useWebWorkers: params.useWebWorkers, + abortSignal: params.abortSignal, + useXet: params.useXet, + }); +} diff --git a/node_modules/@huggingface/hub/src/lib/who-am-i.spec.ts b/node_modules/@huggingface/hub/src/lib/who-am-i.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..9996727293ae4b5ca656d8fb949d05c64a7fd3c4 --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/who-am-i.spec.ts @@ -0,0 +1,36 @@ +import { assert, it, describe } from "vitest"; +import { TEST_ACCESS_TOKEN, TEST_HUB_URL } from "../test/consts"; +import { whoAmI } from "./who-am-i"; + +describe("whoAmI", () => { + it("should fetch identity info", async () => { + const info = await whoAmI({ accessToken: TEST_ACCESS_TOKEN, hubUrl: TEST_HUB_URL }); + + if (info.auth.accessToken?.createdAt instanceof Date) { + info.auth.accessToken.createdAt = new Date(0); + } + + assert.deepStrictEqual(info, { + type: "user", + id: "62f264b9f3c90f4b6514a269", + name: "hub.js", + fullname: "@huggingface/hub CI bot", + email: "eliott@huggingface.co", + emailVerified: true, + canPay: false, + isPro: false, + periodEnd: null, + avatarUrl: "/avatars/934b830e9fdaa879487852f79eef7165.svg", + billingMode: "postpaid", + orgs: [], + auth: { + type: "access_token", + accessToken: { + createdAt: new Date(0), + displayName: "ci-hub.js", + role: "write", + }, + }, + }); + }); +}); diff --git a/node_modules/@huggingface/hub/src/lib/who-am-i.ts b/node_modules/@huggingface/hub/src/lib/who-am-i.ts new file mode 100644 index 0000000000000000000000000000000000000000..1c50650bc957c834d1efa5973e17472e4037a4bd --- /dev/null +++ b/node_modules/@huggingface/hub/src/lib/who-am-i.ts @@ -0,0 +1,92 @@ +import { HUB_URL } from "../consts"; +import { createApiError } from "../error"; +import type { ApiWhoAmIReponse } from "../types/api/api-who-am-i"; +import type { AccessTokenRole, AuthType, CredentialsParams } from "../types/public"; +import { checkCredentials } from "../utils/checkCredentials"; + +export interface WhoAmIUser { + /** Unique ID persistent across renames */ + id: string; + type: "user"; + email: string; + emailVerified: boolean; + isPro: boolean; + orgs: WhoAmIOrg[]; + name: string; + fullname: string; + canPay: boolean; + avatarUrl: string; + /** + * Unix timestamp in seconds + */ + periodEnd: number | null; + billingMode: "postpaid" | "prepaid"; +} + +export interface WhoAmIOrg { + /** Unique ID persistent across renames */ + id: string; + type: "org"; + name: string; + fullname: string; + email: string | null; + canPay: boolean; + avatarUrl: string; + /** + * Unix timestamp in seconds + */ + periodEnd: number | null; +} + +export interface WhoAmIApp { + id: string; + type: "app"; + name: string; + scope?: { + entities: string[]; + role: "admin" | "write" | "contributor" | "read"; + }; +} + +export type WhoAmI = WhoAmIApp | WhoAmIOrg | WhoAmIUser; +export interface AuthInfo { + type: AuthType; + accessToken?: { + displayName: string; + role: AccessTokenRole; + createdAt: Date; + }; + expiresAt?: Date; +} + +export async function whoAmI( + params: { + hubUrl?: string; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + } & CredentialsParams, +): Promise { + const accessToken = checkCredentials(params); + + const res = await (params.fetch ?? fetch)(`${params.hubUrl ?? HUB_URL}/api/whoami-v2`, { + headers: { + Authorization: `Bearer ${accessToken}`, + }, + }); + + if (!res.ok) { + throw await createApiError(res); + } + + const response: ApiWhoAmIReponse & { + auth: AuthInfo; + } = await res.json(); + + if (typeof response.auth.accessToken?.createdAt === "string") { + response.auth.accessToken.createdAt = new Date(response.auth.accessToken.createdAt); + } + + return response; +} diff --git a/node_modules/@huggingface/hub/src/test/consts.ts b/node_modules/@huggingface/hub/src/test/consts.ts new file mode 100644 index 0000000000000000000000000000000000000000..6b8b7983d62f140076851c03c901ab2da6c6bff3 --- /dev/null +++ b/node_modules/@huggingface/hub/src/test/consts.ts @@ -0,0 +1,4 @@ +export const TEST_HUB_URL = "https://hub-ci.huggingface.co"; +export const TEST_USER = "hub.js"; +export const TEST_ACCESS_TOKEN = "hf_hub.js"; +export const TEST_COOKIE = "huggingface-hub.js-cookie"; diff --git a/node_modules/@huggingface/hub/src/types/api/api-author.ts b/node_modules/@huggingface/hub/src/types/api/api-author.ts new file mode 100644 index 0000000000000000000000000000000000000000..b9e562a01ff9b2342a23e990318f6b5d53eddfaf --- /dev/null +++ b/node_modules/@huggingface/hub/src/types/api/api-author.ts @@ -0,0 +1,26 @@ +export type ApiAuthor = + | { + avatarUrl: string; + fullname: string; + name: string; + isHf: boolean; + isHfAdmin: boolean; + isMod: boolean; + followerCount?: number; + type: "org"; + plan?: string; + isUserFollowing?: boolean; + } + | { + avatarUrl: string; + fullname: string; + name: string; + isHf: boolean; + isHfAdmin: boolean; + isMod: boolean; + followerCount?: number; + type: "user"; + isPro: boolean; + _id: string; + isUserFollowing?: boolean; + }; diff --git a/node_modules/@huggingface/hub/src/types/api/api-collection.ts b/node_modules/@huggingface/hub/src/types/api/api-collection.ts new file mode 100644 index 0000000000000000000000000000000000000000..412e2d1470ab1a475c6c6e81f8b6fddababf895a --- /dev/null +++ b/node_modules/@huggingface/hub/src/types/api/api-collection.ts @@ -0,0 +1,328 @@ +import type { ApiAuthor } from "./api-author"; + +export interface ApiCollectionInfo { + slug: string; + title: string; + description?: string; + lastUpdated: string; + gating: + | true + | ( + | false + | { + mode: "auto"; + } + | { + mode: "manual"; + notifications: { + mode: "bulk" | "real-time"; + email?: string; + }; + } + ); + owner: ApiAuthor; + /** + * Note that it's limited to 4 items when the listing endpoint is used. + */ + items: ApiCollectionItem[]; + theme: "orange" | "blue" | "green" | "purple" | "pink" | "indigo"; + private: boolean; + upvotes: number; + isUpvotedByUser: boolean; +} + +interface ApiCollectionItemBase { + _id: string; + position: number; + note?: { + html: string; + text: string; + }; + gallery?: string[]; +} + +interface ApiCollectionItemModel extends ApiCollectionItemBase { + type: "model"; + author: string; + downloads: number; + id: string; + availableInferenceProviders: { + provider: + | "black-forest-labs" + | "cerebras" + | "cohere" + | "fal-ai" + | "featherless-ai" + | "fireworks-ai" + | "groq" + | "hf-inference" + | "hyperbolic" + | "nebius" + | "novita" + | "nscale" + | "openai" + | "ovhcloud" + | "replicate" + | "sambanova" + | "together"; + providerStatus: "live" | "staging" | "error"; + modelStatus: "live" | "staging" | "error"; + providerId: string; + task: + | "text-classification" + | "token-classification" + | "table-question-answering" + | "question-answering" + | "zero-shot-classification" + | "translation" + | "summarization" + | "feature-extraction" + | "text-generation" + | "text2text-generation" + | "fill-mask" + | "sentence-similarity" + | "text-to-speech" + | "text-to-audio" + | "automatic-speech-recognition" + | "audio-to-audio" + | "audio-classification" + | "audio-text-to-text" + | "voice-activity-detection" + | "depth-estimation" + | "image-classification" + | "object-detection" + | "image-segmentation" + | "text-to-image" + | "image-to-text" + | "image-to-image" + | "image-to-video" + | "unconditional-image-generation" + | "video-classification" + | "reinforcement-learning" + | "robotics" + | "tabular-classification" + | "tabular-regression" + | "tabular-to-text" + | "table-to-text" + | "multiple-choice" + | "text-ranking" + | "text-retrieval" + | "time-series-forecasting" + | "text-to-video" + | "image-text-to-text" + | "visual-question-answering" + | "document-question-answering" + | "zero-shot-image-classification" + | "graph-ml" + | "mask-generation" + | "zero-shot-object-detection" + | "text-to-3d" + | "image-to-3d" + | "image-feature-extraction" + | "video-text-to-text" + | "keypoint-detection" + | "visual-document-retrieval" + | "any-to-any" + | "video-to-video" + | "other" + | "conversational"; + adapterType?: "lora"; + adapterWeightsPath?: string; + }[]; + isLikedByUser: boolean; + lastModified: string; + likes: number; + pipeline_tag?: string; + private: boolean; + repoType: "model"; + gated: false | ("auto" | "manual"); + resourceGroup?: { + id: string; + name: string; + numUsers: number; + }; + numParameters?: number; + authorData?: ApiAuthor; + widgetOutputUrls?: string[]; +} + +interface ApiCollectionItemDataset extends ApiCollectionItemBase { + type: "dataset"; + author: string; + id: string; + isLikedByUser: boolean; + likes: number; + datasetsServerInfo?: { + viewer: "preview" | "viewer-partial" | "viewer"; + numRows: number | null; + libraries: ( + | "mlcroissant" + | "webdataset" + | "datasets" + | "pandas" + | "dask" + | "distilabel" + | "fiftyone" + | "argilla" + | "polars" + | "duckdb" + )[]; + formats: ("json" | "csv" | "parquet" | "imagefolder" | "audiofolder" | "webdataset" | "text" | "arrow")[]; + modalities: ("3d" | "audio" | "document" | "geospatial" | "image" | "tabular" | "text" | "timeseries" | "video")[]; + }; + private: boolean; + repoType: "dataset"; + downloads: number; + gated: false | ("auto" | "manual"); + lastModified: string; + resourceGroup?: { + id: string; + name: string; + numUsers: number; + }; +} + +interface ApiCollectionItemSpace extends ApiCollectionItemBase { + type: "space"; + author: string; + colorFrom: string; + colorTo: string; + createdAt: string; + emoji: string; + id: string; + isLikedByUser: boolean; + lastModified: string; + likes: number; + pinned: boolean; + private: boolean; + featured: boolean; + repoType: "space"; + title: string; + sdk?: "gradio" | "docker" | "static" | "streamlit"; + runtime: { + stage: + | "NO_APP_FILE" + | "CONFIG_ERROR" + | "BUILDING" + | "BUILD_ERROR" + | "APP_STARTING" + | "RUNNING" + | "RUNNING_BUILDING" + | "RUNNING_APP_STARTING" + | "RUNTIME_ERROR" + | "DELETING" + | "STOPPED" + | "PAUSED" + | "SLEEPING"; + hardware: { + current: + | ( + | "cpu-basic" + | "cpu-upgrade" + | "cpu-performance" + | "cpu-xl" + | "zero-a10g" + | "t4-small" + | "t4-medium" + | "l4x1" + | "l4x4" + | "l40sx1" + | "l40sx4" + | "l40sx8" + | "a10g-small" + | "a10g-large" + | "a10g-largex2" + | "a10g-largex4" + | "a100-large" + | "h100" + | "h100x8" + ) + | null; + requested: + | ( + | "cpu-basic" + | "cpu-upgrade" + | "cpu-performance" + | "cpu-xl" + | "zero-a10g" + | "t4-small" + | "t4-medium" + | "l4x1" + | "l4x4" + | "l40sx1" + | "l40sx4" + | "l40sx8" + | "a10g-small" + | "a10g-large" + | "a10g-largex2" + | "a10g-largex4" + | "a100-large" + | "h100" + | "h100x8" + ) + | null; + }; + storage: ("small" | "medium" | "large") | null; + errorMessage?: string; + gcTimeout?: number | null; + replicas: { + current?: number | null; + requested: number | "auto"; + }; + devMode?: boolean; + domains?: { + domain: string; + isCustom?: boolean | null; + stage: "READY" | "PENDING"; + }[]; + sha?: string; + }; + originSpace?: { + author: ApiAuthor; + name: string; + }; + ai_short_description?: string; + ai_category?: string; + trendingScore?: number; + resourceGroup?: { + id: string; + name: string; + numUsers: number; + }; + tags: string[]; + authorData?: ApiAuthor; + shortDescription?: string; + semanticRelevancyScore?: number; +} + +interface ApiCollectionItemPaper extends ApiCollectionItemBase { + type: "paper"; + id: string; + title: string; + upvotes: number; + publishedAt: string; + thumbnailUrl?: string; + isUpvotedByUser?: boolean; +} + +interface ApiCollectionItemCollection extends ApiCollectionItemBase { + type: "collection"; + slug: string; + lastUpdated: string; + description?: string; + owner: ApiAuthor; + title: string; + theme: "orange" | "blue" | "green" | "purple" | "pink" | "indigo"; + upvotes: number; + isUpvotedByUser: boolean; + id: string; + numberItems: number; + shareUrl: string; +} + +type ApiCollectionItem = + | ApiCollectionItemModel + | ApiCollectionItemDataset + | ApiCollectionItemSpace + | ApiCollectionItemPaper + | ApiCollectionItemCollection; diff --git a/node_modules/@huggingface/hub/src/types/api/api-commit.ts b/node_modules/@huggingface/hub/src/types/api/api-commit.ts new file mode 100644 index 0000000000000000000000000000000000000000..7ef67730da786d83814a279df8f86fb26f4dc4ce --- /dev/null +++ b/node_modules/@huggingface/hub/src/types/api/api-commit.ts @@ -0,0 +1,204 @@ +export interface ApiLfsBatchRequest { + /// github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md + operation: "download" | "upload"; + transfers?: Array; + /** + * Optional object describing the server ref that the objects belong to. Note: Added in v2.4. + * + * We use this object for QOL and to fail early for users when they're trying to push to the wrong reference. + * But it does nothing for security. + */ + ref?: { + name: string; + } | null; + objects: { + oid: string; + /** + * Integer byte size of the LFS object. Must be at least zero. + */ + size: number; + }[]; + /** + * The hash algorithm used to name Git LFS objects. Optional; defaults to sha256 if not specified. + * */ + hash_algo?: string; +} + +export interface ApiLfsBatchResponse { + transfer?: ApiLfsResponseTransfer; + objects: ApiLfsResponseObject[]; +} + +export type ApiLfsResponseTransfer = "basic" | "multipart" | "xet"; + +export interface ApiLfsCompleteMultipartRequest { + oid: string; + parts: { etag: string; partNumber: number }[]; +} + +export interface ApiLfsResponseObject { + /** + * Optional boolean specifying whether the request + * for this specific object is authenticated. + * If omitted or false, Git LFS will attempt to find credentials for this URL. + */ + authenticated?: boolean; + oid: string; + /** + * Integer byte size of the LFS object. Must be at least zero. + */ + size: number; + /** + * Applicable actions depend on which `operation` is specified in the request. + * How these properties are interpreted depends on which transfer adapter + * the client will be using. + */ + actions?: { + /** + * Download operations MUST specify a download action, + * or an object error if the object cannot be downloaded for some reason + */ + download?: ApiLfsAction; + /** + * Upload operations can specify an upload and a verify action. + * The upload action describes how to upload the object. + */ + upload?: ApiLfsAction; + /** + * The LFS client will hit this URL after a successful upload. + * Servers can use this for extra verification, if needed. + */ + verify?: ApiLfsAction; + }; + /** + * If there are problems accessing individual objects, servers should continue + * to return a 200 status code, and provide per-object errors + */ + error?: { + code: number; + message: string; + }; +} + +export interface ApiLfsAction { + href: string; + /** + * Optional hash of String HTTP header key/value pairs to apply to the request + */ + header?: { [key: string]: string } & { chunk_size?: string }; + /** + * Whole number of seconds after local client time when transfer will expire. + * Preferred over `expires_at` if both are provided. + * Maximum of 2147483647, minimum of -2147483647. + */ + expires_in?: number; + /** + * String uppercase RFC 3339-formatted timestamp with second precision + * for when the given action expires (usually due to a temporary token). + */ + expires_at?: string; +} + +export interface ApiPreuploadRequest { + /** + * Optional, otherwise takes the existing content of `.gitattributes` for the revision. + * + * Provide this parameter if you plan to modify `.gitattributes` yourself at the same + * time as uploading LFS files. + * + * Note that this is not needed if you solely rely on automatic LFS detection from HF: the commit endpoint + * will automatically edit the `.gitattributes` file to track the files passed to its `lfsFiles` param. + */ + gitAttributes?: string; + files: Array<{ + /** + * Path of the LFS file + */ + path: string; + /** + * Full size of the LFS file + */ + size: number; + /** + * Base64-encoded sample of the first 512 bytes of the file + */ + sample: string; + }>; +} +export interface ApiBucketBatchResponse { + /** True if all files were successfully added */ + success: boolean; + /** Total number of operations attempted */ + processed: number; + /** Number of successful operations */ + succeeded: number; + /** List of failed operations */ + failed: Array<{ + path: string; + error: string; + }>; +} + +export interface ApiPreuploadResponse { + files: Array<{ + path: string; + uploadMode: "lfs" | "regular"; + }>; +} + +export interface ApiCommitHeader { + summary: string; + description?: string; + /** + * Parent commit. Optional + * + * - When opening a PR: will use parentCommit as the parent commit + * - When committing on a branch: Will make sure that there were no intermediate commits + */ + parentCommit?: string; +} + +export interface ApiCommitDeletedEntry { + path: string; +} + +export interface ApiCommitLfsFile { + path: string; + oldPath?: string; + /** Required if {@link oldPath} is not set */ + algo?: "sha256"; + /** Required if {@link oldPath} is not set */ + oid?: string; + size?: number; +} + +export interface ApiCommitFile { + /** Required if {@link oldPath} is not set */ + content?: string; + path: string; + oldPath?: string; + encoding?: "utf-8" | "base64"; +} + +export type ApiCommitOperation = + | { + key: "file"; + value: ApiCommitFile; + } + | { + key: "lfsFile"; + value: ApiCommitLfsFile; + } + | { + key: "deletedFile"; + value: ApiCommitDeletedEntry; + }; + +export interface ApiCommitData { + id: string; + title: string; + message: string; + authors: Array<{ user: string; avatar: string }>; + date: string; + formatted?: string; +} diff --git a/node_modules/@huggingface/hub/src/types/api/api-create-collection.ts b/node_modules/@huggingface/hub/src/types/api/api-create-collection.ts new file mode 100644 index 0000000000000000000000000000000000000000..9d246b7561b869a6f0f7ea506c25e1e159e93993 --- /dev/null +++ b/node_modules/@huggingface/hub/src/types/api/api-create-collection.ts @@ -0,0 +1,19 @@ +export interface ApiCreateCollectionPayload { + /** + * Title of the collection to create. + */ + title: string; + /** + * Namespace of the collection to create (username or org). + */ + namespace: string; + /** + * Description of the collection to create. + */ + description?: string; + /** + * Whether the collection should be private or not. Defaults to False (i.e. public collection). + * @default false + */ + private?: boolean; +} diff --git a/node_modules/@huggingface/hub/src/types/api/api-create-repo.ts b/node_modules/@huggingface/hub/src/types/api/api-create-repo.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf7f0495447199b55cdffadc2b9c1d6d5beb8f77 --- /dev/null +++ b/node_modules/@huggingface/hub/src/types/api/api-create-repo.ts @@ -0,0 +1,26 @@ +import type { SetRequired } from "../../vendor/type-fest/set-required"; +import type { RepoType, SpaceHardwareFlavor, SpaceSdk } from "../public"; +import type { ApiCommitFile } from "./api-commit"; + +export type ApiCreateRepoPayload = { + name: string; + canonical?: boolean; + license?: string; + resourceGroupId?: string; + template?: string; + organization?: string; + /** @default false */ + private?: boolean; + lfsmultipartthresh?: number; + files?: SetRequired[]; +} & ( + | { + type: Exclude; + } + | { + type: "space"; + hardware?: SpaceHardwareFlavor; + sdk: SpaceSdk; + sdkVersion?: string; + } +); diff --git a/node_modules/@huggingface/hub/src/types/api/api-dataset.ts b/node_modules/@huggingface/hub/src/types/api/api-dataset.ts new file mode 100644 index 0000000000000000000000000000000000000000..43b0978537d8855745fd668443b3fc102060b3e4 --- /dev/null +++ b/node_modules/@huggingface/hub/src/types/api/api-dataset.ts @@ -0,0 +1,89 @@ +import type { License } from "../public"; + +export interface ApiDatasetInfo { + _id: string; + id: string; + arxivIds?: string[]; + author?: string; + cardExists?: true; + cardError?: unknown; + cardData?: ApiDatasetMetadata; + contributors?: Array<{ user: string; _id: string }>; + disabled: boolean; + discussionsDisabled: boolean; + gated: false | "auto" | "manual"; + gitalyUid: string; + lastAuthor: { email: string; user?: string }; + lastModified: string; // date + likes: number; + likesRecent: number; + private: boolean; + updatedAt: string; // date + createdAt: string; // date + tags: string[]; + paperswithcode_id?: string; + sha: string; + files?: string[]; + citation?: string; + description?: string; + downloads: number; + downloadsAllTime: number; + previewable?: boolean; + doi?: { id: string; commit: string }; +} + +export interface ApiDatasetMetadata { + licenses?: undefined; + license?: License | License[]; + license_name?: string; + license_link?: "LICENSE" | "LICENSE.md" | string; + license_details?: string; + languages?: undefined; + language?: string | string[]; + language_bcp47?: string[]; + language_details?: string; + tags?: string[]; + task_categories?: string[]; + task_ids?: string[]; + config_names?: string[]; + configs?: { + config_name: string; + data_files?: + | string + | string[] + | { + split: string; + path: string | string[]; + }[]; + data_dir?: string; + }[]; + benchmark?: string; + paperswithcode_id?: string | null; + pretty_name?: string; + viewer?: boolean; + viewer_display_urls?: boolean; + thumbnail?: string | null; + description?: string | null; + annotations_creators?: string[]; + language_creators?: string[]; + multilinguality?: string[]; + size_categories?: string[]; + source_datasets?: string[]; + extra_gated_prompt?: string; + extra_gated_fields?: { + /** + * "text" | "checkbox" | "date_picker" | "country" | "ip_location" | { type: "text" | "checkbox" | "date_picker" | "country" | "ip_location" } | { type: "select", options: Array } Property + */ + [x: string]: + | "text" + | "checkbox" + | "date_picker" + | "country" + | "ip_location" + | { type: "text" | "checkbox" | "date_picker" | "country" | "ip_location" } + | { type: "select"; options: Array }; + }; + extra_gated_heading?: string; + extra_gated_description?: string; + extra_gated_button_content?: string; +} diff --git a/node_modules/@huggingface/hub/src/types/api/api-index-tree.ts b/node_modules/@huggingface/hub/src/types/api/api-index-tree.ts new file mode 100644 index 0000000000000000000000000000000000000000..a467218cf288dbbdcb90662e72736fcabfa0246a --- /dev/null +++ b/node_modules/@huggingface/hub/src/types/api/api-index-tree.ts @@ -0,0 +1,46 @@ +export interface ApiIndexTreeEntry { + type: "file" | "directory" | "unknown"; + size: number; + path: string; + oid: string; + lfs?: { + oid: string; + size: number; + /** Size of the raw pointer file, 100~200 bytes */ + pointerSize: number; + }; + lastCommit?: { + date: string; + id: string; + title: string; + }; + security?: ApiFileScanResult; +} + +export interface ApiFileScanResult { + /** namespaced by repo type (models/, datasets/, spaces/) */ + repositoryId: string; + blobId: string; + name: string; + safe: boolean; + avScan?: ApiAVScan; + pickleImportScan?: ApiPickleImportScan; +} + +interface ApiAVScan { + virusFound: boolean; + virusNames?: string[]; +} + +type ApiSafetyLevel = "innocuous" | "suspicious" | "dangerous"; + +interface ApiPickleImport { + module: string; + name: string; + safety: ApiSafetyLevel; +} + +interface ApiPickleImportScan { + highestSafetyLevel: ApiSafetyLevel; + imports: ApiPickleImport[]; +} diff --git a/node_modules/@huggingface/hub/src/types/api/api-jobs.ts b/node_modules/@huggingface/hub/src/types/api/api-jobs.ts new file mode 100644 index 0000000000000000000000000000000000000000..ba4da0dd74f00046cb75d3ab507a438f263ac068 --- /dev/null +++ b/node_modules/@huggingface/hub/src/types/api/api-jobs.ts @@ -0,0 +1,146 @@ +import type { SpaceHardwareFlavor } from "../public"; + +export interface ApiJobHardware { + name: string; + prettyName: string; + cpu: string; + ram: string; + accelerator: { + type: "gpu" | "neuron"; + model: string; + quantity: string; + vram: string; + manufacturer: "Nvidia" | "AWS"; + } | null; + unitCostMicroUSD: number; + unitCostUSD: number; + unitLabel: string; +} + +export type JobStatusStage = "DELETING" | "RUNNING" | "PAUSED" | "STOPPED" | "UPDATING" | "ERROR"; + +export interface ApiJobStatus { + stage: JobStatusStage; + message?: string | null; + failureCount: number; +} + +export interface ApiJobUser { + id: string; + name: string; + type?: "user" | "org"; + avatarUrl?: string; +} + +export interface ApiJob { + type: "job"; + id: string; + status: ApiJobStatus; + createdAt: string; + updatedAt?: string; + startedAt?: string | null; + finishedAt?: string | null; + createdBy?: { + id: string; + name: string; + }; + dockerImage?: string | null; + spaceId?: string | null; + command?: string[] | null; + arguments?: string[] | null; + environment?: Record | null; + flavor: SpaceHardwareFlavor; + arch?: "amd64" | "arm64" | null; + timeoutSeconds?: number | null; + attempts?: number; + owner?: ApiJobUser; + initiator?: ApiJobUser; + secrets?: string[]; + labels?: Record | null; +} + +export interface ApiScheduledJob { + id: string; + schedule: string; + suspend: boolean; + concurrency: boolean; + createdAt: string; + updatedAt: string; + jobSpec: { + dockerImage?: string | null; + spaceId?: string | null; + command?: string[] | null; + environment?: Record | null; + flavor: SpaceHardwareFlavor; + arch?: "amd64" | "arm64" | null; + timeoutSeconds?: number | null; + attempts?: number; + labels?: Record | null; + }; +} + +export interface CreateJobOptions { + /** + * The Docker image to run (e.g., "python:3.12" or "pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel") + */ + dockerImage?: string; + /** + * The Space ID to run (e.g., "username/space-name") + */ + spaceId?: string; + /** + * The command to run (array of strings) + */ + command?: string[]; + /** + * Additional arguments to pass to the command + */ + arguments?: string[]; + /** + * Environment variables to set + */ + environment?: Record; + /** + * Secrets to pass (will be encrypted server-side) + */ + secrets?: Record; + /** + * Hardware flavor to use + */ + flavor: SpaceHardwareFlavor; + /** + * Architecture (defaults to "amd64") + */ + arch?: "amd64" | "arm64"; + /** + * Timeout in seconds + */ + timeoutSeconds?: number | null; + /** + * Maximum number of attempts (defaults to 1) + */ + attempts?: number; + /** + * Labels to attach to the job (key-value pairs) + */ + labels?: Record; +} + +export interface CreateScheduledJobOptions { + /** + * The job specification + */ + jobSpec: Omit; + /** + * CRON schedule expression (e.g., "0 9 * * 1" for 9 AM every Monday) or shortcuts like "@hourly", "@daily" + */ + schedule: string; + /** + * Whether the scheduled job is suspended (paused) + */ + suspend?: boolean; + /** + * Whether multiple instances of this job can run concurrently + */ + concurrency?: boolean; +} diff --git a/node_modules/@huggingface/hub/src/types/api/api-model.ts b/node_modules/@huggingface/hub/src/types/api/api-model.ts new file mode 100644 index 0000000000000000000000000000000000000000..2cd5b819a5d340b065d1a095ec65d41fb75e7089 --- /dev/null +++ b/node_modules/@huggingface/hub/src/types/api/api-model.ts @@ -0,0 +1,282 @@ +import type { ModelLibraryKey, TransformersInfo, WidgetType } from "@huggingface/tasks"; +import type { License, PipelineType } from "../public"; + +export interface ApiModelInfo { + _id: string; + id: string; + arxivIds: string[]; + author?: string; + cardData?: ApiModelMetadata; + cardError: unknown; + cardExists?: true; + config: unknown; + contributors: Array<{ user: string; _id: string }>; + disabled: boolean; + discussionsDisabled: boolean; + doi?: { id: string; commit: string }; + downloads: number; + downloadsAllTime: number; + files: string[]; + gitalyUid: string; + inferenceProviderMapping?: ApiModelInferenceProviderMappingEntry[]; + lastAuthor: { email: string; user?: string }; + lastModified: string; // convert to date + library_name?: ModelLibraryKey; + likes: number; + likesRecent: number; + private: boolean; + gated: false | "auto" | "manual"; + sha: string; + spaces: string[]; + updatedAt: string; // convert to date + createdAt: string; // convert to date + pipeline_tag: PipelineType; + tags: string[]; + "model-index": unknown; + safetensors?: { + parameters: Record; + total: number; + }; + transformersInfo?: TransformersInfo; +} + +export interface ApiModelIndex { + name: string; + results: { + task: { + /** + * Example: automatic-speech-recognition +Use task id from https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/tasksData.ts + */ + type: string; + /** + * Example: Speech Recognition + */ + name?: string; + }; + /** + * This will switch to required at some point. +in any case, we need them to link to PWC + */ + dataset?: { + /** + * Example: common_voice. Use dataset id from https://hf.co/datasets + */ + type: string; + /** + * A pretty name for the dataset. Example: Common Voice zh-CN +Also encode config params into the name if relevant. + */ + name: string; + /** + * Optional. The name of the dataset configuration used in `load_dataset()` + */ + config?: string; + /** + * Optional. Example: test + */ + split?: string; + /** + * Optional. Example: 5503434ddd753f426f4b38109466949a1217c2bb + */ + revision?: string; + args?: + | string + | { + /** + * String Property + */ + [x: string]: string; + }; + }; + metrics: { + /** + * Example: wer. Use metric id from https://hf.co/metrics + */ + type: string; + /** + * Required. Example: 20.0 or "20.0 ± 1.2" + */ + value: unknown; + /** + * Example: Test WER + */ + name?: string; + /** + * Optional. The name of the metric configuration used in `load_metric()`. + */ + config?: string; + args?: + | string + | { + /** + * String Property + */ + [x: string]: string; + }; + /** + * [Automatically computed, do not set] Dynamically overridden by huggingface in API calls to indicate if it was verified by Hugging Face. + */ + verified?: boolean; + /** + * Generated by Hugging Face to prove the results are valid. + */ + verifyToken?: string; + }[]; + /** + * The source for this evaluation result. + */ + source?: { + /** + * Example: Open LLM Leaderboard + */ + name?: string; + /** + * Example: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard + */ + url: string; + }; + }[]; +} + +export interface ApiWidgetExampleFromModelcard { + example_title?: string; + group?: string; + text?: string; + src?: string; + table?: { + /** + * (string | number)[] Property + */ + [x: string]: (string | number)[]; + }; + structured_data?: { + /** + * (string | number)[] Property + */ + [x: string]: (string | number)[]; + }; + candidate_labels?: string; + messages?: { + role: "system" | "user" | "assistant"; + content: string; + }[]; + multi_class?: boolean; + source_sentence?: string; + sentences?: string[]; + parameters?: { + aggregation_strategy?: string; + top_k?: number; + top_p?: number; + temperature?: number; + max_new_tokens?: number; + do_sample?: boolean; + negative_prompt?: string; + guidance_scale?: number; + num_inference_steps?: number; + }; + output?: + | { + label: string; + score: number; + }[] + | { + answer: string; + score: number; + } + | { + text: string; + } + | { + url: string; + }; +} + +export interface ApiModelMetadata { + datasets?: string | string[]; + license?: License | License[]; + license_name?: string; + license_link?: "LICENSE" | "LICENSE.md" | string; + license_details?: string; + inference?: + | boolean + | { + parameters?: { + aggregation_strategy?: string; + top_k?: number; + top_p?: number; + temperature?: number; + max_new_tokens?: number; + do_sample?: boolean; + negative_prompt?: string; + guidance_scale?: number; + num_inference_steps?: number; + }; + }; + language?: string | string[]; + language_bcp47?: string[]; + language_details?: string; + tags?: string[]; + pipeline_tag?: string; + co2_eq_emissions?: + | number + | { + /** + * Emissions in grams of CO2 + */ + emissions: number; + /** + * source of the information, either directly from AutoTrain, code carbon or from a scientific article documenting the model + */ + source?: string; + /** + * pre-training or fine-tuning + */ + training_type?: string; + /** + * as granular as possible, for instance Quebec, Canada or Brooklyn, NY, USA + */ + geographical_location?: string; + /** + * how much compute and what kind, e.g. 8 v100 GPUs + */ + hardware_used?: string; + }; + library_name?: string; + thumbnail?: string | null; + description?: string | null; + mask_token?: string; + widget?: ApiWidgetExampleFromModelcard[]; + "model-index"?: ApiModelIndex[]; + finetuned_from?: string; + base_model?: string | string[]; + instance_prompt?: string | null; + extra_gated_prompt?: string; + extra_gated_fields?: { + /** + * "text" | "checkbox" | "date_picker" | "country" | "ip_location" | { type: "text" | "checkbox" | "date_picker" | "country" | "ip_location" } | { type: "select", options: Array } Property + */ + [x: string]: + | "text" + | "checkbox" + | "date_picker" + | "country" + | "ip_location" + | { type: "text" | "checkbox" | "date_picker" | "country" | "ip_location" } + | { type: "select"; options: Array }; + }; + extra_gated_heading?: string; + extra_gated_description?: string; + extra_gated_button_content?: string; +} + +export interface ApiModelInferenceProviderMappingEntry { + provider: string; // Provider name + hfModelId: string; // ID of the model on the Hugging Face Hub + providerId: string; // ID of the model on the provider's side + status: "live" | "staging"; + task: WidgetType; + adapter?: string; + adapterWeightsPath?: string; + type?: "single-file" | "tag-filter"; +} diff --git a/node_modules/@huggingface/hub/src/types/api/api-space.ts b/node_modules/@huggingface/hub/src/types/api/api-space.ts new file mode 100644 index 0000000000000000000000000000000000000000..151677f4b36aa268f6ec95340f838a58b4a0f0f5 --- /dev/null +++ b/node_modules/@huggingface/hub/src/types/api/api-space.ts @@ -0,0 +1,93 @@ +import type { License, SpaceRuntime, SpaceSdk } from "../public"; + +type Color = "red" | "yellow" | "green" | "blue" | "indigo" | "purple" | "pink" | "gray"; + +export interface ApiSpaceInfo { + _id: string; + id: string; + arxivIds?: string[]; + author: string; + cardExists?: true; + cardError?: unknown; + cardData?: unknown; + contributors?: Array<{ user: string; _id: string }>; + disabled: boolean; + discussionsDisabled: boolean; + duplicationDisabled: boolean; + gated: false | "auto" | "manual"; + gitalyUid: string; + lastAuthor: { email: string; user?: string }; + lastModified: string; // date + likes: number; + likesRecent: number; + private: boolean; + updatedAt: string; // date + createdAt: string; // date + tags: string[]; + sha: string; + subdomain: string; + title: string; + emoji: string; + colorFrom: Color; + colorTo: Color; + pinned: boolean; + siblings: Array<{ rfilename: string }>; + sdk?: SpaceSdk; + runtime?: SpaceRuntime; + models?: string[]; + datasets?: string[]; + originSpace?: { _id: string; authorId: string }; +} + +export interface ApiSpaceMetadata { + license?: License | License[]; + tags?: string[]; + title?: string; + colorFrom?: "red" | "yellow" | "green" | "blue" | "indigo" | "purple" | "pink" | "gray"; + colorTo?: "red" | "yellow" | "green" | "blue" | "indigo" | "purple" | "pink" | "gray"; + emoji?: string; + sdk?: "streamlit" | "gradio" | "docker" | "static"; + sdk_version?: string | string; + python_version?: string | string; + fullWidth?: boolean; + header?: "mini" | "default"; + app_file?: string; + app_port?: number; + base_path?: string; + models?: string[]; + datasets?: string[]; + pinned?: boolean; + metaTitle?: string; + description?: string; + thumbnail?: string; + /** + * If enabled, will associate an oauth app to the Space, adding variables and secrets to the Space's environment + */ + hf_oauth?: boolean; + /** + * The expiration of access tokens for your oauth app in minutes. max 30 days (43,200 minutes). Defaults to 8 hours (480 minutes) + */ + hf_oauth_expiration_minutes?: number; + /** + * OAuth scopes to request. By default you have access to the user's profile, you can request access to their repos or inference-api. + */ + hf_oauth_scopes?: ("email" | "read-repos" | "write-repos" | "manage-repos" | "inference-api")[]; + suggested_hardware?: + | "cpu-basic" + | "zero-a10g" + | "cpu-upgrade" + | "cpu-xl" + | "t4-small" + | "t4-medium" + | "a10g-small" + | "a10g-large" + | "a10g-largex2" + | "a10g-largex4" + | "a100-large"; + suggested_storage?: "small" | "medium" | "large"; + custom_headers?: { + "cross-origin-embedder-policy"?: "unsafe-none" | "require-corp" | "credentialless"; + "cross-origin-opener-policy"?: "same-origin" | "same-origin-allow-popups" | "unsafe-none"; + "cross-origin-resource-policy"?: "same-site" | "same-origin" | "cross-origin"; + }; +} diff --git a/node_modules/@huggingface/hub/src/types/api/api-who-am-i.ts b/node_modules/@huggingface/hub/src/types/api/api-who-am-i.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ece69e5a25d0b79ef5bd9c937a87c554f1c2156 --- /dev/null +++ b/node_modules/@huggingface/hub/src/types/api/api-who-am-i.ts @@ -0,0 +1,52 @@ +import type { AccessTokenRole, AuthType } from "../public"; + +interface ApiWhoAmIBase { + /** Unique ID persistent across renames */ + id: string; + type: "user" | "org" | "app"; + name: string; +} + +interface ApiWhoAmIEntityBase extends ApiWhoAmIBase { + fullname: string; + email: string | null; + canPay: boolean; + avatarUrl: string; + /** + * Unix timestamp in seconds + */ + periodEnd: number | null; +} + +interface ApiWhoAmIOrg extends ApiWhoAmIEntityBase { + type: "org"; +} + +interface ApiWhoAmIUser extends ApiWhoAmIEntityBase { + type: "user"; + email: string; + emailVerified: boolean; + isPro: boolean; + orgs: ApiWhoAmIOrg[]; + billingMode: "postpaid" | "prepaid"; +} + +interface ApiWhoAmIApp extends ApiWhoAmIBase { + type: "app"; + name: string; + scope?: { + entities: string[]; + role: AccessTokenRole; + }; +} + +export type ApiWhoAmIReponse = ApiWhoAmIUser | ApiWhoAmIOrg | ApiWhoAmIApp; + +export interface ApiWhoAmIAuthInfo { + type: AuthType; + accessToken?: { + displayName: string; + expiration?: string; + role: AccessTokenRole; + }; +} diff --git a/node_modules/@huggingface/hub/src/types/public.ts b/node_modules/@huggingface/hub/src/types/public.ts new file mode 100644 index 0000000000000000000000000000000000000000..632ccde940cc9ea9ea5a0fd85d3dab14d8af9bf7 --- /dev/null +++ b/node_modules/@huggingface/hub/src/types/public.ts @@ -0,0 +1,191 @@ +import type { PipelineType } from "@huggingface/tasks"; + +export type RepoType = "space" | "dataset" | "model" | "bucket"; + +export interface RepoId { + name: string; + type: RepoType; +} + +export type RepoFullName = string | `spaces/${string}` | `datasets/${string}` | `buckets/${string}`; + +export type RepoDesignation = RepoId | RepoFullName; + +/** Actually `hf_${string}`, but for convenience, using the string type */ +export type AccessToken = string; + +/** + * @deprecated Use `AccessToken` instead. Pass { accessToken: "hf_..." } instead of { credentials: { accessToken: "hf_..." } } + */ +export interface Credentials { + accessToken: AccessToken; +} + +export type CredentialsParams = + | { + accessToken?: undefined; + /** + * @deprecated Use `accessToken` instead + */ + credentials: Credentials; + } + | { + accessToken: AccessToken; + /** + * @deprecated Use `accessToken` instead + */ + credentials?: undefined; + }; + +export type SpaceHardwareFlavor = + | "cpu-basic" + | "cpu-upgrade" + | "cpu-performance" + | "cpu-xl" + | "sprx8" + | "zero-a10g" + | "inf2x6" + | "t4-small" + | "t4-medium" + | "l4x1" + | "l4x4" + | "l40sx1" + | "l40sx4" + | "l40sx8" + | "a10g-small" + | "a10g-large" + | "a10g-largex2" + | "a10g-largex4" + | "a100-large" + | "a100x4" + | "a100x8"; + +export type SpaceSdk = "streamlit" | "gradio" | "docker" | "static"; + +export type SpaceStage = + | "NO_APP_FILE" + | "CONFIG_ERROR" + | "BUILDING" + | "BUILD_ERROR" + | "RUNNING" + | "RUNNING_BUILDING" + | "RUNTIME_ERROR" + | "DELETING" + | "PAUSED" + | "SLEEPING"; + +export type AccessTokenRole = "admin" | "write" | "contributor" | "read"; + +export type AuthType = "access_token" | "app_token" | "app_token_as_user"; + +export type { PipelineType }; + +export interface SpaceRuntime { + stage: SpaceStage; + sdk?: SpaceSdk; + sdkVersion?: string; + errorMessage?: string; + hardware?: { + current: SpaceHardwareFlavor | null; + currentPrettyName?: string; + requested: SpaceHardwareFlavor | null; + requestedPrettyName?: string; + }; + /** when calling /spaces, those props are only fetched if ?full=true */ + resources?: SpaceResourceConfig; + /** in seconds */ + gcTimeout?: number | null; +} + +export interface SpaceResourceRequirement { + cpu?: string; + memory?: string; + gpu?: string; + gpuModel?: string; + ephemeral?: string; +} + +export interface SpaceResourceConfig { + requests: SpaceResourceRequirement; + limits: SpaceResourceRequirement; + replicas?: number; + throttled?: boolean; + is_custom?: boolean; +} + +export type License = + | "apache-2.0" + | "mit" + | "openrail" + | "bigscience-openrail-m" + | "creativeml-openrail-m" + | "bigscience-bloom-rail-1.0" + | "bigcode-openrail-m" + | "afl-3.0" + | "artistic-2.0" + | "bsl-1.0" + | "bsd" + | "bsd-2-clause" + | "bsd-3-clause" + | "bsd-3-clause-clear" + | "c-uda" + | "cc" + | "cc0-1.0" + | "cc-by-2.0" + | "cc-by-2.5" + | "cc-by-3.0" + | "cc-by-4.0" + | "cc-by-sa-3.0" + | "cc-by-sa-4.0" + | "cc-by-nc-2.0" + | "cc-by-nc-3.0" + | "cc-by-nc-4.0" + | "cc-by-nd-4.0" + | "cc-by-nc-nd-3.0" + | "cc-by-nc-nd-4.0" + | "cc-by-nc-sa-2.0" + | "cc-by-nc-sa-3.0" + | "cc-by-nc-sa-4.0" + | "cdla-sharing-1.0" + | "cdla-permissive-1.0" + | "cdla-permissive-2.0" + | "wtfpl" + | "ecl-2.0" + | "epl-1.0" + | "epl-2.0" + | "etalab-2.0" + | "eupl-1.1" + | "agpl-3.0" + | "gfdl" + | "gpl" + | "gpl-2.0" + | "gpl-3.0" + | "lgpl" + | "lgpl-2.1" + | "lgpl-3.0" + | "isc" + | "lppl-1.3c" + | "ms-pl" + | "mpl-2.0" + | "odc-by" + | "odbl" + | "openrail++" + | "osl-3.0" + | "postgresql" + | "ofl-1.1" + | "ncsa" + | "unlicense" + | "zlib" + | "pddl" + | "lgpl-lr" + | "deepfloyd-if-license" + | "llama2" + | "llama3" + | "llama3.1" + | "llama3.2" + | "llama3.3" + | "gemma" + | "apple-ascl" + | "apple-amlr" + | "unknown" + | "other"; diff --git a/node_modules/@huggingface/hub/src/utils/ChunkCache.spec.ts b/node_modules/@huggingface/hub/src/utils/ChunkCache.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7901501e9479c81fc7c43d685a72eb41603ec11 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/ChunkCache.spec.ts @@ -0,0 +1,265 @@ +import { describe, it, expect } from "vitest"; +import { ChunkCache } from "./ChunkCache"; + +describe("ChunkCache", () => { + describe("basic operations", () => { + it("should create a cache with specified max size", () => { + const cache = new ChunkCache(5); + expect(cache.maxSize).toBe(5); + expect(cache.index).toBe(0); + }); + + it("should add and retrieve chunks", () => { + const cache = new ChunkCache(5); + + cache.addChunkToCache("hash1", 100, 10, null); + cache.addChunkToCache("hash2", 200, 20, null); + + const chunk1 = cache.getChunk("hash1", null); + const chunk2 = cache.getChunk("hash2", null); + + expect(chunk1).toEqual({ xorbIndex: 100, chunkIndex: 10 }); + expect(chunk2).toEqual({ xorbIndex: 200, chunkIndex: 20 }); + }); + + it("should return undefined for non-existent chunks", () => { + const cache = new ChunkCache(5); + + const chunk = cache.getChunk("nonexistent", null); + expect(chunk).toBeUndefined(); + }); + + it("should remove chunks from cache", () => { + const cache = new ChunkCache(5); + + cache.addChunkToCache("hash1", 100, 10, null); + expect(cache.getChunk("hash1", null)).toBeDefined(); + + cache.removeChunkFromCache("hash1"); + expect(cache.getChunk("hash1", null)).toBeUndefined(); + }); + }); + + describe("duplicate handling", () => { + it("should ignore duplicate hashes", () => { + const cache = new ChunkCache(5); + + // Add initial chunk + cache.addChunkToCache("hash1", 100, 10, null); + expect(cache.index).toBe(1); + expect(cache.map.size).toBe(1); + + // Try to add same hash again - should be ignored + cache.addChunkToCache("hash1", 999, 99, null); + expect(cache.index).toBe(1); // index should not increment + expect(cache.map.size).toBe(1); // map size should not increase + + // Original data should be preserved + const chunk = cache.getChunk("hash1", null); + expect(chunk).toEqual({ xorbIndex: 100, chunkIndex: 10 }); + }); + + it("should maintain consistency when adding duplicates mixed with new hashes", () => { + const cache = new ChunkCache(5); + + // Add some chunks + cache.addChunkToCache("hash1", 100, 10, null); + cache.addChunkToCache("hash2", 200, 20, null); + cache.addChunkToCache("hash3", 300, 30, null); + + expect(cache.index).toBe(3); + expect(cache.map.size).toBe(3); + + // Try to add duplicates + cache.addChunkToCache("hash1", 999, 99, null); // duplicate + cache.addChunkToCache("hash4", 400, 40, null); // new + cache.addChunkToCache("hash2", 888, 88, null); // duplicate + + expect(cache.index).toBe(4); // only incremented for hash4 + expect(cache.map.size).toBe(4); + + // Verify all chunks are accessible and have correct data + expect(cache.getChunk("hash1", null)).toEqual({ xorbIndex: 100, chunkIndex: 10 }); + expect(cache.getChunk("hash2", null)).toEqual({ xorbIndex: 200, chunkIndex: 20 }); + expect(cache.getChunk("hash3", null)).toEqual({ xorbIndex: 300, chunkIndex: 30 }); + expect(cache.getChunk("hash4", null)).toEqual({ xorbIndex: 400, chunkIndex: 40 }); + }); + }); + + describe("cache overflow and circular buffer behavior", () => { + it("should handle cache overflow correctly", () => { + const cache = new ChunkCache(3); // Small cache size + + // Fill the cache to capacity + cache.addChunkToCache("hash1", 100, 10, null); + cache.addChunkToCache("hash2", 200, 20, null); + cache.addChunkToCache("hash3", 300, 30, null); + + expect(cache.index).toBe(0); // wrapped around (3 % 3 = 0) + expect(cache.map.size).toBe(3); + + // All chunks should be accessible + expect(cache.getChunk("hash1", null)).toBeDefined(); + expect(cache.getChunk("hash2", null)).toBeDefined(); + expect(cache.getChunk("hash3", null)).toBeDefined(); + + // Add one more chunk - should evict the oldest (hash1) + cache.addChunkToCache("hash4", 400, 40, null); + + expect(cache.index).toBe(1); // wrapped around (4 % 3 = 1) + expect(cache.map.size).toBe(3); // size should remain the same + + // hash1 should be evicted, others should remain + expect(cache.getChunk("hash1", null)).toBeUndefined(); + expect(cache.getChunk("hash2", null)).toEqual({ xorbIndex: 200, chunkIndex: 20 }); + expect(cache.getChunk("hash3", null)).toEqual({ xorbIndex: 300, chunkIndex: 30 }); + expect(cache.getChunk("hash4", null)).toEqual({ xorbIndex: 400, chunkIndex: 40 }); + }); + + it("should continue evicting oldest entries as new ones are added", () => { + const cache = new ChunkCache(3); + + // Fill cache + cache.addChunkToCache("hash1", 100, 10, null); + cache.addChunkToCache("hash2", 200, 20, null); + cache.addChunkToCache("hash3", 300, 30, null); + + // Add more chunks to test multiple evictions + cache.addChunkToCache("hash4", 400, 40, null); // evicts hash1 + cache.addChunkToCache("hash5", 500, 50, null); // evicts hash2 + cache.addChunkToCache("hash6", 600, 60, null); // evicts hash3 + + expect(cache.map.size).toBe(3); + + // Only the last 3 should remain + expect(cache.getChunk("hash1", null)).toBeUndefined(); + expect(cache.getChunk("hash2", null)).toBeUndefined(); + expect(cache.getChunk("hash3", null)).toBeUndefined(); + expect(cache.getChunk("hash4", null)).toEqual({ xorbIndex: 400, chunkIndex: 40 }); + expect(cache.getChunk("hash5", null)).toEqual({ xorbIndex: 500, chunkIndex: 50 }); + expect(cache.getChunk("hash6", null)).toEqual({ xorbIndex: 600, chunkIndex: 60 }); + }); + + it("should handle removals during overflow correctly", () => { + const cache = new ChunkCache(3); + + // Fill cache + cache.addChunkToCache("hash1", 100, 10, null); + cache.addChunkToCache("hash2", 200, 20, null); + cache.addChunkToCache("hash3", 300, 30, null); + + // Remove middle element + cache.removeChunkFromCache("hash2"); + expect(cache.map.size).toBe(2); + + // Add new elements + cache.addChunkToCache("hash4", 400, 40, null); + cache.addChunkToCache("hash5", 500, 50, null); + + // The removal should not affect the eviction logic + expect(cache.getChunk("hash1", null)).toBeUndefined(); // evicted + expect(cache.getChunk("hash2", null)).toBeUndefined(); // removed + expect(cache.getChunk("hash3", null)).toEqual({ xorbIndex: 300, chunkIndex: 30 }); + expect(cache.getChunk("hash4", null)).toEqual({ xorbIndex: 400, chunkIndex: 40 }); + expect(cache.getChunk("hash5", null)).toEqual({ xorbIndex: 500, chunkIndex: 50 }); + }); + }); + + describe("consistency after operations", () => { + it("should maintain consistent state after mixed operations", () => { + const cache = new ChunkCache(4); + + // Add initial chunks + cache.addChunkToCache("a", 1, 10, null); + cache.addChunkToCache("b", 2, 20, null); + cache.addChunkToCache("c", 3, 30, null); + + // Mix of operations + cache.addChunkToCache("a", 999, 999, null); // duplicate (ignored) + cache.removeChunkFromCache("b"); // removal + cache.addChunkToCache("d", 4, 40, null); // new addition + cache.addChunkToCache("e", 5, 50, null); // new addition - this triggers overflow + cache.addChunkToCache("c", 888, 888, null); // duplicate (ignored) + + // Verify final state + // With cache size 4: a(0), b(1, removed), c(2), d(3), e(4 -> 0, wraps and evicts a) + expect(cache.getChunk("a", null)).toBeUndefined(); // evicted by e + expect(cache.getChunk("b", null)).toBeUndefined(); // removed + expect(cache.getChunk("c", null)).toEqual({ xorbIndex: 3, chunkIndex: 30 }); + expect(cache.getChunk("d", null)).toEqual({ xorbIndex: 4, chunkIndex: 40 }); + expect(cache.getChunk("e", null)).toEqual({ xorbIndex: 5, chunkIndex: 50 }); + + // Map size should be 3 (a evicted, b removed) + expect(cache.map.size).toBe(3); + }); + + it("should maintain consistency after cache overflow with mixed operations", () => { + const cache = new ChunkCache(3); + + // Fill cache + cache.addChunkToCache("first", 1, 1, null); + cache.addChunkToCache("second", 2, 2, null); + cache.addChunkToCache("third", 3, 3, null); + + // Cause overflow with duplicates and removals mixed in + cache.addChunkToCache("fourth", 4, 4, null); // evicts "first" + cache.addChunkToCache("second", 999, 999, null); // duplicate (ignored) + cache.removeChunkFromCache("third"); // removal + cache.addChunkToCache("fifth", 5, 5, null); // evicts "second" + + // Final state verification + expect(cache.getChunk("first", null)).toBeUndefined(); // evicted + expect(cache.getChunk("second", null)).toBeUndefined(); // evicted + expect(cache.getChunk("third", null)).toBeUndefined(); // removed + expect(cache.getChunk("fourth", null)).toEqual({ xorbIndex: 4, chunkIndex: 4 }); + expect(cache.getChunk("fifth", null)).toEqual({ xorbIndex: 5, chunkIndex: 5 }); + + cache.addChunkToCache("sixth", 6, 6, null); // new, takes "third" place + expect(cache.getChunk("sixth", null)).toEqual({ xorbIndex: 6, chunkIndex: 6 }); + expect(cache.getChunk("fourth", null)).toEqual({ xorbIndex: 4, chunkIndex: 4 }); + expect(cache.getChunk("fifth", null)).toEqual({ xorbIndex: 5, chunkIndex: 5 }); + + cache.addChunkToCache("seventh", 7, 7, null); // new, takes "fourth" place + expect(cache.getChunk("seventh", null)).toEqual({ xorbIndex: 7, chunkIndex: 7 }); + expect(cache.getChunk("fourth", null)).toBeUndefined(); // evicted + expect(cache.getChunk("fifth", null)).toEqual({ xorbIndex: 5, chunkIndex: 5 }); + + expect(cache.map.size).toBe(3); + }); + }); + + describe("negative xorbIndex handling", () => { + it("should handle negative xorbIndex values (remote xorbs)", () => { + const cache = new ChunkCache(5); + + cache.addChunkToCache("remote1", -1, 10, null); + cache.addChunkToCache("local1", 1, 20, null); + cache.addChunkToCache("remote2", -100, 30, null); + + expect(cache.getChunk("remote1", null)).toEqual({ xorbIndex: -1, chunkIndex: 10 }); + expect(cache.getChunk("local1", null)).toEqual({ xorbIndex: 1, chunkIndex: 20 }); + expect(cache.getChunk("remote2", null)).toEqual({ xorbIndex: -100, chunkIndex: 30 }); + }); + }); + + describe("edge cases", () => { + it("should handle cache with max size of 1", () => { + const cache = new ChunkCache(1); + + cache.addChunkToCache("hash1", 1, 1, null); + expect(cache.getChunk("hash1", null)).toBeDefined(); + + cache.addChunkToCache("hash2", 2, 2, null); + expect(cache.getChunk("hash1", null)).toBeUndefined(); // evicted + expect(cache.getChunk("hash2", null)).toEqual({ xorbIndex: 2, chunkIndex: 2 }); + }); + + it("should handle empty cache operations", () => { + const cache = new ChunkCache(5); + + expect(cache.getChunk("nonexistent", null)).toBeUndefined(); + cache.removeChunkFromCache("nonexistent"); // should not throw + expect(cache.map.size).toBe(0); + }); + }); +}); diff --git a/node_modules/@huggingface/hub/src/utils/ChunkCache.ts b/node_modules/@huggingface/hub/src/utils/ChunkCache.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb64defb06f77e1a9938c8215a91ac190858aeb2 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/ChunkCache.ts @@ -0,0 +1,99 @@ +const CHUNK_CACHE_INITIAL_SIZE = 10_000; +const CHUNK_CACHE_GROW_FACTOR = 1.5; +const CHUNK_CACHE_MAX_SIZE = 1_000_000; + +export class ChunkCache { + index = 0; + // Index >= 0 means local xorb, < 0 means remote xorb + xorbIndices: Int32Array; + // Max 8K chunks per xorb, less than 64K uint16_t + chunkIndices: Uint16Array; + map = new Map(); // hash -> chunkCacheIndex. Less overhead that way, empty object is 60+B and empty array is 40+B + hmacs = new Set(); // todo : remove old hmacs + maxSize: number; + + constructor(maxSize: number = CHUNK_CACHE_MAX_SIZE) { + if (maxSize < 1) { + throw new Error("maxSize must be at least 1"); + } + this.maxSize = maxSize; + this.xorbIndices = new Int32Array(Math.min(CHUNK_CACHE_INITIAL_SIZE, maxSize)); + this.chunkIndices = new Uint16Array(Math.min(CHUNK_CACHE_INITIAL_SIZE, maxSize)); + } + + addChunkToCache(hash: string, xorbIndex: number, chunkIndex: number, hmac: string | null): void { + if (this.map.has(hash)) { + // Happens when we receive an existing chunk from remote dedup info (eg duplicate chunk in shard? Or shards with same hmac key + // sharing chunks/xorbs) + + // processing this chunk again would desync the cache, as `this.map.size` would not increase, as opposed to `this.index` + + // We could readd/remove it to "refresh it" + return; + } + if (this.map.values().next().value === this.index) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + this.map.delete(this.map.keys().next().value!); + } + this.map.set(hash, this.index); + if (hmac !== null) { + this.hmacs.add(hmac); + } + + if (this.index >= this.xorbIndices.length) { + // todo: switch to resize() with modern browsers + const oldXorbIndices = this.xorbIndices; + const oldChunkIndices = this.chunkIndices; + this.xorbIndices = new Int32Array(Math.min(this.xorbIndices.length * CHUNK_CACHE_GROW_FACTOR, this.maxSize)); + this.chunkIndices = new Uint16Array(Math.min(this.chunkIndices.length * CHUNK_CACHE_GROW_FACTOR, this.maxSize)); + this.xorbIndices.set(oldXorbIndices); + this.chunkIndices.set(oldChunkIndices); + } + + this.xorbIndices[this.index] = xorbIndex; + this.chunkIndices[this.index] = chunkIndex; + this.index = (this.index + 1) % this.maxSize; + } + + getChunk( + hash: string, + /** + * Set to null if you only want to check against locally created chunks, or the hash is already a hmac + */ + hmacFunction: ((hash: string, key: string) => string) | null, + ): + | { + xorbIndex: number; + chunkIndex: number; + } + | undefined { + let index = this.map.get(hash); + if (index === undefined && hmacFunction !== null) { + for (const hmac of this.hmacs) { + index = this.map.get(hmacFunction(hash, hmac)); + if (index !== undefined) { + break; + } + } + } + if (index === undefined) { + return undefined; + } + return { + xorbIndex: this.xorbIndices[index], + chunkIndex: this.chunkIndices[index], + }; + } + + updateChunkIndex(hash: string, chunkIndex: number): void { + const index = this.map.get(hash); + if (index === undefined) { + throw new Error(`Chunk not found in cache: ${hash}`); + } + this.chunkIndices[index] = chunkIndex; + } + + removeChunkFromCache(hash: string): void { + this.map.delete(hash); + } +} diff --git a/node_modules/@huggingface/hub/src/utils/FileBlob.spec.ts b/node_modules/@huggingface/hub/src/utils/FileBlob.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..2ed51d8e38e817bc69d0924e3f4b47885e85c5d9 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/FileBlob.spec.ts @@ -0,0 +1,45 @@ +import { open, stat } from "node:fs/promises"; +import { TextDecoder } from "node:util"; +import { describe, expect, it } from "vitest"; +import { FileBlob } from "./FileBlob"; + +describe("FileBlob", () => { + it("should create a FileBlob with a slice on the entire file", async () => { + const file = await open("package.json", "r"); + const { size } = await stat("package.json"); + + const fileBlob = await FileBlob.create("package.json"); + + expect(fileBlob).toMatchObject({ + path: "package.json", + start: 0, + end: size, + }); + expect(fileBlob.size).toBe(size); + expect(fileBlob.type).toBe(""); + const text = await fileBlob.text(); + const expectedText = (await file.read(Buffer.alloc(size), 0, size)).buffer.toString("utf8"); + expect(text).toBe(expectedText); + const result = await fileBlob.stream().getReader().read(); + expect(new TextDecoder().decode(result.value)).toBe(expectedText); + }); + + it("should create a slice on the file", async () => { + const file = await open("package.json", "r"); + const fileBlob = await FileBlob.create("package.json"); + + const slice = fileBlob.slice(10, 20); + + expect(slice).toMatchObject({ + path: "package.json", + start: 10, + end: 20, + }); + expect(slice.size).toBe(10); + const sliceText = await slice.text(); + const expectedText = (await file.read(Buffer.alloc(10), 0, 10, 10)).buffer.toString("utf8"); + expect(sliceText).toBe(expectedText); + const result = await slice.stream().getReader().read(); + expect(new TextDecoder().decode(result.value)).toBe(expectedText); + }); +}); diff --git a/node_modules/@huggingface/hub/src/utils/FileBlob.ts b/node_modules/@huggingface/hub/src/utils/FileBlob.ts new file mode 100644 index 0000000000000000000000000000000000000000..504efcf6ed7ae89a5b4ef957072377ebb8a10045 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/FileBlob.ts @@ -0,0 +1,122 @@ +import { createReadStream } from "node:fs"; +import { open, stat } from "node:fs/promises"; +import { Readable } from "node:stream"; +import type { FileHandle } from "node:fs/promises"; +import { fileURLToPath } from "node:url"; + +/** + * @internal + * + * A FileBlob is a replacement for the Blob class that allows to lazy read files + * in order to preserve memory. + * + * It is a drop-in replacement for the Blob class, so you can use it as a Blob. + * + * The main difference is the instantiation, which is done asynchronously using the `FileBlob.create` method. + * + * @example + * const fileBlob = await FileBlob.create("path/to/package.json"); + * + * await fetch("https://aschen.tech", { method: "POST", body: fileBlob }); + */ +export class FileBlob extends Blob { + /** + * Creates a new FileBlob on the provided file. + * + * @param path Path to the file to be lazy readed + */ + static async create(path: string | URL): Promise { + path = path instanceof URL ? fileURLToPath(path) : path; + + const { size } = await stat(path); + + const fileBlob = new FileBlob(path, 0, size); + + return fileBlob; + } + + private path: string; + private start: number; + private end: number; + + private constructor(path: string, start: number, end: number) { + super(); + + this.path = path; + this.start = start; + this.end = end; + } + + /** + * Returns the size of the blob. + */ + override get size(): number { + return this.end - this.start; + } + + /** + * Returns a new instance of FileBlob that is a slice of the current one. + * + * The slice is inclusive of the start and exclusive of the end. + * + * The slice method does not supports negative start/end. + * + * @param start beginning of the slice + * @param end end of the slice + */ + override slice(start = 0, end = this.size): FileBlob { + if (start < 0 || end < 0) { + new TypeError("Unsupported negative start/end on FileBlob.slice"); + } + + const slice = new FileBlob(this.path, this.start + start, Math.min(this.start + end, this.end)); + + return slice; + } + + /** + * Read the part of the file delimited by the FileBlob and returns it as an ArrayBuffer. + */ + override async arrayBuffer(): Promise { + const slice = await this.execute((file) => file.read(Buffer.alloc(this.size), 0, this.size, this.start)); + + return slice.buffer; + } + + /** + * Read the part of the file delimited by the FileBlob and returns it as a string. + */ + override async text(): Promise { + const buffer = (await this.arrayBuffer()) as Buffer; + + return buffer.toString("utf8"); + } + + /** + * Returns a stream around the part of the file delimited by the FileBlob. + */ + override stream(): ReturnType { + if (this.start === this.end) { + return new Blob([]).stream(); + } + + return Readable.toWeb(createReadStream(this.path, { start: this.start, end: this.end - 1 })) as ReturnType< + Blob["stream"] + >; + } + + /** + * We are opening and closing the file for each action to prevent file descriptor leaks. + * + * It is an intended choice of developer experience over performances. + */ + private async execute(action: (file: FileHandle) => Promise) { + const file = await open(this.path, "r"); + + try { + return await action(file); + } finally { + await file.close(); + } + } +} diff --git a/node_modules/@huggingface/hub/src/utils/RangeList.spec.ts b/node_modules/@huggingface/hub/src/utils/RangeList.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..e05f85a8fa14b41b2c4549738dd9b8d67e5b30f1 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/RangeList.spec.ts @@ -0,0 +1,96 @@ +import { describe, it, expect } from "vitest"; +import { RangeList } from "./RangeList"; + +describe("RangeList", () => { + it("should add a single range", () => { + const rangeList = new RangeList(); + rangeList.add(1, 100); + + const ranges = rangeList.getAllRanges(); + expect(ranges).toHaveLength(1); + expect(ranges[0]).toEqual({ + start: 1, + end: 100, + refCount: 1, + data: null, + }); + }); + + it("should handle overlapping ranges", () => { + const rangeList = new RangeList(); + rangeList.add(1, 100); + rangeList.add(30, 50); + + const ranges = rangeList.getAllRanges(); + expect(ranges).toHaveLength(3); + expect(ranges).toEqual([ + { start: 1, end: 30, refCount: 1, data: null }, + { start: 30, end: 50, refCount: 2, data: null }, + { start: 50, end: 100, refCount: 1, data: null }, + ]); + }); + + it("should remove a range at existing boundaries", () => { + const rangeList = new RangeList(); + rangeList.add(1, 100); + rangeList.add(30, 50); + rangeList.remove(30, 50); + + const ranges = rangeList.getAllRanges(); + expect(ranges).toHaveLength(3); + expect(ranges).toEqual([ + { start: 1, end: 30, refCount: 1, data: null }, + { start: 30, end: 50, refCount: 1, data: null }, + { start: 50, end: 100, refCount: 1, data: null }, + ]); + }); + + it("should throw error when removing range at non-existing boundaries", () => { + const rangeList = new RangeList(); + rangeList.add(1, 100); + rangeList.add(30, 50); + + expect(() => rangeList.remove(2, 50)).toThrow("Range boundaries must match existing boundaries"); + }); + + it("should get ranges within boundaries", () => { + const rangeList = new RangeList(); + rangeList.add(1, 100); + rangeList.add(30, 50); + + const ranges = rangeList.getRanges(30, 100); + expect(ranges).toHaveLength(2); + expect(ranges).toEqual([ + { start: 30, end: 50, refCount: 2, data: null }, + { start: 50, end: 100, refCount: 1, data: null }, + ]); + }); + + it("should throw error when end is less than or equal to start", () => { + const rangeList = new RangeList(); + + expect(() => rangeList.add(100, 1)).toThrow("End must be greater than start"); + expect(() => rangeList.add(1, 1)).toThrow("End must be greater than start"); + expect(() => rangeList.remove(100, 1)).toThrow("End must be greater than start"); + expect(() => rangeList.remove(1, 1)).toThrow("End must be greater than start"); + expect(() => rangeList.getRanges(100, 1)).toThrow("End must be greater than start"); + expect(() => rangeList.getRanges(1, 1)).toThrow("End must be greater than start"); + }); + + it("should handle multiple overlapping ranges", () => { + const rangeList = new RangeList(); + rangeList.add(1, 100); + rangeList.add(30, 50); + rangeList.add(40, 60); + + const ranges = rangeList.getAllRanges(); + expect(ranges).toHaveLength(5); + expect(ranges).toEqual([ + { start: 1, end: 30, refCount: 1, data: null }, + { start: 30, end: 40, refCount: 2, data: null }, + { start: 40, end: 50, refCount: 3, data: null }, + { start: 50, end: 60, refCount: 2, data: null }, + { start: 60, end: 100, refCount: 1, data: null }, + ]); + }); +}); diff --git a/node_modules/@huggingface/hub/src/utils/RangeList.ts b/node_modules/@huggingface/hub/src/utils/RangeList.ts new file mode 100644 index 0000000000000000000000000000000000000000..9665500890ee1c34806168707a64e42af7ed8074 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/RangeList.ts @@ -0,0 +1,179 @@ +/** + * Code generated with this prompt by Cursor: + * + * I want to build a class to manage ranges + * + * I can add ranges to it with a start& an end (both integer, end > start). It should store those ranges efficiently. + * + * When several ranges overlap, eg [1, 100] and [30, 50], I want the class to split the range into non-overlapping ranges, and add a "ref counter" to the ranges. For example, [1, 30], [30, 50] * 2, [50, 100] + * + * I also want to be able to remove ranges, it will decrease the ref counter or remove the range altogether. I can only remove ranges at existing boundaries. For example, with the [1, 30], [30, 50] * 2, [50, 100] configuration + * + * - removing [1, 100] => the only range remaning is [30, 50] + * - removing [2, 50] => error, because "2' is not a boundary + * - removing [30, 50] => [1, 30], [30, 50], [50, 100] (do not "merge" the ranges back together) + * + * I want to be able to associate data to each range. And I want to be able to get the ranges inside boundaries. For example , with [1, 30], [30, 50] * 2, [50, 100] configuration + * + * - getting [30, 100] => I receive [30, 50] * 2, [50, 100], and I can get / modify the data associated to each range by accessing their data prop. Note the "*2" is just the ref counter, there is onlly one range object for the interval returned + * - getting [2, 50] => I get [30, 50] * 2 + * + * ---- + * + * Could optimize with binary search, but the ranges we want to handle are not that many. + */ +interface Range { + start: number; + end: number; + refCount: number; + data: T | null; +} + +export class RangeList { + private ranges: Range[] = []; + + /** + * Add a range to the list. If it overlaps with existing ranges, + * it will split them and increment reference counts accordingly. + */ + add(start: number, end: number): void { + if (end <= start) { + throw new TypeError("End must be greater than start"); + } + + // Find all ranges that overlap with the new range + const overlappingRanges: { index: number; range: Range }[] = []; + for (let i = 0; i < this.ranges.length; i++) { + const range = this.ranges[i]; + if (start < range.end && end > range.start) { + overlappingRanges.push({ index: i, range }); + } + if (range.data !== null) { + throw new Error("Overlapping range already has data"); + } + } + + if (overlappingRanges.length === 0) { + // No overlaps, just add the new range + this.ranges.push({ start, end, refCount: 1, data: null }); + this.ranges.sort((a, b) => a.start - b.start); + return; + } + + // Handle overlaps by splitting ranges + const newRanges: Range[] = []; + let currentPos = start; + + for (let i = 0; i < overlappingRanges.length; i++) { + const { range } = overlappingRanges[i]; + + // Add range before overlap if exists + if (currentPos < range.start) { + newRanges.push({ + start: currentPos, + end: range.start, + refCount: 1, + data: null, + }); + } else if (range.start < currentPos) { + newRanges.push({ + start: range.start, + end: currentPos, + refCount: range.refCount, + data: null, + }); + } + + // Add overlapping part with increased ref count + newRanges.push({ + start: Math.max(currentPos, range.start), + end: Math.min(end, range.end), + refCount: range.refCount + 1, + data: null, + }); + + // Add remaining part of existing range if exists + if (range.end > end) { + newRanges.push({ + start: end, + end: range.end, + refCount: range.refCount, + data: null, + }); + } + + currentPos = Math.max(currentPos, range.end); + } + + // Add remaining part after last overlap if exists + if (currentPos < end) { + newRanges.push({ + start: currentPos, + end, + refCount: 1, + data: null, + }); + } + + // Remove old overlapping ranges and insert new ones + const firstIndex = overlappingRanges[0].index; + const lastIndex = overlappingRanges[overlappingRanges.length - 1].index; + this.ranges.splice(firstIndex, lastIndex - firstIndex + 1, ...newRanges); + this.ranges.sort((a, b) => a.start - b.start); + } + + /** + * Remove a range from the list. The range must start and end at existing boundaries. + */ + remove(start: number, end: number): void { + if (end <= start) { + throw new TypeError("End must be greater than start"); + } + + // Find ranges that need to be modified + const affectedRanges: { index: number; range: Range }[] = []; + for (let i = 0; i < this.ranges.length; i++) { + const range = this.ranges[i]; + if (start < range.end && end > range.start) { + affectedRanges.push({ index: i, range }); + } + } + + if (affectedRanges.length === 0) { + throw new Error("No ranges found to remove"); + } + + // Verify boundaries match + if (start !== affectedRanges[0].range.start || end !== affectedRanges[affectedRanges.length - 1].range.end) { + throw new Error("Range boundaries must match existing boundaries"); + } + + // Todo: also check if there's a gap in the middle but it should not happen with our usage + + for (let i = 0; i < affectedRanges.length; i++) { + const { range } = affectedRanges[i]; + + range.refCount--; + } + + this.ranges = this.ranges.filter((range) => range.refCount > 0); + } + + /** + * Get all ranges within the specified boundaries. + */ + getRanges(start: number, end: number): Range[] { + if (end <= start) { + throw new TypeError("End must be greater than start"); + } + + return this.ranges.filter((range) => start < range.end && end > range.start); + } + + /** + * Get all ranges in the list + */ + getAllRanges(): Range[] { + return [...this.ranges]; + } +} diff --git a/node_modules/@huggingface/hub/src/utils/SplicedBlob.spec.ts b/node_modules/@huggingface/hub/src/utils/SplicedBlob.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf8520f15f2d9c7ae37a5df208b31c286da3b622 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/SplicedBlob.spec.ts @@ -0,0 +1,454 @@ +import { describe, expect, it, beforeEach } from "vitest"; +import { SplicedBlob } from "./SplicedBlob"; + +describe("SplicedBlob", () => { + let originalBlob: Blob; + let insertBlob: Blob; + let replaceBlob: Blob; + + beforeEach(() => { + // originalBlob: "0123456789" (10 chars) + originalBlob = new Blob(["0123456789"]); + // insertBlob: "ABC" (3 chars) - used in tests where we insert something into the blob + insertBlob = new Blob(["ABC"]); + // replaceBlob: "XY" (2 chars) - used in tests where part of the blob is replaced + replaceBlob = new Blob(["XY"]); + }); + + describe("create", () => { + it("should create a SplicedBlob with valid parameters", () => { + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + expect(splicedBlob).toBeInstanceOf(SplicedBlob); + }); + + it("should throw error for negative start", () => { + expect(() => SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: -1, end: 5 }])).toThrow( + "Invalid start/end positions for SplicedBlob", + ); + }); + + it("should throw error for negative end", () => { + expect(() => SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: -1 }])).toThrow( + "Invalid start/end positions for SplicedBlob", + ); + }); + + it("should throw error for start > original.size", () => { + expect(() => SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 15, end: 5 }])).toThrow( + "Invalid start/end positions for SplicedBlob", + ); + }); + + it("should throw error for end > original.size", () => { + expect(() => SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 15 }])).toThrow( + "Invalid start/end positions for SplicedBlob", + ); + }); + + it("should throw error for start > end", () => { + expect(() => SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 7, end: 5 }])).toThrow( + "Invalid start/end positions for SplicedBlob", + ); + }); + }); + + describe("size and type", () => { + it("should calculate size correctly for insertion", () => { + // Insert "ABC" at position 5: "01234ABC56789" = 13 chars + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + expect(splicedBlob.size).toBe(13); + }); + + it("should calculate size correctly for replacement", () => { + // Replace "345" with "XY": "012XY6789" = 9 chars + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: replaceBlob, start: 3, end: 6 }]); + expect(splicedBlob.size).toBe(9); + }); + + it("should return original blob type", () => { + const typedBlob = new Blob(["test"], { type: "text/plain" }); + const splicedBlob = SplicedBlob.create(typedBlob, [{ insert: insertBlob, start: 2, end: 2 }]); + expect(splicedBlob.type).toBe("text/plain"); + }); + }); + + describe("text method", () => { + it("should insert at beginning", async () => { + // Insert "ABC" at start: "ABC0123456789" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 0, end: 0 }]); + const text = await splicedBlob.text(); + expect(text).toBe("ABC0123456789"); + }); + + it("should insert at end", async () => { + // Insert "ABC" at end: "0123456789ABC" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 10, end: 10 }]); + const text = await splicedBlob.text(); + expect(text).toBe("0123456789ABC"); + }); + + it("should insert in middle", async () => { + // Insert "ABC" at position 5: "01234ABC56789" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const text = await splicedBlob.text(); + expect(text).toBe("01234ABC56789"); + }); + + it("should replace content", async () => { + // Replace "345" with "XY": "012XY6789" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: replaceBlob, start: 3, end: 6 }]); + const text = await splicedBlob.text(); + expect(text).toBe("012XY6789"); + }); + + it("should replace everything", async () => { + // Replace entire content with "ABC": "ABC" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 0, end: 10 }]); + const text = await splicedBlob.text(); + expect(text).toBe("ABC"); + }); + }); + + describe("slice method - basic cases", () => { + it("should return empty blob for start >= end", async () => { + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(5, 5); + expect(slice.size).toBe(0); + expect(await slice.text()).toBe(""); + }); + + it("should handle slice beyond size", async () => { + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(10, 20); + const text = await slice.text(); + expect(text).toBe("789"); // Only gets what's available + }); + + it("should throw error for negative start/end", () => { + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + expect(() => splicedBlob.slice(-1, 5)).toThrow("Unsupported negative start/end on SplicedBlob.slice"); + expect(() => splicedBlob.slice(0, -1)).toThrow("Unsupported negative start/end on SplicedBlob.slice"); + }); + }); + + describe("slice method - before segment only", () => { + it("should slice entirely in before segment", async () => { + // SplicedBlob: "01234ABC56789", slice(1, 4) = "123" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(1, 4); + const text = await slice.text(); + expect(text).toBe("123"); + }); + + it("should slice from start of before segment", async () => { + // SplicedBlob: "01234ABC56789", slice(0, 3) = "012" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(0, 3); + const text = await slice.text(); + expect(text).toBe("012"); + }); + + it("should slice to end of before segment", async () => { + // SplicedBlob: "01234ABC56789", slice(2, 5) = "234" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(2, 5); + const text = await slice.text(); + expect(text).toBe("234"); + }); + }); + + describe("slice method - insert segment only", () => { + it("should slice entirely in insert segment", async () => { + // SplicedBlob: "01234ABC56789", slice(6, 7) = "B" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(6, 7); + const text = await slice.text(); + expect(text).toBe("B"); + }); + + it("should slice entire insert segment", async () => { + // SplicedBlob: "01234ABC56789", slice(5, 8) = "ABC" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(5, 8); + const text = await slice.text(); + expect(text).toBe("ABC"); + }); + + it("should slice from start of insert segment", async () => { + // SplicedBlob: "01234ABC56789", slice(5, 7) = "AB" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(5, 7); + const text = await slice.text(); + expect(text).toBe("AB"); + }); + + it("should slice to end of insert segment", async () => { + // SplicedBlob: "01234ABC56789", slice(6, 8) = "BC" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(6, 8); + const text = await slice.text(); + expect(text).toBe("BC"); + }); + }); + + describe("slice method - after segment only", () => { + it("should slice entirely in after segment", async () => { + // SplicedBlob: "01234ABC56789", slice(9, 12) = "678" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(9, 12); + const text = await slice.text(); + expect(text).toBe("678"); + }); + + it("should slice from start of after segment", async () => { + // SplicedBlob: "01234ABC56789", slice(8, 11) = "567" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(8, 11); + const text = await slice.text(); + expect(text).toBe("567"); + }); + + it("should slice to end of after segment", async () => { + // SplicedBlob: "01234ABC56789", slice(10, 13) = "789" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(10, 13); + const text = await slice.text(); + expect(text).toBe("789"); + }); + }); + + describe("slice method - spanning before and insert", () => { + it("should slice spanning before and insert segments", async () => { + // SplicedBlob: "01234ABC56789", slice(3, 7) = "34AB" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(3, 7); + const text = await slice.text(); + expect(text).toBe("34AB"); + }); + + it("should slice from start spanning before and insert", async () => { + // SplicedBlob: "01234ABC56789", slice(0, 6) = "01234A" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(0, 6); + const text = await slice.text(); + expect(text).toBe("01234A"); + }); + + it("should slice to end of insert spanning before and insert", async () => { + // SplicedBlob: "01234ABC56789", slice(4, 8) = "4ABC" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(4, 8); + const text = await slice.text(); + expect(text).toBe("4ABC"); + }); + }); + + describe("slice method - spanning insert and after", () => { + it("should slice spanning insert and after segments", async () => { + // SplicedBlob: "01234ABC56789", slice(6, 10) = "BC56" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(6, 10); + const text = await slice.text(); + expect(text).toBe("BC56"); + }); + + it("should slice from start of insert to end", async () => { + // SplicedBlob: "01234ABC56789", slice(5, 13) = "ABC56789" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(5, 13); + const text = await slice.text(); + expect(text).toBe("ABC56789"); + }); + + it("should slice from middle of insert spanning to after", async () => { + // SplicedBlob: "01234ABC56789", slice(7, 11) = "C567" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(7, 11); + const text = await slice.text(); + expect(text).toBe("C567"); + }); + }); + + describe("slice method - spanning all three segments", () => { + it("should slice spanning all three segments", async () => { + // SplicedBlob: "01234ABC56789", slice(3, 10) = "34ABC56" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(3, 10); + const text = await slice.text(); + expect(text).toBe("34ABC56"); + }); + + it("should slice entire spliced blob", async () => { + // SplicedBlob: "01234ABC56789", slice(0, 13) = "01234ABC56789" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(0, 13); + const text = await slice.text(); + expect(text).toBe("01234ABC56789"); + }); + + it("should slice most of spliced blob", async () => { + // SplicedBlob: "01234ABC56789", slice(1, 12) = "1234ABC5678" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice = splicedBlob.slice(1, 12); + const text = await slice.text(); + expect(text).toBe("1234ABC5678"); + }); + }); + + describe("slice method - with replacement", () => { + it("should slice before replacement", async () => { + // Replace "345" with "XY": "012XY6789", slice(0, 3) = "012" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: replaceBlob, start: 3, end: 6 }]); + const slice = splicedBlob.slice(0, 3); + const text = await slice.text(); + expect(text).toBe("012"); + }); + + it("should slice replacement only", async () => { + // Replace "345" with "XY": "012XY6789", slice(3, 5) = "XY" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: replaceBlob, start: 3, end: 6 }]); + const slice = splicedBlob.slice(3, 5); + const text = await slice.text(); + expect(text).toBe("XY"); + }); + + it("should slice after replacement", async () => { + // Replace "345" with "XY": "012XY6789", slice(5, 9) = "6789" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: replaceBlob, start: 3, end: 6 }]); + const slice = splicedBlob.slice(5, 9); + const text = await slice.text(); + expect(text).toBe("6789"); + }); + + it("should slice spanning before and replacement", async () => { + // Replace "345" with "XY": "012XY6789", slice(1, 4) = "12X" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: replaceBlob, start: 3, end: 6 }]); + const slice = splicedBlob.slice(1, 4); + const text = await slice.text(); + expect(text).toBe("12X"); + }); + + it("should slice spanning replacement and after", async () => { + // Replace "345" with "XY": "012XY6789", slice(4, 7) = "Y67" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: replaceBlob, start: 3, end: 6 }]); + const slice = splicedBlob.slice(4, 7); + const text = await slice.text(); + expect(text).toBe("Y67"); + }); + + it("should slice spanning all segments with replacement", async () => { + // Replace "345" with "XY": "012XY6789", slice(1, 8) = "12XY678" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: replaceBlob, start: 3, end: 6 }]); + const slice = splicedBlob.slice(1, 8); + const text = await slice.text(); + expect(text).toBe("12XY678"); + }); + }); + + describe("slice method - edge cases", () => { + it("should handle empty insert blob", async () => { + const emptyBlob = new Blob([""]); + // Replace "345" with "": "0126789" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: emptyBlob, start: 3, end: 6 }]); + const text = await splicedBlob.text(); + expect(text).toBe("0126789"); + + const slice = splicedBlob.slice(2, 5); + expect(await slice.text()).toBe("267"); + }); + + it("should handle slice at segment boundaries", async () => { + // SplicedBlob: "01234ABC56789", exact boundary slices + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + + // End of before segment + expect(await splicedBlob.slice(4, 5).text()).toBe("4"); + // Start of insert segment + expect(await splicedBlob.slice(5, 6).text()).toBe("A"); + // End of insert segment + expect(await splicedBlob.slice(7, 8).text()).toBe("C"); + // Start of after segment + expect(await splicedBlob.slice(8, 9).text()).toBe("5"); + }); + + it("should handle insert at beginning with slice", async () => { + // Insert "ABC" at start: "ABC0123456789" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 0, end: 0 }]); + const slice = splicedBlob.slice(1, 5); + expect(await slice.text()).toBe("BC01"); + }); + + it("should handle insert at end with slice", async () => { + // Insert "ABC" at end: "0123456789ABC" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 10, end: 10 }]); + const slice = splicedBlob.slice(8, 12); + expect(await slice.text()).toBe("89AB"); + }); + }); + + describe("arrayBuffer method", () => { + it("should return correct ArrayBuffer for insertion", async () => { + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const buffer = await splicedBlob.arrayBuffer(); + const text = new TextDecoder().decode(buffer); + expect(text).toBe("01234ABC56789"); + expect(buffer.byteLength).toBe(13); + }); + + it("should return correct ArrayBuffer for replacement", async () => { + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: replaceBlob, start: 3, end: 6 }]); + const buffer = await splicedBlob.arrayBuffer(); + const text = new TextDecoder().decode(buffer); + expect(text).toBe("012XY6789"); + expect(buffer.byteLength).toBe(9); + }); + }); + + describe("stream method", () => { + it("should return correct stream for insertion", async () => { + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const stream = splicedBlob.stream(); + const response = new Response(stream); + const text = await response.text(); + expect(text).toBe("01234ABC56789"); + }); + + it("should return correct stream for replacement", async () => { + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: replaceBlob, start: 3, end: 6 }]); + const stream = splicedBlob.stream(); + const response = new Response(stream); + const text = await response.text(); + expect(text).toBe("012XY6789"); + }); + + it("should handle empty segments in stream", async () => { + const emptyBlob = new Blob([""]); + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: emptyBlob, start: 5, end: 5 }]); + const stream = splicedBlob.stream(); + const response = new Response(stream); + const text = await response.text(); + expect(text).toBe("0123456789"); + }); + }); + + describe("nested slicing", () => { + it("should allow slicing of sliced blob", async () => { + // SplicedBlob: "01234ABC56789", slice(3, 10) = "34ABC56", then slice(2, 5) = "ABC" + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const firstSlice = splicedBlob.slice(3, 10); + const secondSlice = firstSlice.slice(2, 5); + const text = await secondSlice.text(); + expect(text).toBe("ABC"); + }); + + it("should handle multiple levels of slicing", async () => { + // Complex slicing chain + const splicedBlob = SplicedBlob.create(originalBlob, [{ insert: insertBlob, start: 5, end: 5 }]); + const slice1 = splicedBlob.slice(2, 11); // "234ABC567" + const slice2 = slice1.slice(1, 7); // "34ABC5" + const slice3 = slice2.slice(2, 5); // "ABC" + const text = await slice3.text(); + expect(text).toBe("ABC"); + }); + }); +}); diff --git a/node_modules/@huggingface/hub/src/utils/SplicedBlob.ts b/node_modules/@huggingface/hub/src/utils/SplicedBlob.ts new file mode 100644 index 0000000000000000000000000000000000000000..28877bcc47b7efb17024371d13ee1e04dd2e9e23 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/SplicedBlob.ts @@ -0,0 +1,246 @@ +import { sum } from "./sum"; + +/** + * Represents a single splice operation + */ +interface SpliceOperation { + insert: Blob; + start: number; + end: number; +} + +/** + * @internal + * + * A SplicedBlob is a Blob that represents the result of splicing one or more insert blobs + * into an original blob at specified positions, replacing content between start and end. + * + * It is a drop-in replacement for the Blob class, so you can use it as a Blob. + * The splicing is done virtually without copying data until accessed. + * + * @example + * const originalBlob = new Blob(["Hello, World!"]); + * const insertBlob = new Blob(["Beautiful "]); + * const splicedBlob = SplicedBlob.create(originalBlob, insertBlob, 7, 7); + * // Result represents: "Hello, Beautiful World!" + */ +export class SplicedBlob extends Blob { + public originalBlob: Blob; + public spliceOperations: SpliceOperation[]; + + private constructor(originalBlob: Blob, spliceOperations: SpliceOperation[]) { + super(); + + this.originalBlob = originalBlob; + this.spliceOperations = spliceOperations; // Create a copy to prevent external mutation + } + + static create(originalBlob: Blob, operations: SpliceOperation[]): SplicedBlob { + // Validate all operations + for (const op of operations) { + if (op.start < 0 || op.end < 0) { + throw new Error("Invalid start/end positions for SplicedBlob"); + } + if (op.start > originalBlob.size || op.end > originalBlob.size) { + throw new Error("Invalid start/end positions for SplicedBlob"); + } + if (op.start > op.end) { + throw new Error("Invalid start/end positions for SplicedBlob"); + } + } + + // Sort operations by start position and validate no overlaps + const sortedOps = [...operations].sort((a, b) => a.start - b.start); + for (let i = 0; i < sortedOps.length - 1; i++) { + if (sortedOps[i].end > sortedOps[i + 1].start) { + throw new Error("Overlapping splice operations are not supported"); + } + } + + return new SplicedBlob(originalBlob, sortedOps); + } + + /** + * Returns the size of the spliced blob. + * Size = original size - total replaced size + total insert size + */ + override get size(): number { + let totalReplacedSize = 0; + let totalInsertSize = 0; + + for (const op of this.spliceOperations) { + totalReplacedSize += op.end - op.start; + totalInsertSize += op.insert.size; + } + + return this.originalBlob.size - totalReplacedSize + totalInsertSize; + } + + /** + * Returns the MIME type of the original blob. + */ + override get type(): string { + return this.originalBlob.type; + } + + /** + * Returns a new instance of SplicedBlob that is a slice of the current one. + * + * The slice is inclusive of the start and exclusive of the end. + * The slice method does not support negative start/end. + * + * @param start beginning of the slice + * @param end end of the slice + */ + override slice(start = 0, end = this.size): Blob { + if (start < 0 || end < 0) { + throw new TypeError("Unsupported negative start/end on SplicedBlob.slice"); + } + + start = Math.min(start, this.size); + end = Math.min(end, this.size); + + if (start >= end) { + return new Blob([]); + } + + // Get all segments and calculate their cumulative positions + const segments = this.segments; + const segmentBoundaries: number[] = [0]; + let cumulativeSize = 0; + + for (const segment of segments) { + cumulativeSize += segment.size; + segmentBoundaries.push(cumulativeSize); + } + + // Find which segments the slice spans + const resultSegments: Blob[] = []; + + for (let i = 0; i < segments.length; i++) { + const segmentStart = segmentBoundaries[i]; + const segmentEnd = segmentBoundaries[i + 1]; + + // Skip segments that are entirely before the slice + if (segmentEnd <= start) { + continue; + } + + // Skip segments that are entirely after the slice + if (segmentStart >= end) { + break; + } + + // Calculate slice bounds within this segment + const sliceStart = Math.max(0, start - segmentStart); + const sliceEnd = Math.min(segments[i].size, end - segmentStart); + + if (sliceStart < sliceEnd) { + resultSegments.push(segments[i].slice(sliceStart, sliceEnd)); + } + } + + return new Blob(resultSegments); + } + + get firstSpliceIndex(): number { + return this.spliceOperations[0]?.start ?? Infinity; + } + + /** + * Read the spliced blob content and returns it as an ArrayBuffer. + */ + override async arrayBuffer(): Promise { + const segments = this.segments; + const buffers = await Promise.all(segments.map((segment) => segment.arrayBuffer())); + + // Concatenate all buffers + const totalSize = sum(buffers.map((buffer) => buffer.byteLength)); + const result = new Uint8Array(totalSize); + + let offset = 0; + for (const buffer of buffers) { + result.set(new Uint8Array(buffer), offset); + offset += buffer.byteLength; + } + + return result.buffer; + } + + /** + * Read the spliced blob content and returns it as a string. + */ + override async text(): Promise { + const buffer = await this.arrayBuffer(); + return new TextDecoder().decode(buffer); + } + + /** + * Returns a stream around the spliced blob content. + */ + override stream(): ReturnType { + const readable = new ReadableStream({ + start: async (controller) => { + try { + const segments = this.segments; + + for (const segment of segments) { + const reader = segment.stream().getReader(); + + try { + while (true) { + const { done, value } = await reader.read(); + if (done) { + break; + } + controller.enqueue(value); + } + } finally { + reader.releaseLock(); + } + } + + controller.close(); + } catch (error) { + controller.error(error); + } + }, + }); + + return readable; + } + + /** + * Get all segments that make up the spliced blob. + * This includes original blob segments between splice operations and insert blobs. + */ + private get segments(): Blob[] { + const segments: Blob[] = []; + let currentPosition = 0; + + // Sort operations by start position to ensure correct order + const sortedOps = [...this.spliceOperations].sort((a, b) => a.start - b.start); + + for (const op of sortedOps) { + // Add segment from current position to start of this operation + if (currentPosition < op.start) { + segments.push(this.originalBlob.slice(currentPosition, op.start)); + } + + // Add the insert blob (if it has content) + if (op.insert.size > 0) { + segments.push(op.insert); + } + + // Move current position to end of this operation + currentPosition = op.end; + } + + // Add remaining segment after last operation + if (currentPosition < this.originalBlob.size) { + segments.push(this.originalBlob.slice(currentPosition)); + } + + return segments; + } +} diff --git a/node_modules/@huggingface/hub/src/utils/WebBlob.spec.ts b/node_modules/@huggingface/hub/src/utils/WebBlob.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..242a51e08eddd94fbf49b6858cf5b0d9db081b41 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/WebBlob.spec.ts @@ -0,0 +1,95 @@ +import { describe, expect, it, beforeAll } from "vitest"; +import { WebBlob } from "./WebBlob"; + +describe("WebBlob", () => { + const resourceUrl = new URL("https://huggingface.co/spaces/aschen/push-model-from-web/raw/main/mobilenet/model.json"); + let fullText: string; + let size: number; + let contentType: string; + + beforeAll(async () => { + const response = await fetch(resourceUrl, { method: "HEAD" }); + size = Number(response.headers.get("content-length")); + contentType = response.headers.get("content-type") || ""; + fullText = await (await fetch(resourceUrl)).text(); + }); + + it("should create a WebBlob with a slice on the entire resource", async () => { + const webBlob = await WebBlob.create(resourceUrl, { cacheBelow: 0, accessToken: undefined }); + + expect(webBlob).toMatchObject({ + url: resourceUrl, + start: 0, + end: size, + contentType, + }); + expect(webBlob).toBeInstanceOf(WebBlob); + expect(webBlob.size).toBe(size); + expect(webBlob.type).toBe(contentType); + + const text = await webBlob.text(); + expect(text).toBe(fullText); + + const streamText = await new Response(webBlob.stream()).text(); + expect(streamText).toBe(fullText); + }); + + it("should create a WebBlob with a slice on the entire resource, cached", async () => { + const webBlob = await WebBlob.create(resourceUrl, { cacheBelow: 1_000_000, accessToken: undefined }); + + expect(webBlob).not.toBeInstanceOf(WebBlob); + expect(webBlob.size).toBe(size); + expect(webBlob.type.replace(/;\s*charset=utf-8/, "")).toBe(contentType.replace(/;\s*charset=utf-8/, "")); + + const text = await webBlob.text(); + expect(text).toBe(fullText); + + const streamText = await new Response(webBlob.stream()).text(); + expect(streamText).toBe(fullText); + }); + + it("should lazy load a LFS file hosted on Hugging Face", async () => { + const zephyrUrl = + "https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha/resolve/main/model-00001-of-00008.safetensors"; + const url = new URL(zephyrUrl); + const webBlob = await WebBlob.create(url); + + expect(webBlob.size).toBe(1_889_587_040); + expect(webBlob).toBeInstanceOf(WebBlob); + expect(webBlob).toMatchObject({ url }); + expect(await webBlob.slice(10, 22).text()).toBe("__metadata__"); + }); + + it("should lazy load a Xet file hosted on Hugging Face", async () => { + const stableDiffusionUrl = + "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/unet/diffusion_pytorch_model.fp16.safetensors"; + const url = new URL(stableDiffusionUrl); + const webBlob = await WebBlob.create(url); + + expect(webBlob.size).toBe(5_135_149_760); + expect(webBlob).toBeInstanceOf(WebBlob); + expect(webBlob).toMatchObject({ url }); + expect(await webBlob.slice(10, 22).text()).toBe("__metadata__"); + }); + + it("should create a slice on the file", async () => { + const expectedText = fullText.slice(10, 20); + + const slice = (await WebBlob.create(resourceUrl, { cacheBelow: 0, accessToken: undefined })).slice(10, 20); + + expect(slice).toMatchObject({ + url: resourceUrl, + start: 10, + end: 20, + contentType, + }); + expect(slice.size).toBe(10); + expect(slice.type).toBe(contentType); + + const sliceText = await slice.text(); + expect(sliceText).toBe(expectedText); + + const streamText = await new Response(slice.stream()).text(); + expect(streamText).toBe(expectedText); + }); +}); diff --git a/node_modules/@huggingface/hub/src/utils/WebBlob.ts b/node_modules/@huggingface/hub/src/utils/WebBlob.ts new file mode 100644 index 0000000000000000000000000000000000000000..f46db177c7444db80c15225c923dd5d3e8f370e4 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/WebBlob.ts @@ -0,0 +1,139 @@ +/** + * WebBlob is a Blob implementation for web resources that supports range requests. + */ + +import { createApiError } from "../error"; + +interface WebBlobCreateOptions { + /** + * @default 1_000_000 + * + * Objects below that size will immediately be fetched and put in RAM, rather + * than streamed ad-hoc + */ + cacheBelow?: number; + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + accessToken: string | undefined; +} + +export class WebBlob extends Blob { + static async create(url: URL, opts?: WebBlobCreateOptions): Promise { + const customFetch = opts?.fetch ?? fetch; + const response = await customFetch(url, { + method: "HEAD", + ...(opts?.accessToken && { + headers: { + Authorization: `Bearer ${opts.accessToken}`, + }, + }), + }); + + const size = Number(response.headers.get("content-length")); + const contentType = response.headers.get("content-type") || ""; + const supportRange = response.headers.get("accept-ranges") === "bytes"; + + if (!supportRange || size < (opts?.cacheBelow ?? 1_000_000)) { + return await (await customFetch(url)).blob(); + } + + return new WebBlob(url, 0, size, contentType, true, customFetch, opts?.accessToken); + } + + private url: URL; + private start: number; + private end: number; + private contentType: string; + private full: boolean; + private fetch: typeof fetch; + private accessToken: string | undefined; + + constructor( + url: URL, + start: number, + end: number, + contentType: string, + full: boolean, + customFetch: typeof fetch, + accessToken: string | undefined, + ) { + super([]); + + this.url = url; + this.start = start; + this.end = end; + this.contentType = contentType; + this.full = full; + this.fetch = customFetch; + this.accessToken = accessToken; + } + + override get size(): number { + return this.end - this.start; + } + + override get type(): string { + return this.contentType; + } + + override slice(start = 0, end = this.size): WebBlob { + if (start < 0 || end < 0) { + new TypeError("Unsupported negative start/end on WebBlob.slice"); + } + + const slice = new WebBlob( + this.url, + this.start + start, + Math.min(this.start + end, this.end), + this.contentType, + start === 0 && end === this.size ? this.full : false, + this.fetch, + this.accessToken, + ); + + return slice; + } + + override async arrayBuffer(): Promise { + const result = await this.fetchRange(); + + return result.arrayBuffer(); + } + + override async text(): Promise { + const result = await this.fetchRange(); + + return result.text(); + } + + override stream(): ReturnType { + const stream = new TransformStream(); + + this.fetchRange() + .then((response) => response.body?.pipeThrough(stream)) + .catch((error) => stream.writable.abort(error.message)); + + return stream.readable; + } + + private fetchRange(): Promise { + const fetch = this.fetch; // to avoid this.fetch() which is bound to the instance instead of globalThis + if (this.full) { + return fetch(this.url, { + ...(this.accessToken && { + headers: { + Authorization: `Bearer ${this.accessToken}`, + }, + }), + }).then((resp) => (resp.ok ? resp : createApiError(resp))); + } + return fetch(this.url, { + headers: { + Range: `bytes=${this.start}-${this.end - 1}`, + ...(this.accessToken && { Authorization: `Bearer ${this.accessToken}` }), + }, + }).then((resp) => (resp.ok ? resp : createApiError(resp))); + } +} diff --git a/node_modules/@huggingface/hub/src/utils/XetBlob.spec.ts b/node_modules/@huggingface/hub/src/utils/XetBlob.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..7392c33b0eee36753e7f883865779cda10432f94 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/XetBlob.spec.ts @@ -0,0 +1,924 @@ +import { describe, expect, it } from "vitest"; +import type { ReconstructionInfo } from "./XetBlob"; +import { bg4_regroup_bytes, bg4_split_bytes, XetBlob } from "./XetBlob"; +import { sum } from "./sum"; + +describe("XetBlob", () => { + it("should lazy load the first 22 bytes", async () => { + const blob = new XetBlob({ + hash: "7b3b6d07673a88cf467e67c1f7edef1a8c268cbf66e9dd9b0366322d4ab56d9b", + size: 5_234_139_343, + refreshUrl: "https://huggingface.co/api/models/celinah/xet-experiments/xet-read-token/main", + }); + + expect(await blob.slice(10, 22).text()).toBe("__metadata__"); + }); + + it("should load the first chunk correctly", async () => { + let xorbCount = 0; + const blob = new XetBlob({ + refreshUrl: "https://huggingface.co/api/models/celinah/xet-experiments/xet-read-token/main", + hash: "7b3b6d07673a88cf467e67c1f7edef1a8c268cbf66e9dd9b0366322d4ab56d9b", + size: 5_234_139_343, + fetch: async (url, opts) => { + if (typeof url === "string" && url.includes("/xorbs/")) { + xorbCount++; + } + return fetch(url, opts); + }, + }); + + const xetDownload = await blob.slice(0, 29928).arrayBuffer(); + const bridgeDownload = await fetch( + "https://huggingface.co/celinah/xet-experiments/resolve/main/model5GB.safetensors", + { + headers: { + Range: "bytes=0-29927", + }, + }, + ).then((res) => res.arrayBuffer()); + + expect(new Uint8Array(xetDownload)).toEqual(new Uint8Array(bridgeDownload)); + expect(xorbCount).toBe(1); + }); + + it("should load just past the first chunk correctly", async () => { + let xorbCount = 0; + const blob = new XetBlob({ + refreshUrl: "https://huggingface.co/api/models/celinah/xet-experiments/xet-read-token/main", + hash: "7b3b6d07673a88cf467e67c1f7edef1a8c268cbf66e9dd9b0366322d4ab56d9b", + size: 5_234_139_343, + fetch: async (url, opts) => { + if (typeof url === "string" && url.includes("/xorbs/")) { + xorbCount++; + } + return fetch(url, opts); + }, + }); + + const xetDownload = await blob.slice(0, 29929).arrayBuffer(); + const bridgeDownload = await fetch( + "https://huggingface.co/celinah/xet-experiments/resolve/main/model5GB.safetensors", + { + headers: { + Range: "bytes=0-29928", + }, + }, + ).then((res) => res.arrayBuffer()); + + expect(xetDownload.byteLength).toBe(29929); + expect(new Uint8Array(xetDownload)).toEqual(new Uint8Array(bridgeDownload)); + expect(xorbCount).toBe(2); + }); + + it("should load the first 200kB correctly", async () => { + let xorbCount = 0; + const blob = new XetBlob({ + refreshUrl: "https://huggingface.co/api/models/celinah/xet-experiments/xet-read-token/main", + hash: "7b3b6d07673a88cf467e67c1f7edef1a8c268cbf66e9dd9b0366322d4ab56d9b", + size: 5_234_139_343, + fetch: async (url, opts) => { + if (typeof url === "string" && url.includes("/xorbs/")) { + xorbCount++; + } + return fetch(url, opts); + }, + // internalLogging: true, + }); + + const xetDownload = await blob.slice(0, 200_000).arrayBuffer(); + const bridgeDownload = await fetch( + "https://huggingface.co/celinah/xet-experiments/resolve/main/model5GB.safetensors", + { + headers: { + Range: "bytes=0-199999", + }, + }, + ).then((res) => res.arrayBuffer()); + + expect(xetDownload.byteLength).toBe(200_000); + expect(new Uint8Array(xetDownload)).toEqual(new Uint8Array(bridgeDownload)); + expect(xorbCount).toBe(2); + }, 60_000); + + it("should load correctly when loading far into a chunk range", async () => { + const blob = new XetBlob({ + refreshUrl: "https://huggingface.co/api/models/celinah/xet-experiments/xet-read-token/main", + hash: "7b3b6d07673a88cf467e67c1f7edef1a8c268cbf66e9dd9b0366322d4ab56d9b", + size: 5_234_139_343, + // internalLogging: true, + }); + + const xetDownload = await blob.slice(10_000_000, 10_100_000).arrayBuffer(); + const bridgeDownload = await fetch( + "https://huggingface.co/celinah/xet-experiments/resolve/main/model5GB.safetensors", + { + headers: { + Range: "bytes=10000000-10099999", + }, + }, + ).then((res) => res.arrayBuffer()); + + console.log("xet", xetDownload.byteLength, "bridge", bridgeDownload.byteLength); + expect(new Uint8Array(xetDownload).length).toEqual(100_000); + expect(new Uint8Array(xetDownload)).toEqual(new Uint8Array(bridgeDownload)); + }); + + it("should load text correctly when offset_into_range starts in a chunk further than the first", async () => { + const blob = new XetBlob({ + refreshUrl: "https://huggingface.co/api/models/celinah/xet-experiments/xet-read-token/main", + hash: "794efea76d8cb372bbe1385d9e51c3384555f3281e629903ecb6abeff7d54eec", + size: 62_914_580, + }); + + // Reconstruction info + // { + // "offset_into_first_range": 600000, + // "terms": + // [ + // { + // "hash": "be748f77930d5929cabd510a15f2c30f2f460b639804ef79dea46affa04fd8b2", + // "unpacked_length": 655360, + // "range": { "start": 0, "end": 5 }, + // }, + // { + // "hash": "be748f77930d5929cabd510a15f2c30f2f460b639804ef79dea46affa04fd8b2", + // "unpacked_length": 655360, + // "range": { "start": 0, "end": 5 }, + // }, + // ], + // "fetch_info": + // { + // "be748f77930d5929cabd510a15f2c30f2f460b639804ef79dea46affa04fd8b2": + // [ + // { + // "range": { "start": 0, "end": 5 }, + // "url": "...", + // "url_range": { "start": 0, "end": 2839 }, + // }, + // ], + // }, + // } + + const text = await blob.slice(600_000, 700_000).text(); + const bridgeDownload = await fetch("https://huggingface.co/celinah/xet-experiments/resolve/main/large_text.txt", { + headers: { + Range: "bytes=600000-699999", + }, + }).then((res) => res.text()); + + console.log("xet", text.length, "bridge", bridgeDownload.length); + expect(text.length).toBe(bridgeDownload.length); + }); + + describe("bg4_regoup_bytes", () => { + it("should regroup bytes when the array is %4 length", () => { + expect(bg4_regroup_bytes(new Uint8Array([1, 5, 2, 6, 3, 7, 4, 8]))).toEqual( + new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]), + ); + }); + + it("should regroup bytes when the array is %4 + 1 length", () => { + expect(bg4_regroup_bytes(new Uint8Array([1, 5, 9, 2, 6, 3, 7, 4, 8]))).toEqual( + new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9]), + ); + }); + + it("should regroup bytes when the array is %4 + 2 length", () => { + expect(bg4_regroup_bytes(new Uint8Array([1, 5, 9, 2, 6, 10, 3, 7, 4, 8]))).toEqual( + new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), + ); + }); + + it("should regroup bytes when the array is %4 + 3 length", () => { + expect(bg4_regroup_bytes(new Uint8Array([1, 5, 9, 2, 6, 10, 3, 7, 11, 4, 8]))).toEqual( + new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]), + ); + }); + }); + + describe("bg4_split_bytes", () => { + it("should split bytes when the array is %4 length", () => { + expect(bg4_split_bytes(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]))).toEqual( + new Uint8Array([1, 5, 2, 6, 3, 7, 4, 8]), + ); + }); + + it("should split bytes when the array is %4 + 1 length", () => { + expect(bg4_split_bytes(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9]))).toEqual( + new Uint8Array([1, 5, 9, 2, 6, 3, 7, 4, 8]), + ); + }); + + it("should split bytes when the array is %4 + 2 length", () => { + expect(bg4_split_bytes(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))).toEqual( + new Uint8Array([1, 5, 9, 2, 6, 10, 3, 7, 4, 8]), + ); + }); + + it("should split bytes when the array is %4 + 3 length", () => { + expect(bg4_split_bytes(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]))).toEqual( + new Uint8Array([1, 5, 9, 2, 6, 10, 3, 7, 11, 4, 8]), + ); + }); + + it("should be the inverse of bg4_regroup_bytes", () => { + const testArrays = [ + new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]), + new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9]), + new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), + new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]), + new Uint8Array([42]), + new Uint8Array([1, 2]), + new Uint8Array([1, 2, 3]), + ]; + + testArrays.forEach((arr) => { + expect(bg4_regroup_bytes(bg4_split_bytes(arr))).toEqual(arr); + }); + }); + }); + + describe("when mocked", () => { + describe("loading many chunks every read", () => { + it("should load different slices", async () => { + const chunk1Content = "hello"; + const chunk2Content = "world!"; + const debugged: Array<{ event: "read" | string } & Record> = []; + + const chunks = Array(1000) + .fill(0) + .flatMap(() => [makeChunk(chunk1Content), makeChunk(chunk2Content)]); + + const mergedChunks = await new Blob(chunks).arrayBuffer(); + const wholeText = (chunk1Content + chunk2Content).repeat(1000); + + const totalSize = wholeText.length; + let fetchCount = 0; + + const blob = new XetBlob({ + hash: "test", + size: totalSize, + refreshUrl: "https://huggingface.co", + listener: (e) => debugged.push(e), + fetch: async function (_url, opts) { + const url = new URL(_url as string); + const headers = opts?.headers as Record | undefined; + + switch (url.hostname) { + case "huggingface.co": { + // This is a token + return new Response( + JSON.stringify({ + casUrl: "https://cas.co", + accessToken: "boo", + exp: 1_000_000, + }), + ); + } + case "cas.co": { + // This is the reconstruction info + const range = headers?.["Range"]?.slice("bytes=".length).split("-").map(Number); + + const start = range?.[0] ?? 0; + // const end = range?.[1] ?? (totalSize - 1); + + return new Response( + JSON.stringify({ + terms: Array(1000) + .fill(0) + .map(() => ({ + hash: "test", + range: { + start: 0, + end: 2, + }, + unpacked_length: chunk1Content.length + chunk2Content.length, + })), + fetch_info: { + test: [ + { + url: "https://fetch.co", + range: { start: 0, end: 2 }, + url_range: { + start: 0, + end: mergedChunks.byteLength / 1000 - 1, + }, + }, + ], + }, + offset_into_first_range: start, + } satisfies ReconstructionInfo), + ); + } + case "fetch.co": { + fetchCount++; + return new Response( + new ReadableStream({ + pull(controller) { + controller.enqueue(new Uint8Array(mergedChunks)); + controller.close(); + }, + }), + //mergedChunks + ); + } + default: + throw new Error("Unhandled URL"); + } + }, + }); + + const startIndexes = [0, 5, 11, 6, 12, 100, 2000, totalSize - 12, totalSize - 2]; + + for (const index of startIndexes) { + console.log("slice", index); + const content = await blob.slice(index).text(); + expect(content.length).toBe(wholeText.length - index); + expect(content.slice(0, 1000)).toEqual(wholeText.slice(index).slice(0, 1000)); + expect(debugged.filter((e) => e.event === "read").length).toBe(2); // 1 read + 1 undefined + expect(fetchCount).toEqual(1); + + fetchCount = 0; + debugged.length = 0; + } + }); + + it("should load different slices when working with different XORBS", async () => { + const chunk1Content = "hello"; + const chunk2Content = "world!"; + const debugged: Array<{ event: "read" | string } & Record> = []; + + const chunks = Array(1000) + .fill(0) + .flatMap(() => [makeChunk(chunk1Content), makeChunk(chunk2Content)]); + + const mergedChunks = await new Blob(chunks).arrayBuffer(); + const wholeText = (chunk1Content + chunk2Content).repeat(1000); + + const totalSize = wholeText.length; + let fetchCount = 0; + + const blob = new XetBlob({ + hash: "test", + size: totalSize, + refreshUrl: "https://huggingface.co", + listener: (e) => debugged.push(e), + fetch: async function (_url, opts) { + const url = new URL(_url as string); + const headers = opts?.headers as Record | undefined; + + switch (url.hostname) { + case "huggingface.co": { + // This is a token + return new Response( + JSON.stringify({ + casUrl: "https://cas.co", + accessToken: "boo", + exp: 1_000_000, + }), + ); + } + case "cas.co": { + // This is the reconstruction info + const range = headers?.["Range"]?.slice("bytes=".length).split("-").map(Number); + + const start = range?.[0] ?? 0; + // const end = range?.[1] ?? (totalSize - 1); + + return new Response( + JSON.stringify({ + terms: Array(1000) + .fill(0) + .map((_, i) => ({ + hash: "test" + (i % 2), + range: { + start: 0, + end: 2, + }, + unpacked_length: chunk1Content.length + chunk2Content.length, + })), + fetch_info: { + test0: [ + { + url: "https://fetch.co", + range: { start: 0, end: 2 }, + url_range: { + start: 0, + end: mergedChunks.byteLength - 1, + }, + }, + ], + test1: [ + { + url: "https://fetch.co", + range: { start: 0, end: 2 }, + url_range: { + start: 0, + end: mergedChunks.byteLength - 1, + }, + }, + ], + }, + offset_into_first_range: start, + } satisfies ReconstructionInfo), + ); + } + case "fetch.co": { + fetchCount++; + return new Response( + new ReadableStream({ + pull(controller) { + controller.enqueue(new Uint8Array(mergedChunks)); + controller.close(); + }, + }), + //mergedChunks + ); + } + default: + throw new Error("Unhandled URL"); + } + }, + }); + + const startIndexes = [0, 5, 11, 6, 12, 100, 2000, totalSize - 12, totalSize - 2]; + + for (const index of startIndexes) { + console.log("slice", index); + const content = await blob.slice(index).text(); + expect(content.length).toBe(wholeText.length - index); + expect(content.slice(0, 1000)).toEqual(wholeText.slice(index).slice(0, 1000)); + expect(debugged.filter((e) => e.event === "read").length).toBe(4); // 1 read + 1 undefined + expect(fetchCount).toEqual(2); + + fetchCount = 0; + debugged.length = 0; + } + }); + }); + + describe("loading one chunk at a time", () => { + it("should load different slices but not till the end", async () => { + const chunk1Content = "hello"; + const chunk2Content = "world!"; + const debugged: Array<{ event: "read" | string } & Record> = []; + + const chunks = Array(1000) + .fill(0) + .flatMap(() => [makeChunk(chunk1Content), makeChunk(chunk2Content)]); + + const totalChunkLength = sum(chunks.map((x) => x.byteLength)); + const wholeText = (chunk1Content + chunk2Content).repeat(1000); + + const totalSize = wholeText.length; + let fetchCount = 0; + + const blob = new XetBlob({ + hash: "test", + size: totalSize, + refreshUrl: "https://huggingface.co", + listener: (e) => debugged.push(e), + fetch: async function (_url, opts) { + const url = new URL(_url as string); + const headers = opts?.headers as Record | undefined; + + switch (url.hostname) { + case "huggingface.co": { + // This is a token + return new Response( + JSON.stringify({ + casUrl: "https://cas.co", + accessToken: "boo", + exp: 1_000_000, + }), + ); + } + case "cas.co": { + // This is the reconstruction info + const range = headers?.["Range"]?.slice("bytes=".length).split("-").map(Number); + + const start = range?.[0] ?? 0; + // const end = range?.[1] ?? (totalSize - 1); + + return new Response( + JSON.stringify({ + terms: [ + { + hash: "test", + range: { + start: 0, + end: 2000, + }, + unpacked_length: chunk1Content.length + chunk2Content.length, + }, + ], + fetch_info: { + test: [ + { + url: "https://fetch.co", + range: { start: 0, end: 2000 }, + url_range: { + start: 0, + end: totalChunkLength - 1, + }, + }, + ], + }, + offset_into_first_range: start, + } satisfies ReconstructionInfo), + ); + } + case "fetch.co": { + fetchCount++; + return new Response( + new ReadableStream({ + pull(controller) { + for (const chunk of chunks) { + controller.enqueue(chunk); + } + controller.close(); + }, + }), + { + headers: { + "Content-Range": `bytes 0-${totalChunkLength - 1}/${totalChunkLength}`, + ETag: `"test"`, + "Content-Length": `${totalChunkLength}`, + }, + }, + ); + } + default: + throw new Error("Unhandled URL"); + } + }, + }); + + const startIndexes = [0, 5, 11, 6, 12, 100, 2000]; + + for (const index of startIndexes) { + console.log("slice", index); + const content = await blob.slice(index, 4000).text(); + expect(content.length).toBe(4000 - index); + expect(content.slice(0, 1000)).toEqual(wholeText.slice(index).slice(0, 1000)); + expect(fetchCount).toEqual(1); + + fetchCount = 0; + debugged.length = 0; + } + }); + + it("should load different slices", async () => { + const chunk1Content = "hello"; + const chunk2Content = "world!"; + const debugged: Array<{ event: "read" | string } & Record> = []; + + const chunks = Array(1000) + .fill(0) + .flatMap(() => [makeChunk(chunk1Content), makeChunk(chunk2Content)]); + + const totalChunkLength = sum(chunks.map((x) => x.byteLength)); + const wholeText = (chunk1Content + chunk2Content).repeat(1000); + + const totalSize = wholeText.length; + let fetchCount = 0; + + const blob = new XetBlob({ + hash: "test", + size: totalSize, + refreshUrl: "https://huggingface.co", + listener: (e) => debugged.push(e), + fetch: async function (_url, opts) { + const url = new URL(_url as string); + const headers = opts?.headers as Record | undefined; + + switch (url.hostname) { + case "huggingface.co": { + // This is a token + return new Response( + JSON.stringify({ + casUrl: "https://cas.co", + accessToken: "boo", + exp: 1_000_000, + }), + ); + } + case "cas.co": { + // This is the reconstruction info + const range = headers?.["Range"]?.slice("bytes=".length).split("-").map(Number); + + const start = range?.[0] ?? 0; + // const end = range?.[1] ?? (totalSize - 1); + + return new Response( + JSON.stringify({ + terms: Array(1000) + .fill(0) + .map(() => ({ + hash: "test", + range: { + start: 0, + end: 2, + }, + unpacked_length: chunk1Content.length + chunk2Content.length, + })), + fetch_info: { + test: [ + { + url: "https://fetch.co", + range: { start: 0, end: 2 }, + url_range: { + start: 0, + end: totalChunkLength - 1, + }, + }, + ], + }, + offset_into_first_range: start, + } satisfies ReconstructionInfo), + ); + } + case "fetch.co": { + fetchCount++; + return new Response( + new ReadableStream({ + pull(controller) { + for (const chunk of chunks) { + controller.enqueue(chunk); + } + controller.close(); + }, + }), + ); + } + default: + throw new Error("Unhandled URL"); + } + }, + }); + + const startIndexes = [0, 5, 11, 6, 12, 100, 2000, totalSize - 12, totalSize - 2]; + + for (const index of startIndexes) { + console.log("slice", index); + const content = await blob.slice(index).text(); + expect(content.length).toBe(wholeText.length - index); + expect(content.slice(0, 1000)).toEqual(wholeText.slice(index).slice(0, 1000)); + expect(debugged.filter((e) => e.event === "read").length).toBe(2000 + 1); // 1 read for each chunk + 1 undefined + expect(fetchCount).toEqual(1); + + fetchCount = 0; + debugged.length = 0; + } + }); + }); + + describe("loading at 29 bytes intervals", () => { + it("should load different slices", async () => { + const chunk1Content = "hello"; + const chunk2Content = "world!"; + const debugged: Array<{ event: "read" | string } & Record> = []; + + const chunks = Array(1000) + .fill(0) + .flatMap(() => [makeChunk(chunk1Content), makeChunk(chunk2Content)]); + const mergedChunks = await new Blob(chunks).arrayBuffer(); + const splitChunks = splitChunk(new Uint8Array(mergedChunks), 29); + + const totalChunkLength = sum(chunks.map((x) => x.byteLength)); + const wholeText = (chunk1Content + chunk2Content).repeat(1000); + + const totalSize = wholeText.length; + let fetchCount = 0; + + const blob = new XetBlob({ + hash: "test", + size: totalSize, + refreshUrl: "https://huggingface.co", + listener: (e) => debugged.push(e), + fetch: async function (_url, opts) { + const url = new URL(_url as string); + const headers = opts?.headers as Record | undefined; + + switch (url.hostname) { + case "huggingface.co": { + // This is a token + return new Response( + JSON.stringify({ + casUrl: "https://cas.co", + accessToken: "boo", + exp: 1_000_000, + }), + ); + } + case "cas.co": { + // This is the reconstruction info + const range = headers?.["Range"]?.slice("bytes=".length).split("-").map(Number); + + const start = range?.[0] ?? 0; + // const end = range?.[1] ?? (totalSize - 1); + + return new Response( + JSON.stringify({ + terms: Array(1000) + .fill(0) + .map(() => ({ + hash: "test", + range: { + start: 0, + end: 2, + }, + unpacked_length: chunk1Content.length + chunk2Content.length, + })), + fetch_info: { + test: [ + { + url: "https://fetch.co", + range: { start: 0, end: 2 }, + url_range: { + start: 0, + end: totalChunkLength - 1, + }, + }, + ], + }, + offset_into_first_range: start, + } satisfies ReconstructionInfo), + ); + } + case "fetch.co": { + fetchCount++; + return new Response( + new ReadableStream({ + pull(controller) { + for (const chunk of splitChunks) { + controller.enqueue(chunk); + } + controller.close(); + }, + }), + ); + } + default: + throw new Error("Unhandled URL"); + } + }, + }); + + const startIndexes = [0, 5, 11, 6, 12, 100, 2000, totalSize - 12, totalSize - 2]; + + for (const index of startIndexes) { + console.log("slice", index); + const content = await blob.slice(index).text(); + expect(content.length).toBe(wholeText.length - index); + expect(content.slice(0, 1000)).toEqual(wholeText.slice(index).slice(0, 1000)); + expect(debugged.filter((e) => e.event === "read").length).toBe(Math.ceil(totalChunkLength / 29) + 1); // 1 read for each chunk + 1 undefined + expect(fetchCount).toEqual(1); + + fetchCount = 0; + debugged.length = 0; + } + }); + }); + + describe("loading one byte at a time", () => { + it("should load different slices", async () => { + const chunk1Content = "hello"; + const chunk2Content = "world!"; + const debugged: Array<{ event: "read" | string } & Record> = []; + + const chunks = Array(100) + .fill(0) + .flatMap(() => [makeChunk(chunk1Content), makeChunk(chunk2Content)]) + .flatMap((x) => splitChunk(x, 1)); + + const totalChunkLength = sum(chunks.map((x) => x.byteLength)); + const wholeText = (chunk1Content + chunk2Content).repeat(100); + + const totalSize = wholeText.length; + let fetchCount = 0; + + const blob = new XetBlob({ + hash: "test", + size: totalSize, + refreshUrl: "https://huggingface.co", + listener: (e) => debugged.push(e), + fetch: async function (_url, opts) { + const url = new URL(_url as string); + const headers = opts?.headers as Record | undefined; + + switch (url.hostname) { + case "huggingface.co": { + // This is a token + return new Response( + JSON.stringify({ + casUrl: "https://cas.co", + accessToken: "boo", + exp: 1_000_000, + }), + ); + } + case "cas.co": { + // This is the reconstruction info + const range = headers?.["Range"]?.slice("bytes=".length).split("-").map(Number); + + const start = range?.[0] ?? 0; + // const end = range?.[1] ?? (totalSize - 1); + + return new Response( + JSON.stringify({ + terms: Array(100) + .fill(0) + .map(() => ({ + hash: "test", + range: { + start: 0, + end: 2, + }, + unpacked_length: chunk1Content.length + chunk2Content.length, + })), + fetch_info: { + test: [ + { + url: "https://fetch.co", + range: { start: 0, end: 2 }, + url_range: { + start: 0, + end: totalChunkLength - 1, + }, + }, + ], + }, + offset_into_first_range: start, + } satisfies ReconstructionInfo), + ); + } + case "fetch.co": { + fetchCount++; + return new Response( + new ReadableStream({ + pull(controller) { + for (const chunk of chunks) { + controller.enqueue(chunk); + } + controller.close(); + }, + }), + ); + } + default: + throw new Error("Unhandled URL"); + } + }, + }); + + const startIndexes = [0, 5, 11, 6, 12, 100, totalSize - 12, totalSize - 2]; + + for (const index of startIndexes) { + console.log("slice", index); + const content = await blob.slice(index).text(); + expect(content.length).toBe(wholeText.length - index); + expect(content.slice(0, 1000)).toEqual(wholeText.slice(index).slice(0, 1000)); + expect(debugged.filter((e) => e.event === "read").length).toBe(totalChunkLength + 1); // 1 read for each chunk + 1 undefined + expect(fetchCount).toEqual(1); + + fetchCount = 0; + debugged.length = 0; + } + }); + }); + }); +}); + +function makeChunk(content: string) { + const encoded = new TextEncoder().encode(content); + + const array = new Uint8Array(encoded.length + 8); + + const dataView = new DataView(array.buffer); + dataView.setUint8(0, 0); // version + dataView.setUint8(1, encoded.length % 256); // Compressed length + dataView.setUint8(2, (encoded.length >> 8) % 256); // Compressed length + dataView.setUint8(3, (encoded.length >> 16) % 256); // Compressed length + dataView.setUint8(4, 0); // Compression scheme + dataView.setUint8(5, encoded.length % 256); // Uncompressed length + dataView.setUint8(6, (encoded.length >> 8) % 256); // Uncompressed length + dataView.setUint8(7, (encoded.length >> 16) % 256); // Uncompressed length + + array.set(encoded, 8); + + return array; +} + +function splitChunk(chunk: Uint8Array, toLength: number): Uint8Array[] { + const dataView = new DataView(chunk.buffer); + return new Array(Math.ceil(chunk.byteLength / toLength)).fill(0).map((_, i) => { + const array = new Uint8Array(Math.min(toLength, chunk.byteLength - i * toLength)); + + for (let j = 0; j < array.byteLength; j++) { + array[j] = dataView.getUint8(i * toLength + j); + } + return array; + }); +} diff --git a/node_modules/@huggingface/hub/src/utils/XetBlob.ts b/node_modules/@huggingface/hub/src/utils/XetBlob.ts new file mode 100644 index 0000000000000000000000000000000000000000..fdfe1c11e3ef18d0311cef0362b46d896d4bd483 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/XetBlob.ts @@ -0,0 +1,713 @@ +import { createApiError } from "../error"; +import type { CredentialsParams } from "../types/public"; +import { checkCredentials } from "./checkCredentials"; +import { combineUint8Arrays } from "./combineUint8Arrays"; +import { decompress as lz4_decompress } from "../vendor/lz4js"; +import { RangeList } from "./RangeList"; + +const JWT_SAFETY_PERIOD = 60_000; +const JWT_CACHE_SIZE = 1_000; + +export interface XetReadToken { + accessToken: string; + casUrl: string; + exp: number; +} + +type XetBlobCreateOptions = { + /** + * Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. + */ + fetch?: typeof fetch; + // URL to get the access token from + refreshUrl: string; + size: number; + listener?: (arg: { event: "read" } | { event: "progress"; progress: { read: number; total: number } }) => void; + internalLogging?: boolean; + /** + * Pre-fetched read token to avoid the refresh URL roundtrip. + */ + readToken?: XetReadToken; +} & ({ hash: string; reconstructionUrl?: string } | { hash?: string; reconstructionUrl: string }) & + Partial; + +export interface ReconstructionInfo { + /** + * List of CAS blocks + */ + terms: Array<{ + /** Hash of the CAS block */ + hash: string; + /** Total uncompressed length of data of the chunks from range.start to range.end - 1 */ + unpacked_length: number; + /** Chunks. Eg start: 10, end: 100 = chunks 10-99 */ + range: { start: number; end: number }; + }>; + + /** + * Dictionnary of CAS block hash => list of ranges in the block + url to fetch it + */ + fetch_info: Record< + string, + Array<{ + url: string; + /** Chunk range */ + range: { start: number; end: number }; + /** + * Byte range, when making the call to the URL. + * + * We assume that we're given non-overlapping ranges for each hash + */ + url_range: { start: number; end: number }; + }> + >; + /** + * When doing a range request, the offset into the term's uncompressed data. Can be multiple chunks' worth of data. + */ + offset_into_first_range: number; +} + +export enum XetChunkCompressionScheme { + None = 0, + LZ4 = 1, + ByteGroupingLZ4 = 2, +} + +const compressionSchemeLabels: Record = { + [XetChunkCompressionScheme.None]: "None", + [XetChunkCompressionScheme.LZ4]: "LZ4", + [XetChunkCompressionScheme.ByteGroupingLZ4]: "ByteGroupingLZ4", +}; + +interface ChunkHeader { + version: number; // u8, 1 byte + compressed_length: number; // 3 * u8, 3 bytes + compression_scheme: XetChunkCompressionScheme; // u8, 1 byte + uncompressed_length: number; // 3 * u8, 3 bytes +} + +export const XET_CHUNK_HEADER_BYTES = 8; + +/** + * XetBlob is a blob implementation that fetches data directly from the Xet storage + */ +export class XetBlob extends Blob { + fetch: typeof fetch; + accessToken?: string; + refreshUrl: string; + reconstructionUrl?: string; + hash?: string; + start = 0; + end = 0; + internalLogging = false; + reconstructionInfo: ReconstructionInfo | undefined; + listener: XetBlobCreateOptions["listener"]; + + constructor(params: XetBlobCreateOptions) { + super([]); + + this.fetch = params.fetch ?? fetch.bind(globalThis); + this.accessToken = checkCredentials(params); + this.refreshUrl = params.refreshUrl; + this.end = params.size; + this.reconstructionUrl = params.reconstructionUrl; + this.hash = params.hash; + this.listener = params.listener; + this.internalLogging = params.internalLogging ?? false; + + if (params.readToken) { + const key = cacheKey({ refreshUrl: this.refreshUrl, initialAccessToken: this.accessToken }); + jwts.set(key, { + accessToken: params.readToken.accessToken, + expiresAt: new Date(params.readToken.exp * 1000), + casUrl: params.readToken.casUrl, + }); + } + } + + override get size(): number { + return this.end - this.start; + } + + #clone() { + const blob = new XetBlob({ + fetch: this.fetch, + hash: this.hash, + refreshUrl: this.refreshUrl, + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + reconstructionUrl: this.reconstructionUrl!, + size: this.size, + }); + + blob.accessToken = this.accessToken; + blob.start = this.start; + blob.end = this.end; + blob.reconstructionInfo = this.reconstructionInfo; + blob.listener = this.listener; + blob.internalLogging = this.internalLogging; + + return blob; + } + + override slice(start = 0, end = this.size): XetBlob { + if (start < 0 || end < 0) { + new TypeError("Unsupported negative start/end on XetBlob.slice"); + } + + const slice = this.#clone(); + + slice.start = this.start + start; + slice.end = Math.min(this.start + end, this.end); + + if (slice.start !== this.start || slice.end !== this.end) { + slice.reconstructionInfo = undefined; + } + + return slice; + } + + #reconstructionInfoPromise?: Promise; + + #loadReconstructionInfo() { + if (this.#reconstructionInfoPromise) { + return this.#reconstructionInfoPromise; + } + + this.#reconstructionInfoPromise = (async () => { + const connParams = await getAccessToken(this.accessToken, this.fetch, this.refreshUrl); + + // debug( + // `curl '${connParams.casUrl}/v1/reconstructions/${this.hash}' -H 'Authorization: Bearer ${connParams.accessToken}'` + // ); + + const resp = await this.fetch(this.reconstructionUrl ?? `${connParams.casUrl}/v1/reconstructions/${this.hash}`, { + headers: { + Authorization: `Bearer ${connParams.accessToken}`, + Range: `bytes=${this.start}-${this.end - 1}`, + }, + }); + + if (!resp.ok) { + throw await createApiError(resp); + } + + this.reconstructionInfo = (await resp.json()) as ReconstructionInfo; + + return this.reconstructionInfo; + })().finally(() => (this.#reconstructionInfoPromise = undefined)); + + return this.#reconstructionInfoPromise; + } + + async #fetch(): Promise> { + if (!this.reconstructionInfo) { + await this.#loadReconstructionInfo(); + } + + const rangeLists = new Map>(); + + if (!this.reconstructionInfo) { + throw new Error("Failed to load reconstruction info"); + } + + for (const term of this.reconstructionInfo.terms) { + let rangeList = rangeLists.get(term.hash); + if (!rangeList) { + rangeList = new RangeList(); + rangeLists.set(term.hash, rangeList); + } + + rangeList.add(term.range.start, term.range.end); + } + const listener = this.listener; + const log = this.internalLogging ? (...args: unknown[]) => console.log(...args) : () => {}; + + async function* readData( + reconstructionInfo: ReconstructionInfo, + customFetch: typeof fetch, + maxBytes: number, + reloadReconstructionInfo: () => Promise, + ) { + let totalBytesRead = 0; + let readBytesToSkip = reconstructionInfo.offset_into_first_range; + + for (const term of reconstructionInfo.terms) { + if (totalBytesRead >= maxBytes) { + break; + } + + const rangeList = rangeLists.get(term.hash); + if (!rangeList) { + throw new Error(`Failed to find range list for term ${term.hash}`); + } + + { + const termRanges = rangeList.getRanges(term.range.start, term.range.end); + + if (termRanges.every((range) => range.data)) { + log("all data available for term", term.hash, readBytesToSkip); + rangeLoop: for (const range of termRanges) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + for (let chunk of range.data!) { + if (readBytesToSkip) { + const skipped = Math.min(readBytesToSkip, chunk.byteLength); + chunk = chunk.slice(skipped); + readBytesToSkip -= skipped; + if (!chunk.byteLength) { + continue; + } + } + if (chunk.byteLength > maxBytes - totalBytesRead) { + chunk = chunk.slice(0, maxBytes - totalBytesRead); + } + totalBytesRead += chunk.byteLength; + // The stream consumer can decide to transfer ownership of the chunk, so we need to return a clone + // if there's more than one range for the same term + yield range.refCount > 1 ? chunk.slice() : chunk; + listener?.({ event: "progress", progress: { read: totalBytesRead, total: maxBytes } }); + + if (totalBytesRead >= maxBytes) { + break rangeLoop; + } + } + } + rangeList.remove(term.range.start, term.range.end); + continue; + } + } + + const fetchInfo = reconstructionInfo.fetch_info[term.hash].find( + (info) => info.range.start <= term.range.start && info.range.end >= term.range.end, + ); + + if (!fetchInfo) { + throw new Error( + `Failed to find fetch info for term ${term.hash} and range ${term.range.start}-${term.range.end}`, + ); + } + + log("term", term); + log("fetchinfo", fetchInfo); + log("readBytesToSkip", readBytesToSkip); + + let resp = await customFetch(fetchInfo.url, { + headers: { + Range: `bytes=${fetchInfo.url_range.start}-${fetchInfo.url_range.end}`, + }, + }); + + if (resp.status === 403) { + // In case it's expired + reconstructionInfo = await reloadReconstructionInfo(); + resp = await customFetch(fetchInfo.url, { + headers: { + Range: `bytes=${fetchInfo.url_range.start}-${fetchInfo.url_range.end}`, + }, + }); + } + + if (!resp.ok) { + throw await createApiError(resp); + } + + log( + "expected content length", + resp.headers.get("content-length"), + "range", + fetchInfo.url_range, + resp.headers.get("content-range"), + ); + + const reader = resp.body?.getReader(); + if (!reader) { + throw new Error("Failed to get reader from response body"); + } + + let done = false; + let chunkIndex = fetchInfo.range.start; + const ranges = rangeList.getRanges(fetchInfo.range.start, fetchInfo.range.end); + + let leftoverBytes: Uint8Array | undefined = undefined; + let totalFetchBytes = 0; + + fetchData: while (!done && totalBytesRead < maxBytes) { + const result = await reader.read(); + listener?.({ event: "read" }); + + done = result.done; + + log("read", result.value?.byteLength, "bytes", "total read", totalBytesRead, "toSkip", readBytesToSkip); + + if (!result.value) { + log("no data in result, cancelled", result); + continue; + } + + totalFetchBytes += result.value.byteLength; + + if (leftoverBytes) { + result.value = combineUint8Arrays(leftoverBytes, result.value); + leftoverBytes = undefined; + } + + while (totalBytesRead < maxBytes && result.value?.byteLength) { + if (result.value.byteLength < 8) { + // We need 8 bytes to parse the chunk header + leftoverBytes = result.value; + continue fetchData; + } + + const header = new DataView(result.value.buffer, result.value.byteOffset, XET_CHUNK_HEADER_BYTES); + const chunkHeader: ChunkHeader = { + version: header.getUint8(0), + compressed_length: header.getUint8(1) | (header.getUint8(2) << 8) | (header.getUint8(3) << 16), + compression_scheme: header.getUint8(4), + uncompressed_length: header.getUint8(5) | (header.getUint8(6) << 8) | (header.getUint8(7) << 16), + }; + + log("chunk header", chunkHeader, "to skip", readBytesToSkip); + + if (chunkHeader.version !== 0) { + throw new Error(`Unsupported chunk version ${chunkHeader.version}`); + } + + if ( + chunkHeader.compression_scheme !== XetChunkCompressionScheme.None && + chunkHeader.compression_scheme !== XetChunkCompressionScheme.LZ4 && + chunkHeader.compression_scheme !== XetChunkCompressionScheme.ByteGroupingLZ4 + ) { + throw new Error( + `Unsupported compression scheme ${ + compressionSchemeLabels[chunkHeader.compression_scheme] ?? chunkHeader.compression_scheme + }`, + ); + } + + if (result.value.byteLength < chunkHeader.compressed_length + XET_CHUNK_HEADER_BYTES) { + // We need more data to read the full chunk + leftoverBytes = result.value; + continue fetchData; + } + + result.value = result.value.slice(XET_CHUNK_HEADER_BYTES); + + let uncompressed = + chunkHeader.compression_scheme === XetChunkCompressionScheme.LZ4 + ? lz4_decompress(result.value.slice(0, chunkHeader.compressed_length), chunkHeader.uncompressed_length) + : chunkHeader.compression_scheme === XetChunkCompressionScheme.ByteGroupingLZ4 + ? bg4_regroup_bytes( + lz4_decompress( + result.value.slice(0, chunkHeader.compressed_length), + chunkHeader.uncompressed_length, + ), + ) + : result.value.slice(0, chunkHeader.compressed_length); + + const range = ranges.find((range) => chunkIndex >= range.start && chunkIndex < range.end); + const shouldYield = chunkIndex >= term.range.start && chunkIndex < term.range.end; + const minRefCountToStore = shouldYield ? 2 : 1; + let stored = false; + + // Assuming non-overlapping fetch_info ranges for the same hash + if (range && range.refCount >= minRefCountToStore) { + range.data ??= []; + range.data.push(uncompressed); + stored = true; + } + + if (shouldYield) { + if (readBytesToSkip) { + const skipped = Math.min(readBytesToSkip, uncompressed.byteLength); + uncompressed = uncompressed.slice(readBytesToSkip); + readBytesToSkip -= skipped; + } + + if (uncompressed.byteLength > maxBytes - totalBytesRead) { + uncompressed = uncompressed.slice(0, maxBytes - totalBytesRead); + } + + if (uncompressed.byteLength) { + log( + "yield", + uncompressed.byteLength, + "bytes", + result.value.byteLength, + "total read", + totalBytesRead, + stored, + ); + totalBytesRead += uncompressed.byteLength; + yield stored ? uncompressed.slice() : uncompressed; + listener?.({ event: "progress", progress: { read: totalBytesRead, total: maxBytes } }); + } + } + + chunkIndex++; + result.value = result.value.slice(chunkHeader.compressed_length); + } + } + + if ( + done && + totalBytesRead < maxBytes && + totalFetchBytes < fetchInfo.url_range.end - fetchInfo.url_range.start + 1 + ) { + log("done", done, "total read", totalBytesRead, maxBytes, totalFetchBytes); + log("failed to fetch all data for term", term.hash); + throw new Error( + `Failed to fetch all data for term ${term.hash}, fetched ${totalFetchBytes} bytes out of ${ + fetchInfo.url_range.end - fetchInfo.url_range.start + 1 + }`, + ); + } + + log("done", done, "total read", totalBytesRead, maxBytes, totalFetchBytes); + + // Release the reader + log("cancel reader"); + await reader.cancel(); + } + } + + const iterator = readData( + this.reconstructionInfo, + this.fetch, + this.end - this.start, + this.#loadReconstructionInfo.bind(this), + ); + + // todo: when Chrome/Safari support it, use ReadableStream.from(readData) + return new ReadableStream( + { + // todo: when Safari supports it, type controller as ReadableByteStreamController + async pull(controller) { + const result = await iterator.next(); + + if (result.value) { + controller.enqueue(result.value); + } + + if (result.done) { + controller.close(); + } + }, + type: "bytes", + // todo: when Safari supports it, add autoAllocateChunkSize param + }, + // todo : use ByteLengthQueuingStrategy when there's good support for it, currently in Node.js it fails due to size being a function + { + highWaterMark: 1_000, // 1_000 chunks for ~1MB of RAM + }, + ); + } + + override async arrayBuffer(): Promise { + const result = await this.#fetch(); + + return new Response(result).arrayBuffer(); + } + + override async text(): Promise { + const result = await this.#fetch(); + + return new Response(result).text(); + } + + async response(): Promise { + const result = await this.#fetch(); + + return new Response(result); + } + + override stream(): ReturnType { + const stream = new TransformStream(); + + this.#fetch() + .then((response) => response.pipeThrough(stream)) + .catch((error) => stream.writable.abort(error.message)); + + return stream.readable; + } +} + +const jwtPromises: Map> = new Map(); +/** + * Cache to store JWTs, to avoid making many auth requests when downloading multiple files from the same repo + */ +const jwts: Map< + string, + { + accessToken: string; + expiresAt: Date; + casUrl: string; + } +> = new Map(); + +function cacheKey(params: { refreshUrl: string; initialAccessToken: string | undefined }): string { + return JSON.stringify([params.refreshUrl, params.initialAccessToken]); +} + +// exported for testing purposes +export function bg4_regroup_bytes(bytes: Uint8Array): Uint8Array { + // python code + + // split = len(x) // 4 + // rem = len(x) % 4 + // g1_pos = split + (1 if rem >= 1 else 0) + // g2_pos = g1_pos + split + (1 if rem >= 2 else 0) + // g3_pos = g2_pos + split + (1 if rem == 3 else 0) + // ret = bytearray(len(x)) + // ret[0::4] = x[:g1_pos] + // ret[1::4] = x[g1_pos:g2_pos] + // ret[2::4] = x[g2_pos:g3_pos] + // ret[3::4] = x[g3_pos:] + + // todo: optimize to do it in-place + + const split = Math.floor(bytes.byteLength / 4); + const rem = bytes.byteLength % 4; + const g1_pos = split + (rem >= 1 ? 1 : 0); + const g2_pos = g1_pos + split + (rem >= 2 ? 1 : 0); + const g3_pos = g2_pos + split + (rem == 3 ? 1 : 0); + + const ret = new Uint8Array(bytes.byteLength); + for (let i = 0, j = 0; i < bytes.byteLength; i += 4, j++) { + ret[i] = bytes[j]; + } + + for (let i = 1, j = g1_pos; i < bytes.byteLength; i += 4, j++) { + ret[i] = bytes[j]; + } + + for (let i = 2, j = g2_pos; i < bytes.byteLength; i += 4, j++) { + ret[i] = bytes[j]; + } + + for (let i = 3, j = g3_pos; i < bytes.byteLength; i += 4, j++) { + ret[i] = bytes[j]; + } + + return ret; + + // alternative implementation (to benchmark which one is faster) + // for (let i = 0; i < bytes.byteLength - 3; i += 4) { + // ret[i] = bytes[i / 4]; + // ret[i + 1] = bytes[g1_pos + i / 4]; + // ret[i + 2] = bytes[g2_pos + i / 4]; + // ret[i + 3] = bytes[g3_pos + i / 4]; + // } + + // if (rem === 1) { + // ret[bytes.byteLength - 1] = bytes[g1_pos - 1]; + // } else if (rem === 2) { + // ret[bytes.byteLength - 2] = bytes[g1_pos - 1]; + // ret[bytes.byteLength - 1] = bytes[g2_pos - 1]; + // } else if (rem === 3) { + // ret[bytes.byteLength - 3] = bytes[g1_pos - 1]; + // ret[bytes.byteLength - 2] = bytes[g2_pos - 1]; + // ret[bytes.byteLength - 1] = bytes[g3_pos - 1]; + // } +} + +export function bg4_split_bytes(bytes: Uint8Array): Uint8Array { + // This function does the opposite of bg4_regroup_bytes + // It takes interleaved bytes and groups them by 4 + + const ret = new Uint8Array(bytes.byteLength); + const split = Math.floor(bytes.byteLength / 4); + const rem = bytes.byteLength % 4; + + // Calculate group positions in the output array + const g1_pos = split + (rem >= 1 ? 1 : 0); + const g2_pos = g1_pos + split + (rem >= 2 ? 1 : 0); + const g3_pos = g2_pos + split + (rem == 3 ? 1 : 0); + + // Extract every 4th byte starting from position 0, 1, 2, 3 + // and place them in their respective groups + for (let i = 0, j = 0; i < bytes.byteLength; i += 4, j++) { + ret[j] = bytes[i]; + } + + for (let i = 1, j = g1_pos; i < bytes.byteLength; i += 4, j++) { + ret[j] = bytes[i]; + } + + for (let i = 2, j = g2_pos; i < bytes.byteLength; i += 4, j++) { + ret[j] = bytes[i]; + } + + for (let i = 3, j = g3_pos; i < bytes.byteLength; i += 4, j++) { + ret[j] = bytes[i]; + } + + return ret; +} + +async function getAccessToken( + initialAccessToken: string | undefined, + customFetch: typeof fetch, + refreshUrl: string, +): Promise<{ accessToken: string; casUrl: string }> { + const key = cacheKey({ refreshUrl, initialAccessToken }); + + const jwt = jwts.get(key); + + if (jwt && jwt.expiresAt > new Date(Date.now() + JWT_SAFETY_PERIOD)) { + return { accessToken: jwt.accessToken, casUrl: jwt.casUrl }; + } + + // If we already have a promise for this repo, return it + const existingPromise = jwtPromises.get(key); + if (existingPromise) { + return existingPromise; + } + + const promise = (async () => { + const resp = await customFetch(refreshUrl, { + headers: { + ...(initialAccessToken + ? { + Authorization: `Bearer ${initialAccessToken}`, + } + : {}), + }, + }); + + if (!resp.ok) { + throw new Error(`Failed to get JWT token: ${resp.status} ${await resp.text()}`); + } + + const json: { accessToken: string; casUrl: string; exp: number } = await resp.json(); + const jwt = { + accessToken: json.accessToken, + expiresAt: new Date(json.exp * 1000), + casUrl: json.casUrl, + }; + + jwtPromises.delete(key); + + for (const [key, value] of jwts.entries()) { + if (value.expiresAt < new Date(Date.now() + JWT_SAFETY_PERIOD)) { + jwts.delete(key); + } else { + break; + } + } + if (jwts.size >= JWT_CACHE_SIZE) { + const keyToDelete = jwts.keys().next().value; + if (keyToDelete) { + jwts.delete(keyToDelete); + } + } + jwts.set(key, jwt); + + return { + accessToken: json.accessToken, + casUrl: json.casUrl, + }; + })(); + + jwtPromises.set(key, promise); + + return promise; +} diff --git a/node_modules/@huggingface/hub/src/utils/base64FromBytes.ts b/node_modules/@huggingface/hub/src/utils/base64FromBytes.ts new file mode 100644 index 0000000000000000000000000000000000000000..5327bbfe25838372cc7e25123d1cc9beaf80ceda --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/base64FromBytes.ts @@ -0,0 +1,11 @@ +export function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} diff --git a/node_modules/@huggingface/hub/src/utils/checkCredentials.ts b/node_modules/@huggingface/hub/src/utils/checkCredentials.ts new file mode 100644 index 0000000000000000000000000000000000000000..0e1717054b5dd1d03f4bd0b9c8f986a2ea4560f7 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/checkCredentials.ts @@ -0,0 +1,18 @@ +import type { CredentialsParams } from "../types/public"; + +export function checkAccessToken(accessToken: string): void { + if (!accessToken.startsWith("hf_")) { + throw new TypeError("Your access token must start with 'hf_'"); + } +} + +export function checkCredentials(params: Partial): string | undefined { + if (params.accessToken) { + checkAccessToken(params.accessToken); + return params.accessToken; + } + if (params.credentials?.accessToken) { + checkAccessToken(params.credentials.accessToken); + return params.credentials.accessToken; + } +} diff --git a/node_modules/@huggingface/hub/src/utils/chunk.ts b/node_modules/@huggingface/hub/src/utils/chunk.ts new file mode 100644 index 0000000000000000000000000000000000000000..20718cc89e5e32fd99d99be93dead0e4e24949f4 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/chunk.ts @@ -0,0 +1,25 @@ +import { range } from "./range"; + +/** + * Chunk array into arrays of length at most `chunkSize` + * + * @param chunkSize must be greater than or equal to 1 + */ +export function chunk(arr: T, chunkSize: number): T[] { + if (isNaN(chunkSize) || chunkSize < 1) { + throw new RangeError("Invalid chunk size: " + chunkSize); + } + + if (!arr.length) { + return []; + } + + /// Small optimization to not chunk buffers unless needed + if (arr.length <= chunkSize) { + return [arr]; + } + + return range(Math.ceil(arr.length / chunkSize)).map((i) => { + return arr.slice(i * chunkSize, (i + 1) * chunkSize); + }) as T[]; +} diff --git a/node_modules/@huggingface/hub/src/utils/combineUint8Arrays.spec.ts b/node_modules/@huggingface/hub/src/utils/combineUint8Arrays.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..96c806a2882bd6b7cccefb3b338cf8f4818dbd2a --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/combineUint8Arrays.spec.ts @@ -0,0 +1,15 @@ +import { describe, it, expect } from "vitest"; +import { combineUint8Arrays } from "./combineUint8Arrays"; + +describe("combineUint8Arrays", () => { + it.each([ + { a: [], b: [], expected: [] }, + { a: [], b: [1, 2, 3], expected: [1, 2, 3] }, + { a: [4, 5, 6], b: [], expected: [4, 5, 6] }, + { a: [7, 8], b: [9, 10], expected: [7, 8, 9, 10] }, + { a: [1], b: [2, 3, 4], expected: [1, 2, 3, 4] }, + ])("combines $a and $b to $expected", ({ a, b, expected }) => { + const result = combineUint8Arrays(new Uint8Array(a), new Uint8Array(b)); + expect(result).toEqual(new Uint8Array(expected)); + }); +}); diff --git a/node_modules/@huggingface/hub/src/utils/combineUint8Arrays.ts b/node_modules/@huggingface/hub/src/utils/combineUint8Arrays.ts new file mode 100644 index 0000000000000000000000000000000000000000..f0be769b85e44e22963a6c6976707a0a1fc25902 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/combineUint8Arrays.ts @@ -0,0 +1,10 @@ +export function combineUint8Arrays( + a: Uint8Array, + b: Uint8Array, +): Uint8Array { + const aLength = a.length; + const combinedBytes = new Uint8Array(aLength + b.length); + combinedBytes.set(a); + combinedBytes.set(b, aLength); + return combinedBytes; +} diff --git a/node_modules/@huggingface/hub/src/utils/createBlob.ts b/node_modules/@huggingface/hub/src/utils/createBlob.ts new file mode 100644 index 0000000000000000000000000000000000000000..5d5f200a66ec1946d2a770cfd7ccde1b9f724ec4 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/createBlob.ts @@ -0,0 +1,30 @@ +import { WebBlob } from "./WebBlob"; +import { isFrontend } from "./isFrontend"; + +/** + * This function allow to retrieve either a FileBlob or a WebBlob from a URL. + * + * From the backend: + * - support local files + * - support http resources with absolute URLs + * + * From the frontend: + * - support http resources with absolute or relative URLs + */ +export async function createBlob(url: URL, opts?: { fetch?: typeof fetch; accessToken?: string }): Promise { + if (url.protocol === "http:" || url.protocol === "https:") { + return WebBlob.create(url, { fetch: opts?.fetch, accessToken: opts?.accessToken }); + } + + if (isFrontend) { + throw new TypeError(`Unsupported URL protocol "${url.protocol}"`); + } + + if (url.protocol === "file:") { + const { FileBlob } = await import("./FileBlob"); + + return FileBlob.create(url); + } + + throw new TypeError(`Unsupported URL protocol "${url.protocol}"`); +} diff --git a/node_modules/@huggingface/hub/src/utils/createBlobs.ts b/node_modules/@huggingface/hub/src/utils/createBlobs.ts new file mode 100644 index 0000000000000000000000000000000000000000..93314ebf06232806279e0c90cfe532f7da1dbf68 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/createBlobs.ts @@ -0,0 +1,51 @@ +import { WebBlob } from "./WebBlob"; +import { isFrontend } from "./isFrontend"; + +/** + * This function allow to retrieve either a FileBlob or a WebBlob from a URL. + * + * From the backend: + * - support local files + * - support local folders + * - support http resources with absolute URLs + * + * From the frontend: + * - support http resources with absolute or relative URLs + */ +export async function createBlobs( + url: URL, + destPath: string, + opts?: { fetch?: typeof fetch; maxFolderDepth?: number; accessToken?: string }, +): Promise> { + if (url.protocol === "http:" || url.protocol === "https:") { + const blob = await WebBlob.create(url, { fetch: opts?.fetch, accessToken: opts?.accessToken }); + return [{ path: destPath, blob }]; + } + + if (isFrontend) { + throw new TypeError(`Unsupported URL protocol "${url.protocol}"`); + } + + if (url.protocol === "file:") { + const { FileBlob } = await import("./FileBlob"); + const { subPaths } = await import("./sub-paths"); + const paths = await subPaths(url, opts?.maxFolderDepth); + + if (paths.length === 1 && paths[0].relativePath === ".") { + const blob = await FileBlob.create(url); + return [{ path: destPath, blob }]; + } + + return Promise.all( + paths.map(async (path) => ({ + path: `${destPath}/${path.relativePath}` + .replace(/\/[.]$/, "") + .replaceAll("//", "/") + .replace(/^[.]?\//, ""), + blob: await FileBlob.create(new URL(path.path)), + })), + ); + } + + throw new TypeError(`Unsupported URL protocol "${url.protocol}"`); +} diff --git a/node_modules/@huggingface/hub/src/utils/createXorb.spec.ts b/node_modules/@huggingface/hub/src/utils/createXorb.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..80229554be14a9a64d8976fe66de13a5c90cc258 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/createXorb.spec.ts @@ -0,0 +1,93 @@ +import { describe, expect, it } from "vitest"; +import { backtrackDedup, CurrentXorbInfo } from "./createXorbs"; +import type { ShardData } from "./shardParser"; +import { ChunkCache } from "./ChunkCache"; + +describe("createXorb", () => { + describe("backtrackDedup", () => { + it("should update cache info for chunks that go back due to previous chunks being erased", () => { + const xorb = new CurrentXorbInfo(); + + const chunkMetadata = [ + { + xorbId: xorb.id, + chunkIndex: 0, + length: 101, + }, + { + xorbId: xorb.id, + chunkIndex: 1, + length: 101, + }, + ]; + xorb.chunks = [ + { + hash: "chunk1", + length: 101, + offset: 0, + }, + { + hash: "chunk2", + length: 101, + offset: 101, + }, + ]; + const shardData: ShardData = { + hmacKey: "shard1", + xorbs: [ + { + hash: "remoteXorb1", + chunks: [ + { + hash: "chunk0:shard1", + startOffset: 0, + unpackedLength: 100, + }, + { + hash: "chunk1:shard1", + startOffset: 100, + unpackedLength: 101, + }, + ], + }, + ], + }; + + const computeHmac = (hash: string, key: string) => { + return hash + ":" + key; + }; + + const chunkCache = new ChunkCache(); + let chunkIndex = 0; + for (const chunk of xorb.chunks) { + chunkCache.addChunkToCache(chunk.hash, xorb.id, chunkIndex++, shardData.hmacKey); + } + let xorbIndex = 0; + for (const xorb of shardData.xorbs) { + xorbIndex--; + for (let i = 0; i < xorb.chunks.length; i++) { + chunkCache.addChunkToCache(xorb.chunks[i].hash, xorbIndex, i, shardData.hmacKey); + } + } + const dedup = backtrackDedup(xorb, computeHmac, shardData, chunkCache, chunkMetadata, 0); + expect(dedup).toBe(101); + expect(xorb.chunks).toEqual([{ hash: "chunk2", length: 101, offset: 0 }]); + expect(chunkMetadata).toEqual([ + { + xorbId: -1, + chunkIndex: 1, + length: 101, + }, + { + xorbId: 0, + chunkIndex: 0, + length: 101, + }, + ]); + // chunk1 should use remote hash now + expect(chunkCache.getChunk("chunk1", computeHmac)).toEqual({ xorbIndex: -1, chunkIndex: 1 }); + // The xorb index for chunk2 should be 0 now that the previous chunk was erased from the xorb + expect(chunkCache.getChunk("chunk2", computeHmac)).toEqual({ xorbIndex: 0, chunkIndex: 0 }); + }); + }); +}); diff --git a/node_modules/@huggingface/hub/src/utils/createXorbs.ts b/node_modules/@huggingface/hub/src/utils/createXorbs.ts new file mode 100644 index 0000000000000000000000000000000000000000..9a6113091c931804173f1e485aad1fe6e1119863 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/createXorbs.ts @@ -0,0 +1,760 @@ +import { bg4_split_bytes, XET_CHUNK_HEADER_BYTES, XetChunkCompressionScheme } from "./XetBlob"; +import { compress as lz4_compress } from "../vendor/lz4js"; +import { ChunkCache } from "./ChunkCache"; +import { xetWriteToken, type XetWriteTokenParams } from "./xetWriteToken"; +import type { ShardData } from "./shardParser"; +import { parseShardData } from "./shardParser"; +import { SplicedBlob } from "./SplicedBlob"; + +const TARGET_CHUNK_SIZE = 64 * 1024; +/* eslint-disable @typescript-eslint/no-unused-vars */ +const MAX_CHUNK_SIZE = 2 * TARGET_CHUNK_SIZE; +const XORB_SIZE = 64 * 1024 * 1024; +const MAX_XORB_CHUNKS = 8 * 1024; +const INTERVAL_BETWEEN_REMOTE_DEDUP = 4_000_000; // 4MB +/** + * 0 = only show progress when uploading the xorb + * 1 = only show progress when processing the file + * 0.5 = show progress when uploading the xorb and when processing the file + */ +const PROCESSING_PROGRESS_RATIO = 0.1; +const UPLOADING_PROGRESS_RATIO = 1 - PROCESSING_PROGRESS_RATIO; + +interface XorbEvent { + event: "xorb"; + xorb: Uint8Array; + hash: string; + id: number; + chunks: Array<{ hash: string; length: number }>; + files: Array<{ + path: string; + progress: number; + lastSentProgress: number; + }>; +} + +export class CurrentXorbInfo { + id: number; + offset: number; + chunks: Array<{ hash: string; length: number; offset: number }>; + + fileProcessedBytes: Record; + fileUploadedBytes: Record; + fileSize: Record; + data: Uint8Array; + immutableData: { + chunkIndex: number; + offset: number; + } | null; + + constructor() { + this.id = 0; + this.offset = 0; + this.chunks = []; + this.fileProcessedBytes = {}; + this.fileUploadedBytes = {}; + this.fileSize = {}; + this.data = new Uint8Array(XORB_SIZE); + this.immutableData = null; + } + + event(computeXorbHash: (chunks: { hash: string; length: number }[]) => string): XorbEvent { + const xorbChunksCleaned = this.chunks.map((chunk) => ({ + hash: chunk.hash, + length: chunk.length, + })); + + return { + event: "xorb" as const, + xorb: this.data.subarray(0, this.offset), + hash: computeXorbHash(xorbChunksCleaned), + chunks: xorbChunksCleaned, + id: this.id, + files: Object.entries(this.fileProcessedBytes).map(([path, processedBytes]) => ({ + path, + progress: processedBytes / this.fileSize[path], + lastSentProgress: + ((this.fileUploadedBytes[path] ?? 0) + + (processedBytes - (this.fileUploadedBytes[path] ?? 0)) * PROCESSING_PROGRESS_RATIO) / + this.fileSize[path], + })), + }; + } +} + +export async function* createXorbs( + fileSources: AsyncGenerator<{ content: Blob; path: string; sha256?: string }>, + params: XetWriteTokenParams & { + yieldCallback?: (event: { event: "fileProgress"; path: string; progress: number }) => void; + }, +): AsyncGenerator< + | XorbEvent + | { + event: "file"; + path: string; + hash: string; + sha256?: string; + /** Percentage of file bytes that were deduplicated (0-1) */ + dedupRatio: number; + representation: Array<{ + xorbId: number | string; // either xorb id (for local xorbs) or xorb hash (for remote xorbs) + indexStart: number; + indexEnd: number; + /** Unpacked length */ + length: number; + rangeHash: string; + }>; + }, + void, + undefined +> { + const alreadyDoneFileSha256s: Set = new Set(); + const chunkModule = await import("../vendor/xet-chunk/chunker_wasm"); + let xorbId = 0; + + await chunkModule.init(); + const chunkCache = new ChunkCache(); + let xorb = new CurrentXorbInfo(); + + const nextXorb = (currentFile: { path: string; uploadedBytes: number; size: number }): XorbEvent => { + const event = xorb.event(chunkModule.compute_xorb_hash.bind(chunkModule)); + + xorbId++; + xorb = new CurrentXorbInfo(); + xorb.id = xorbId; + xorb.fileUploadedBytes = { + [currentFile.path]: currentFile.uploadedBytes, + }; + xorb.fileSize[currentFile.path] = currentFile.size; + + return event; + }; + + const pendingFileEvents: Array<{ + event: "file"; + path: string; + hash: string; + dedupRatio: number; + sha256?: string; + representation: Array<{ + xorbId: number | string; + indexStart: number; + indexEnd: number; + length: number; + rangeHash: string; + }>; + }> = []; + + const remoteXorbHashes: string[] = [""]; // starts at index 1 (to simplify implem a bit) + + for await (const fileSource of fileSources) { + params.yieldCallback?.({ + event: "fileProgress", + path: fileSource.path, + progress: 0, + }); + if (fileSource.sha256 && alreadyDoneFileSha256s.has(fileSource.sha256)) { + params.yieldCallback?.({ + event: "fileProgress", + path: fileSource.path, + progress: 1, + }); + continue; + } + if (fileSource.sha256) { + alreadyDoneFileSha256s.add(fileSource.sha256); + } + + const chunker = new chunkModule.Chunker(TARGET_CHUNK_SIZE); + try { + xorb.fileSize[fileSource.path] = fileSource.content.size; + + // Load dedup info for the first chunk of the file, if it's potentially modified by the splice + if (fileSource.content instanceof SplicedBlob && fileSource.content.firstSpliceIndex < MAX_CHUNK_SIZE) { + await loadDedupInfoToCache( + fileSource.content.originalBlob.slice(0, MAX_CHUNK_SIZE), + remoteXorbHashes, + params, + chunkCache, + chunkModule, + { + maxChunks: 1, + isAtBeginning: true, + }, + ); + } + let bytesSinceRemoteDedup = Infinity; + let bytesSinceLastProgressEvent = 0; + let isFirstFileChunk = true; + const sourceChunks: Array = []; + + const reader = fileSource.content.stream().getReader(); + let processedBytes = 0; + let dedupedBytes = 0; // Track bytes that were deduplicated + // Needed to compute the final file hash + // todo: have the wasm function to compute file hash be able to take data chunk by chunk instead of all at once + const fileChunks: Array<{ hash: string; length: number }> = []; + // Collect chunk metadata to build representation at the end + // todo: build partial representation at the end of each xorb, to avoid having to store all chunks in memory + const chunkMetadata: Array<{ + xorbId: number | string; + chunkIndex: number; + length: number; + }> = []; + + const addChunks = async function* (chunks: Array<{ hash: string; length: number; dedup: boolean }>) { + for (const chunk of chunks) { + if (isFirstFileChunk) { + chunk.dedup = true; + isFirstFileChunk = false; + } + let chunkIndex = xorb.chunks.length; + let chunkXorbId = xorbId; + + // Remove chunks from source data + const chunkToCopy = removeChunkFromSourceData(sourceChunks, chunk.length); + + let cacheData = chunkCache.getChunk(chunk.hash, chunkModule.compute_hmac); + if (cacheData === undefined && chunk.dedup && bytesSinceRemoteDedup >= INTERVAL_BETWEEN_REMOTE_DEDUP) { + const token = await xetWriteToken(params); + bytesSinceRemoteDedup = 0; + + const shardResp = await (params.fetch ?? fetch)(token.casUrl + "/v1/chunks/default/" + chunk.hash, { + headers: { + Authorization: `Bearer ${token.accessToken}`, + }, + }); + + // todo: handle non-404 non-429 errors, eg throw error + if (shardResp.ok) { + const shard = await shardResp.blob(); + const shardData = await parseShardData(shard); + + for (const xorb of shardData.xorbs) { + const remoteXorbId = -remoteXorbHashes.length; + remoteXorbHashes.push(xorb.hash); + let i = 0; + for (const chunk of xorb.chunks) { + chunkCache.addChunkToCache(chunk.hash, remoteXorbId, i++, shardData.hmacKey); + } + } + cacheData = chunkCache.getChunk(chunk.hash, chunkModule.compute_hmac); + + // We backtrack a bit to check if new dedup info contains older chunks + const oldDedupedBytes = dedupedBytes; + dedupedBytes = backtrackDedup( + xorb, + chunkModule.compute_hmac.bind(chunkModule), + shardData, + chunkCache, + chunkMetadata, + dedupedBytes, + ); + + if (dedupedBytes > oldDedupedBytes) { + xorb.fileUploadedBytes[fileSource.path] ??= 0; + xorb.fileUploadedBytes[fileSource.path] += dedupedBytes - oldDedupedBytes; + } + } + } + if (cacheData === undefined) { + if (!writeChunk(xorb, chunkToCopy, chunk.hash)) { + // Failure to write chunk, maybe because it went over xorb size limit + yield nextXorb({ path: fileSource.path, uploadedBytes: processedBytes, size: fileSource.content.size }); + + chunkIndex = 0; + chunkXorbId = xorbId; + + for (const event of pendingFileEvents) { + event.representation = event.representation.map((rep) => ({ + ...rep, + xorbId: (rep.xorbId as number) >= 0 ? rep.xorbId : remoteXorbHashes[-rep.xorbId], + })); + yield event; + } + pendingFileEvents.length = 0; + + if (!writeChunk(xorb, chunkToCopy, chunk.hash)) { + throw new Error("Failed to write chunk into xorb"); + } + } + + chunkCache.addChunkToCache(chunk.hash, xorbId, chunkIndex, null); + } else { + chunkXorbId = cacheData.xorbIndex; + chunkIndex = cacheData.chunkIndex; + dedupedBytes += chunk.length; // Track deduplicated bytes + xorb.fileUploadedBytes[fileSource.path] ??= 0; + xorb.fileUploadedBytes[fileSource.path] += chunk.length; + } + + bytesSinceRemoteDedup += chunk.length; + bytesSinceLastProgressEvent += chunk.length; + + // Collect metadata for building representation at the end + fileChunks.push({ hash: chunk.hash, length: chunk.length }); + chunkMetadata.push({ + xorbId: chunkXorbId, + chunkIndex: chunkIndex, + length: chunk.length, + }); + + xorb.fileProcessedBytes[fileSource.path] = processedBytes; + + if (bytesSinceLastProgressEvent >= 1_000_000) { + // Emit half of the progress when processed locally, other half when uploading the xorb + bytesSinceLastProgressEvent = 0; + params.yieldCallback?.({ + event: "fileProgress", + path: fileSource.path, + progress: + ((xorb.fileUploadedBytes[fileSource.path] ?? 0) + + (xorb.fileProcessedBytes[fileSource.path] - (xorb.fileUploadedBytes[fileSource.path] ?? 0)) * + PROCESSING_PROGRESS_RATIO) / + fileSource.content.size, + }); + } + + if (xorb.chunks.length >= MAX_XORB_CHUNKS) { + yield nextXorb({ path: fileSource.path, uploadedBytes: processedBytes, size: fileSource.content.size }); + + for (const event of pendingFileEvents) { + event.representation = event.representation.map((rep) => ({ + ...rep, + xorbId: (rep.xorbId as number) >= 0 ? rep.xorbId : remoteXorbHashes[-rep.xorbId], + })); + yield event; + } + pendingFileEvents.length = 0; + } + } + }; + + while (true) { + const { done, value } = await reader.read(); + if (done) { + yield* addChunks(chunker.finish()); + break; + } + processedBytes += value.length; + sourceChunks.push(value); + yield* addChunks(chunker.add_data(value)); + } + + const fileRepresentation = buildFileRepresentation( + chunkMetadata, + fileChunks, + chunkModule.compute_verification_hash.bind(chunkModule), + ); + xorb.immutableData = { + chunkIndex: xorb.chunks.length, + offset: xorb.offset, + }; + const dedupRatio = fileSource.content.size > 0 ? dedupedBytes / fileSource.content.size : 0; + + pendingFileEvents.push({ + event: "file" as const, + path: fileSource.path, + hash: chunkModule.compute_file_hash(fileChunks), + sha256: fileSource.sha256, + dedupRatio, + representation: fileRepresentation, + }); + } finally { + chunker.free(); + // ^ is this really needed ? + } + } + + if (xorb.offset > 0) { + yield xorb.event(chunkModule.compute_xorb_hash.bind(chunkModule)); + } + + for (const event of pendingFileEvents) { + event.representation = event.representation.map((rep) => ({ + ...rep, + xorbId: (rep.xorbId as number) >= 0 ? rep.xorbId : remoteXorbHashes[-rep.xorbId], + })); + yield event; + } +} + +export function backtrackDedup( + xorb: CurrentXorbInfo, + computeHmac: (hash: string, key: string) => string, + shardData: ShardData, + chunkCache: ChunkCache, + chunkMetadata: { xorbId: number | string; chunkIndex: number; length: number }[], + dedupedBytes: number, +): number { + const chunkIndexesToBacktrackFor = new Map(); + for ( + let chunkToRecheckIndex = xorb.immutableData?.chunkIndex ?? 0; + chunkToRecheckIndex < xorb.chunks.length; + chunkToRecheckIndex++ + ) { + const chunk = xorb.chunks[chunkToRecheckIndex]; + const hmacHash = computeHmac(chunk.hash, shardData.hmacKey); + const cacheData = chunkCache.getChunk(hmacHash, null); + if (cacheData !== undefined) { + chunkIndexesToBacktrackFor.set(chunkToRecheckIndex, { + xorbId: cacheData.xorbIndex, + chunkIndex: cacheData.chunkIndex, + }); + chunkCache.removeChunkFromCache(chunk.hash); + } + } + + // Use remote dedup info to update chunk metadata for file representation + for (const metadata of chunkMetadata) { + if (metadata.xorbId === xorb.id && chunkIndexesToBacktrackFor.has(metadata.chunkIndex)) { + const backtrackData = chunkIndexesToBacktrackFor.get(metadata.chunkIndex); + if (backtrackData !== undefined) { + metadata.xorbId = backtrackData.xorbId; + metadata.chunkIndex = backtrackData.chunkIndex; + dedupedBytes += metadata.length; + } + } + } + + // Remove chunks that were backtracked from xorbChunks + const xorbRangesToErase: Array<{ start: number; end: number }> = []; + for (let i = 0; i < xorb.chunks.length; i++) { + const chunk = xorb.chunks[i]; + if (chunkIndexesToBacktrackFor.has(i)) { + xorbRangesToErase.push({ + start: chunk.offset, + end: i < xorb.chunks.length - 1 ? xorb.chunks[i + 1].offset : xorb.offset, + }); + } + } + const xorbRangesToKeep: Array<{ start: number; end: number }> = []; + let currentStart = 0; + for (let i = 0; i < xorbRangesToErase.length; i++) { + const range = xorbRangesToErase[i]; + if (currentStart !== range.start) { + xorbRangesToKeep.push({ start: currentStart, end: range.start }); + } + currentStart = range.end; + } + if (currentStart !== xorb.offset) { + xorbRangesToKeep.push({ start: currentStart, end: xorb.offset }); + } + + let currentOffset = 0; + for (const range of xorbRangesToKeep) { + if (range.start !== currentOffset) { + xorb.data.set(xorb.data.subarray(range.start, range.end), currentOffset); + } + currentOffset += range.end - range.start; + } + const newXorbChunks: Array<{ hash: string; length: number; offset: number }> = []; + const oldIndexToNewIndex = new Map(); + let erasedOffset = 0; + for (let i = 0; i < xorb.chunks.length; i++) { + const chunk = xorb.chunks[i]; + if (chunkIndexesToBacktrackFor.has(i)) { + if (i < xorb.chunks.length - 1) { + erasedOffset += xorb.chunks[i + 1].offset - chunk.offset; + } + } else { + newXorbChunks.push({ + hash: chunk.hash, + length: chunk.length, + offset: chunk.offset - erasedOffset, + }); + // Only need a mapping if index changed (at least one previous chunk was erased) + if (erasedOffset > 0) { + oldIndexToNewIndex.set(i, newXorbChunks.length - 1); + } + } + } + xorb.chunks = newXorbChunks; + xorb.offset = currentOffset; + // Update chunkMetadata and chunkCache with new chunk indexes for the current xorb chunks + for (const chunk of chunkMetadata) { + if (chunk.xorbId === xorb.id) { + const newIndex = oldIndexToNewIndex.get(chunk.chunkIndex); + if (newIndex !== undefined) { + const cached = chunkCache.getChunk(xorb.chunks[newIndex].hash, null); + if (cached !== undefined && cached.xorbIndex === chunk.xorbId && cached.chunkIndex === chunk.chunkIndex) { + chunkCache.updateChunkIndex(xorb.chunks[newIndex].hash, newIndex); + } + chunk.chunkIndex = newIndex; + } + } + } + return dedupedBytes; +} + +/** + * Removes and returns a chunk of the specified length from the sourceChunks array. + */ +function removeChunkFromSourceData(sourceChunks: Array, chunkLength: number): Uint8Array { + if (chunkLength === sourceChunks[0].length) { + const chunkToCopy = sourceChunks[0]; + sourceChunks.shift(); + return chunkToCopy; + } else if (chunkLength < sourceChunks[0].length) { + const chunkToCopy = sourceChunks[0].subarray(0, chunkLength); + sourceChunks[0] = sourceChunks[0].subarray(chunkLength); + return chunkToCopy; + } else { + const chunkToCopy = new Uint8Array(chunkLength); + let copyOffset = 0; + let index = 0; + let toSlice = -1; + while (copyOffset < chunkLength) { + const nToCopy = Math.min(sourceChunks[index].length, chunkLength - copyOffset); + chunkToCopy.set(sourceChunks[index].subarray(0, nToCopy), copyOffset); + copyOffset += nToCopy; + + if (nToCopy === sourceChunks[index].length) { + index++; + } else { + toSlice = nToCopy; + } + } + sourceChunks.splice(0, index); + if (toSlice !== -1) { + sourceChunks[0] = sourceChunks[0].subarray(toSlice); + } + return chunkToCopy; + } +} + +/** + * Write a chunk header to the xorb and return the offset of where to write the next chunk + * + * If it returns 0, it means there wasn't enough space in the xorb + */ +function writeChunk(xorb: CurrentXorbInfo, chunk: Uint8Array, hash: string): boolean { + const regularCompressedChunk = lz4_compress(chunk); + const bgCompressedChunk = lz4_compress(bg4_split_bytes(chunk)); + const compressedChunk = + bgCompressedChunk.length < regularCompressedChunk.length ? bgCompressedChunk : regularCompressedChunk; + const chunkToWrite = compressedChunk.length < chunk.length ? compressedChunk : chunk; + + if (xorb.offset + XET_CHUNK_HEADER_BYTES + chunkToWrite.length > XORB_SIZE) { + return false; + } + + xorb.data[xorb.offset] = 0; + xorb.data[xorb.offset + 1] = chunkToWrite.length & 0xff; + xorb.data[xorb.offset + 2] = (chunkToWrite.length >> 8) & 0xff; + xorb.data[xorb.offset + 3] = (chunkToWrite.length >> 16) & 0xff; + xorb.data[xorb.offset + 4] = + chunkToWrite.length < chunk.length + ? bgCompressedChunk.length < regularCompressedChunk.length + ? XetChunkCompressionScheme.ByteGroupingLZ4 + : XetChunkCompressionScheme.LZ4 + : XetChunkCompressionScheme.None; + xorb.data[xorb.offset + 5] = chunk.length & 0xff; + xorb.data[xorb.offset + 6] = (chunk.length >> 8) & 0xff; + xorb.data[xorb.offset + 7] = (chunk.length >> 16) & 0xff; + + xorb.data.set(chunkToWrite, xorb.offset + XET_CHUNK_HEADER_BYTES); + + xorb.chunks.push({ hash, length: chunk.length, offset: xorb.offset }); + xorb.offset += XET_CHUNK_HEADER_BYTES + chunkToWrite.length; + return true; +} + +// Build file representation from collected metadata +const buildFileRepresentation = ( + metadata: Array<{ xorbId: number | string; chunkIndex: number; length: number }>, + chunks: Array<{ hash: string; length: number }>, + computeVerificationHash: (hashes: string[]) => string, +): Array<{ + xorbId: number | string; + indexStart: number; + indexEnd: number; + length: number; + rangeHash: string; +}> => { + if (metadata.length === 0) { + return []; + } + + const representation: Array<{ + xorbId: number | string; + indexStart: number; + indexEnd: number; + length: number; + rangeHash: string; + }> = []; + + let currentRange = { + xorbId: metadata[0].xorbId, + indexStart: metadata[0].chunkIndex, + indexEnd: metadata[0].chunkIndex + 1, + length: metadata[0].length, + chunkHashStart: 0, + }; + + for (let i = 1; i < metadata.length; i++) { + const chunk = metadata[i]; + + // Check if this chunk continues the current range + if (currentRange.xorbId === chunk.xorbId && currentRange.indexEnd === chunk.chunkIndex) { + // Extend current range + currentRange.indexEnd = chunk.chunkIndex + 1; + currentRange.length += chunk.length; + } else { + // Finalize current range and start a new one + const rangeHash = computeVerificationHash(chunks.slice(currentRange.chunkHashStart, i).map((x) => x.hash)); + representation.push({ + xorbId: currentRange.xorbId, + indexStart: currentRange.indexStart, + indexEnd: currentRange.indexEnd, + length: currentRange.length, + rangeHash, + }); + + currentRange = { + xorbId: chunk.xorbId, + indexStart: chunk.chunkIndex, + indexEnd: chunk.chunkIndex + 1, + length: chunk.length, + chunkHashStart: i, + }; + } + } + + // Finalize the last range + const rangeHash = computeVerificationHash(chunks.slice(currentRange.chunkHashStart).map((x) => x.hash)); + representation.push({ + xorbId: currentRange.xorbId, + indexStart: currentRange.indexStart, + indexEnd: currentRange.indexEnd, + length: currentRange.length, + rangeHash, + }); + + return representation; +}; + +/** + * Helper to load dedup info for blob contents into cache. + * Processes the blob's contents, chunks it, and loads dedup info into cache without writing to xorb. + * + * For now this is optimized for when the replacement data is at the very beginning of the file + * + * todo: handle when it's not at the beginning of the file by backingtracking xorb contents + * todo: handle when it's not at the beginning of the file by using previous content to chunk at the same boundaries as it would have in the original file + */ +async function loadDedupInfoToCache( + content: Blob, + /** Will be mutated */ + remoteXorbHashes: string[], + params: XetWriteTokenParams, + chunkCache: ChunkCache, + // eslint-disable-next-line @typescript-eslint/consistent-type-imports + chunkModule: typeof import("../vendor/xet-chunk/chunker_wasm"), + + opts?: { + isAtBeginning?: boolean; + /** + * The end position of the content to process + * + * Will process content up to the end of the chunk after this position + */ + end?: number; + /** + * The maximum number of chunks to process + * + * Will process content up to the end of the chunk after this position + */ + maxChunks?: number; + }, +): Promise { + const chunker = new chunkModule.Chunker(TARGET_CHUNK_SIZE); + const cache = chunkCache; + + let dedupedBytes = 0; + let chunksProcessed = 0; + let totalBytes = 0; + let bytesSinceRemoteDedup = Infinity; + const sourceChunks: Array = []; + + try { + const reader = content.stream().getReader(); + + const processChunks = async (chunkData: Array<{ hash: string; length: number; dedup: boolean }>) => { + for (const chunk of chunkData) { + chunksProcessed++; + if (opts?.isAtBeginning && chunksProcessed === 1) { + chunk.dedup = true; + } + totalBytes += chunk.length; + + // Remove chunks from source data + removeChunkFromSourceData(sourceChunks, chunk.length); + + // Check if chunk is already in cache + let cacheData = cache.getChunk(chunk.hash, chunkModule.compute_hmac); + + // Early return if already cached - no need for remote lookup + if (cacheData !== undefined) { + dedupedBytes += chunk.length; + bytesSinceRemoteDedup += chunk.length; + continue; + } + + // Try remote dedup lookup if conditions are met + if (chunk.dedup && bytesSinceRemoteDedup >= INTERVAL_BETWEEN_REMOTE_DEDUP) { + const token = await xetWriteToken(params); + bytesSinceRemoteDedup = 0; + + const shardResp = await (params.fetch ?? fetch)(token.casUrl + "/v1/chunks/default/" + chunk.hash, { + headers: { + Authorization: `Bearer ${token.accessToken}`, + }, + }); + + if (shardResp.ok) { + const shard = await shardResp.blob(); + const shardData = await parseShardData(shard); + + // Load remote dedup info into cache + for (const xorb of shardData.xorbs) { + const remoteXorbId = -remoteXorbHashes.length; + remoteXorbHashes.push(xorb.hash); + let i = 0; + for (const xorbChunk of xorb.chunks) { + cache.addChunkToCache(xorbChunk.hash, remoteXorbId, i++, shardData.hmacKey); + } + } + cacheData = cache.getChunk(chunk.hash, chunkModule.compute_hmac); + } + } + + if (cacheData !== undefined) { + // Chunk found in cache after remote lookup - it's deduplicated + dedupedBytes += chunk.length; + } + + bytesSinceRemoteDedup += chunk.length; + } + }; + + // Read and process blob content + while (true) { + if (opts?.end !== undefined && totalBytes >= opts.end) { + break; + } + if (opts?.maxChunks !== undefined && chunksProcessed >= opts.maxChunks) { + break; + } + const { done, value } = await reader.read(); + if (done) { + await processChunks(chunker.finish()); + break; + } + sourceChunks.push(value); + await processChunks(chunker.add_data(value)); + } + } finally { + chunker.free(); + } +} diff --git a/node_modules/@huggingface/hub/src/utils/eventToGenerator.spec.ts b/node_modules/@huggingface/hub/src/utils/eventToGenerator.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..59ed182a4a2394f6662afeee1d4f42fe4692e0b5 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/eventToGenerator.spec.ts @@ -0,0 +1,44 @@ +import { describe, expect, it } from "vitest"; +import { eventToGenerator } from "./eventToGenerator"; + +describe("eventToGenerator", () => { + it("should handle synchronous events", async () => { + const it = eventToGenerator((yieldCallback, returnCallback) => { + yieldCallback(1); + yieldCallback(2); + returnCallback(3); + }); + + const results = []; + let res: IteratorResult; + do { + res = await it.next(); + if (!res.done) { + results.push(res.value); + } + } while (!res.done); + + expect(results).toEqual([1, 2]); + expect(res.value).toBe(3); + }); + + it("should handle asynchronous events", async () => { + const it = eventToGenerator((yieldCallback, returnCallback) => { + setTimeout(() => yieldCallback(1), 100); + setTimeout(() => yieldCallback(2), 200); + setTimeout(() => returnCallback(3), 300); + }); + + const results = []; + let res: IteratorResult; + do { + res = await it.next(); + if (!res.done) { + results.push(res.value); + } + } while (!res.done); + + expect(results).toEqual([1, 2]); + expect(res.value).toBe(3); + }); +}); diff --git a/node_modules/@huggingface/hub/src/utils/eventToGenerator.ts b/node_modules/@huggingface/hub/src/utils/eventToGenerator.ts new file mode 100644 index 0000000000000000000000000000000000000000..1bbc84f997fe142cf2b22a80ba0927d3d11bbfc0 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/eventToGenerator.ts @@ -0,0 +1,64 @@ +export async function* eventToGenerator( + cb: ( + yieldCallback: (y: YieldType) => void, + returnCallback: (r: ReturnType) => void, + rejectCallack: (reason: unknown) => void, + ) => unknown, +): AsyncGenerator { + const promises: Array<{ + p: Promise<{ done: true; value: ReturnType } | { done: false; value: YieldType }>; + resolve: (value: { done: true; value: ReturnType } | { done: false; value: YieldType }) => void; + reject: (reason?: unknown) => void; + }> = []; + + function addPromise() { + let resolve: (value: { done: true; value: ReturnType } | { done: false; value: YieldType }) => void; + let reject: (reason?: unknown) => void; + const p = new Promise<{ done: true; value: ReturnType } | { done: false; value: YieldType }>((res, rej) => { + resolve = res; + reject = rej; + }); + // @ts-expect-error TS doesn't know that promise callback is executed immediately + promises.push({ p, resolve, reject }); + } + + addPromise(); + + const callbackRes = Promise.resolve() + .then(() => + cb( + (y) => { + addPromise(); + promises.at(-2)?.resolve({ done: false, value: y }); + }, + (r) => { + addPromise(); + promises.at(-2)?.resolve({ done: true, value: r }); + }, + (err) => promises.shift()?.reject(err), + ), + ) + .catch((err) => promises.shift()?.reject(err)); + + while (1) { + const p = promises[0]; + if (!p) { + throw new Error("Logic error in eventGenerator, promises should never be empty"); + } + const result = await p.p; + promises.shift(); + if (result.done) { + await callbackRes; // Clean up, may be removed in the future + // // Cleanup promises - shouldn't be needed due to above await + // for (const promise of promises) { + // promise.resolve(result); + // await promise.p; + // } + return result.value; + } + yield result.value; + } + + // So TS doesn't complain + throw new Error("Unreachable"); +} diff --git a/node_modules/@huggingface/hub/src/utils/hexFromBytes.ts b/node_modules/@huggingface/hub/src/utils/hexFromBytes.ts new file mode 100644 index 0000000000000000000000000000000000000000..a6c331c09525a0906333e7007e5724858795aa35 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/hexFromBytes.ts @@ -0,0 +1,11 @@ +export function hexFromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("hex"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(byte.toString(16).padStart(2, "0")); + }); + return bin.join(""); + } +} diff --git a/node_modules/@huggingface/hub/src/utils/insecureRandomString.ts b/node_modules/@huggingface/hub/src/utils/insecureRandomString.ts new file mode 100644 index 0000000000000000000000000000000000000000..f9954d431b26374eb47d4b81f10a5837990a6e90 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/insecureRandomString.ts @@ -0,0 +1,3 @@ +export function insecureRandomString(): string { + return Math.random().toString(36).slice(2); +} diff --git a/node_modules/@huggingface/hub/src/utils/isBackend.ts b/node_modules/@huggingface/hub/src/utils/isBackend.ts new file mode 100644 index 0000000000000000000000000000000000000000..1e6f27998645f2971dcdd92503d78de521273a26 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/isBackend.ts @@ -0,0 +1,6 @@ +const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; + +const isWebWorker = + typeof self === "object" && self.constructor && self.constructor.name === "DedicatedWorkerGlobalScope"; + +export const isBackend = !isBrowser && !isWebWorker; diff --git a/node_modules/@huggingface/hub/src/utils/isFrontend.ts b/node_modules/@huggingface/hub/src/utils/isFrontend.ts new file mode 100644 index 0000000000000000000000000000000000000000..0b9bab392e71f315704c210bc0e8ff210379703d --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/isFrontend.ts @@ -0,0 +1,3 @@ +import { isBackend } from "./isBackend"; + +export const isFrontend = !isBackend; diff --git a/node_modules/@huggingface/hub/src/utils/mergeAsyncGenerators.spec.ts b/node_modules/@huggingface/hub/src/utils/mergeAsyncGenerators.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..dc1bfdc6d87a1a4b4283fd13e24852cb132926c2 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/mergeAsyncGenerators.spec.ts @@ -0,0 +1,94 @@ +import { describe, expect, it } from "vitest"; +import { mergeAsyncGenerators } from "./mergeAsyncGenerators"; +import { splitAsyncGenerator } from "./splitAsyncGenerator"; + +describe("mergeAsyncGenerators", () => { + const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); + it("should merge multiple async generators", async () => { + const generator1 = (async function* () { + yield 1; + yield 2; + await sleep(250); + yield 3; + })(); + const generator2 = (async function* () { + await sleep(100); + yield 4; + yield 5; + yield 6; + })(); + const generator3 = (async function* () { + await sleep(200); + yield 7; + yield 8; + yield 9; + })(); + + const results: number[] = []; + + for await (const result of mergeAsyncGenerators([generator1, generator2, generator3])) { + results.push(result); + } + expect(results).toEqual([1, 2, 4, 5, 6, 7, 8, 9, 3]); + }); + + it("should merge multiple async generators from a single source", async () => { + const source = (async function* () { + yield 1; + yield 2; + yield 3; + yield 4; + yield 5; + yield 6; + yield 7; + yield 8; + yield 9; + })(); + const sources = splitAsyncGenerator(source, 3); + + const generator1 = (async function* () { + for await (const result of sources[0]) { + yield { result, gen: 1 }; + await sleep(100); + } + })(); + + const generator2 = (async function* () { + await sleep(50); + for await (const result of sources[1]) { + yield { result, gen: 2 }; + await sleep(100); + } + })(); + + const generator3 = (async function* () { + await sleep(80); + let count = 0; + for await (const result of sources[2]) { + yield { result, gen: 3 }; + count++; + + if (count >= 2) { + return; + } + } + })(); + + const results: { result: number; gen: number }[] = []; + for await (const result of mergeAsyncGenerators([generator1, generator2, generator3])) { + results.push(result); + } + expect(results.length).toBe(9); + expect(results).toEqual([ + { result: 1, gen: 1 }, + { result: 2, gen: 2 }, + { result: 3, gen: 3 }, + { result: 4, gen: 3 }, + { result: 5, gen: 1 }, + { result: 6, gen: 2 }, + { result: 7, gen: 1 }, + { result: 8, gen: 2 }, + { result: 9, gen: 1 }, + ]); + }); +}); diff --git a/node_modules/@huggingface/hub/src/utils/mergeAsyncGenerators.ts b/node_modules/@huggingface/hub/src/utils/mergeAsyncGenerators.ts new file mode 100644 index 0000000000000000000000000000000000000000..984549f26c87046474c510565b81436e128355a1 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/mergeAsyncGenerators.ts @@ -0,0 +1,34 @@ +/** + * Merge outputs of multiple async generators. + */ +export async function* mergeAsyncGenerators(generators: AsyncGenerator[]): AsyncGenerator { + const executing: Promise<{ result: IteratorResult; gen: AsyncGenerator }>[] = []; + + const generatorSymbol = Symbol("generator"); + + for (const gen of generators) { + const p = gen.next().then((result) => ({ result, gen })); + Object.defineProperty(p, generatorSymbol, { + value: gen, + }); + executing.push(p); + } + + while (executing.length > 0) { + const next = await Promise.race(executing); + const { result, gen } = next; + + const index = executing.findIndex((p) => Object.getOwnPropertyDescriptor(p, generatorSymbol)?.value === gen); + + if (result.done) { + executing.splice(index, 1); + continue; + } + + yield result.value; + executing[index] = gen.next().then((result) => ({ result, gen })); + Object.defineProperty(executing[index], generatorSymbol, { + value: gen, + }); + } +} diff --git a/node_modules/@huggingface/hub/src/utils/normalizeInferenceProviderMapping.ts b/node_modules/@huggingface/hub/src/utils/normalizeInferenceProviderMapping.ts new file mode 100644 index 0000000000000000000000000000000000000000..471997f2de0cce1b826a18c5df6b7713bfa6be95 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/normalizeInferenceProviderMapping.ts @@ -0,0 +1,36 @@ +import type { WidgetType } from "@huggingface/tasks"; +import type { ApiModelInferenceProviderMappingEntry } from "../types/api/api-model"; + +/** + * Normalize inferenceProviderMapping to always return an array format. + * + * Little hack to simplify Inference Providers logic and make it backward and forward compatible. + * Right now, API returns a dict on model-info and a list on list-models. Let's harmonize to list. + */ +export function normalizeInferenceProviderMapping( + hfModelId: string, + inferenceProviderMapping?: + | ApiModelInferenceProviderMappingEntry[] + | Record, +): ApiModelInferenceProviderMappingEntry[] { + if (!inferenceProviderMapping) { + return []; + } + + // If it's already an array, return it as is + if (Array.isArray(inferenceProviderMapping)) { + return inferenceProviderMapping.map((entry) => ({ + ...entry, + hfModelId, + })); + } + + // Convert mapping to array format + return Object.entries(inferenceProviderMapping).map(([provider, mapping]) => ({ + provider, + hfModelId, + providerId: mapping.providerId, + status: mapping.status, + task: mapping.task, + })); +} diff --git a/node_modules/@huggingface/hub/src/utils/omit.ts b/node_modules/@huggingface/hub/src/utils/omit.ts new file mode 100644 index 0000000000000000000000000000000000000000..e37f54b8844415b1d0573ae51117906c2e339ccc --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/omit.ts @@ -0,0 +1,14 @@ +import { pick } from "./pick"; +import { typedInclude } from "./typedInclude"; + +/** + * Return copy of object, omitting blacklisted array of props + */ +export function omit, K extends keyof T>( + o: T, + props: K[] | K, +): Pick> { + const propsArr = Array.isArray(props) ? props : [props]; + const letsKeep = (Object.keys(o) as (keyof T)[]).filter((prop) => !typedInclude(propsArr, prop)); + return pick(o, letsKeep); +} diff --git a/node_modules/@huggingface/hub/src/utils/parseLinkHeader.ts b/node_modules/@huggingface/hub/src/utils/parseLinkHeader.ts new file mode 100644 index 0000000000000000000000000000000000000000..6939a89be6701240097f8b2f7f6c581b4ab6c739 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/parseLinkHeader.ts @@ -0,0 +1,8 @@ +/** + * Parse Link HTTP header, eg `; rel="next"` + */ +export function parseLinkHeader(header: string): Record { + const regex = /<(https?:[/][/][^>]+)>;\s+rel="([^"]+)"/g; + + return Object.fromEntries([...header.matchAll(regex)].map(([, url, rel]) => [rel, url])); +} diff --git a/node_modules/@huggingface/hub/src/utils/pick.ts b/node_modules/@huggingface/hub/src/utils/pick.ts new file mode 100644 index 0000000000000000000000000000000000000000..a47a57f861c00d3917d2065c49d09016a14b25e7 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/pick.ts @@ -0,0 +1,13 @@ +/** + * Return copy of object, only keeping whitelisted properties. + */ +export function pick(o: T, props: K[] | ReadonlyArray): Pick { + return Object.assign( + {}, + ...props.map((prop) => { + if (o[prop] !== undefined) { + return { [prop]: o[prop] }; + } + }), + ); +} diff --git a/node_modules/@huggingface/hub/src/utils/promisesQueue.spec.ts b/node_modules/@huggingface/hub/src/utils/promisesQueue.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..3e9ea6d124ff5cc290eb6aefffa4ce8148b3c46a --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/promisesQueue.spec.ts @@ -0,0 +1,48 @@ +import { describe, expect, it } from "vitest"; +import { promisesQueue } from "./promisesQueue"; + +describe("promisesQueue", () => { + it("should handle multiple errors without triggering an uncaughtException", async () => { + const factories = [ + () => Promise.reject(new Error("error 1")), + () => Promise.reject(new Error("error 2")), + () => Promise.reject(new Error("error 3")), + ]; + + try { + await promisesQueue(factories, 10); + } catch (err) { + if (!(err instanceof Error)) { + throw err; + } + } + + try { + await promisesQueue(factories, 1); + } catch (err) { + if (!(err instanceof Error)) { + throw err; + } + expect(err.message).toBe("error 1"); + } + }); + + it("should return ordered results", async () => { + const factories = [ + () => Promise.resolve(1), + () => Promise.resolve(2), + () => Promise.resolve(3), + () => Promise.resolve(4), + () => Promise.resolve(5), + () => Promise.resolve(6), + () => Promise.resolve(7), + () => Promise.resolve(8), + () => Promise.resolve(9), + () => Promise.resolve(10), + ]; + + const results = await promisesQueue(factories, 3); + + expect(results).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); + }); +}); diff --git a/node_modules/@huggingface/hub/src/utils/promisesQueue.ts b/node_modules/@huggingface/hub/src/utils/promisesQueue.ts new file mode 100644 index 0000000000000000000000000000000000000000..35d2d06907e3aad537e96f99509297f79d5ee547 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/promisesQueue.ts @@ -0,0 +1,23 @@ +/** + * Execute queue of promises. + * + * Inspired by github.com/rxaviers/async-pool + */ +export async function promisesQueue(factories: (() => Promise)[], concurrency: number): Promise { + const results: T[] = []; + const executing: Set> = new Set(); + let index = 0; + for (const factory of factories) { + const closureIndex = index++; + const e = factory().then((r) => { + results[closureIndex] = r; + executing.delete(e); + }); + executing.add(e); + if (executing.size >= concurrency) { + await Promise.race(executing); + } + } + await Promise.all(executing); + return results; +} diff --git a/node_modules/@huggingface/hub/src/utils/promisesQueueStreaming.ts b/node_modules/@huggingface/hub/src/utils/promisesQueueStreaming.ts new file mode 100644 index 0000000000000000000000000000000000000000..72f441afbce2538c22b77a5a9d9e89f0d8e0ba22 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/promisesQueueStreaming.ts @@ -0,0 +1,25 @@ +/** + * Execute queue of promises in a streaming fashion. + * + * Optimized for streaming: + * - Expects an iterable as input + * - Does not return a list of all results + * + * Inspired by github.com/rxaviers/async-pool + */ +export async function promisesQueueStreaming( + factories: AsyncIterable<() => Promise> | Iterable<() => Promise>, + concurrency: number, +): Promise { + const executing: Promise[] = []; + for await (const factory of factories) { + const e = factory().then(() => { + executing.splice(executing.indexOf(e), 1); + }); + executing.push(e); + if (executing.length >= concurrency) { + await Promise.race(executing); + } + } + await Promise.all(executing); +} diff --git a/node_modules/@huggingface/hub/src/utils/range.ts b/node_modules/@huggingface/hub/src/utils/range.ts new file mode 100644 index 0000000000000000000000000000000000000000..d7ebababf2ba06366899f5d192b08e849b708f9a --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/range.ts @@ -0,0 +1,13 @@ +/** + * One param: create list of integers from 0 (inclusive) to n (exclusive) + * Two params: create list of integers from a (inclusive) to b (exclusive) + */ +export function range(n: number, b?: number): number[] { + return b + ? Array(b - n) + .fill(0) + .map((_, i) => n + i) + : Array(n) + .fill(0) + .map((_, i) => i); +} diff --git a/node_modules/@huggingface/hub/src/utils/sha256-node.ts b/node_modules/@huggingface/hub/src/utils/sha256-node.ts new file mode 100644 index 0000000000000000000000000000000000000000..a7c75ad7765db2246c327de8fcc2d7096b68033f --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/sha256-node.ts @@ -0,0 +1,26 @@ +import { Readable } from "node:stream"; +import type { ReadableStream } from "node:stream/web"; +import { createHash } from "node:crypto"; + +export async function* sha256Node( + buffer: ArrayBuffer | Blob, + opts?: { + abortSignal?: AbortSignal; + }, +): AsyncGenerator { + const sha256Stream = createHash("sha256"); + const size = buffer instanceof Blob ? buffer.size : buffer.byteLength; + let done = 0; + const readable = + buffer instanceof Blob ? Readable.fromWeb(buffer.stream() as ReadableStream) : Readable.from(Buffer.from(buffer)); + + for await (const buffer of readable) { + sha256Stream.update(buffer); + done += buffer.length; + yield done / size; + + opts?.abortSignal?.throwIfAborted(); + } + + return sha256Stream.digest("hex"); +} diff --git a/node_modules/@huggingface/hub/src/utils/sha256.spec.ts b/node_modules/@huggingface/hub/src/utils/sha256.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..8e62b936b60d94debe9b91103f30eeedc1826712 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/sha256.spec.ts @@ -0,0 +1,50 @@ +import { describe, it, expect } from "vitest"; +import { sha256 } from "./sha256"; + +const smallContent = "hello world"; +const smallContentSHA256 = "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"; +const bigContent = "O123456789".repeat(100_000); +const bigContentSHA256 = "a3bbce7ee1df7233d85b5f4d60faa3755f93f537804f8b540c72b0739239ddf8"; +const biggerContent = "0123456789".repeat(1_000_000); +const biggerContentSHA256 = "d52fcc26b48dbd4d79b125eb0a29b803ade07613c67ac7c6f2751aefef008486"; + +describe("sha256", () => { + async function calcSHA256(content: string, useWebWorker: boolean) { + const iterator = sha256(new Blob([content]), { useWebWorker }); + let res: IteratorResult; + do { + res = await iterator.next(); + } while (!res.done); + return res.value; + } + + it("Calculate hash of a small file", async () => { + const sha = await calcSHA256(smallContent, false); + expect(sha).toBe(smallContentSHA256); + }); + + it("Calculate hash of a big file", async () => { + const sha = await calcSHA256(bigContent, false); + expect(sha).toBe(bigContentSHA256); + }); + + it("Calculate hash of a bigger file", async () => { + const sha = await calcSHA256(biggerContent, false); + expect(sha).toBe(biggerContentSHA256); + }); + + it("Calculate hash of a small file (+ web worker)", async () => { + const sha = await calcSHA256(smallContent, true); + expect(sha).toBe(smallContentSHA256); + }); + + it("Calculate hash of a big file (+ web worker)", async () => { + const sha = await calcSHA256(bigContent, true); + expect(sha).toBe(bigContentSHA256); + }); + + it("Calculate hash of a bigger file (+ web worker)", async () => { + const sha = await calcSHA256(biggerContent, true); + expect(sha).toBe(biggerContentSHA256); + }); +}); diff --git a/node_modules/@huggingface/hub/src/utils/sha256.ts b/node_modules/@huggingface/hub/src/utils/sha256.ts new file mode 100644 index 0000000000000000000000000000000000000000..0458d0495c3489e5f1bebf706282404b128c65dd --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/sha256.ts @@ -0,0 +1,206 @@ +import { eventToGenerator } from "./eventToGenerator"; +import { hexFromBytes } from "./hexFromBytes"; +import { isFrontend } from "./isFrontend"; + +async function getWebWorkerCode() { + const sha256Module = await import("../vendor/hash-wasm/sha256-wrapper"); + return URL.createObjectURL(new Blob([sha256Module.createSHA256WorkerCode()])); +} + +const pendingWorkers: Worker[] = []; +const runningWorkers: Set = new Set(); + +let resolve: () => void; +let waitPromise: Promise = new Promise((r) => { + resolve = r; +}); + +async function getWorker(poolSize?: number): Promise { + { + const worker = pendingWorkers.pop(); + if (worker) { + runningWorkers.add(worker); + return worker; + } + } + if (!poolSize) { + const worker = new Worker(await getWebWorkerCode()); + runningWorkers.add(worker); + return worker; + } + + if (poolSize <= 0) { + throw new TypeError("Invalid webworker pool size: " + poolSize); + } + + while (runningWorkers.size >= poolSize) { + await waitPromise; + } + + const worker = new Worker(await getWebWorkerCode()); + runningWorkers.add(worker); + return worker; +} + +async function freeWorker(worker: Worker, poolSize: number | undefined): Promise { + if (!poolSize) { + return destroyWorker(worker); + } + runningWorkers.delete(worker); + pendingWorkers.push(worker); + const r = resolve; + waitPromise = new Promise((r) => { + resolve = r; + }); + r(); +} + +function destroyWorker(worker: Worker): void { + runningWorkers.delete(worker); + worker.terminate(); + const r = resolve; + waitPromise = new Promise((r) => { + resolve = r; + }); + r(); +} + +/** + * @returns hex-encoded sha + * @yields progress (0-1) + */ +export async function* sha256( + buffer: Blob, + opts?: { useWebWorker?: boolean | { minSize?: number; poolSize?: number }; abortSignal?: AbortSignal }, +): AsyncGenerator { + yield 0; + + const maxCryptoSize = + typeof opts?.useWebWorker === "object" && opts?.useWebWorker.minSize !== undefined + ? opts.useWebWorker.minSize + : 10_000_000; + if (buffer.size < maxCryptoSize && globalThis.crypto?.subtle) { + const res = hexFromBytes( + new Uint8Array( + await globalThis.crypto.subtle.digest("SHA-256", buffer instanceof Blob ? await buffer.arrayBuffer() : buffer), + ), + ); + + yield 1; + + return res; + } + + if (isFrontend) { + if (opts?.useWebWorker) { + try { + const poolSize = typeof opts?.useWebWorker === "object" ? opts.useWebWorker.poolSize : undefined; + const worker = await getWorker(poolSize); + + // Define handlers to allow removal + let messageHandler: (event: MessageEvent) => void; + let errorHandler: (event: ErrorEvent) => void; + + const cleanup = () => { + worker.removeEventListener("message", messageHandler); + worker.removeEventListener("error", errorHandler); + }; + + return yield* eventToGenerator((yieldCallback, returnCallback, rejectCallback) => { + messageHandler = (event: MessageEvent) => { + if (event.data.sha256) { + cleanup(); + freeWorker(worker, poolSize); + returnCallback(event.data.sha256); + } else if (event.data.progress) { + yieldCallback(event.data.progress); + + try { + opts.abortSignal?.throwIfAborted(); + } catch (err) { + cleanup(); + destroyWorker(worker); + rejectCallback(err); + } + } else { + cleanup(); + destroyWorker(worker); + rejectCallback(event); + } + }; + + errorHandler = (event: ErrorEvent) => { + cleanup(); + destroyWorker(worker); + rejectCallback(event.error); + }; + + // Handle external abort signal if it aborts before any worker message + if (opts?.abortSignal) { + try { + opts.abortSignal?.throwIfAborted(); + } catch (err) { + cleanup(); + destroyWorker(worker); + rejectCallback(opts.abortSignal.reason ?? new DOMException("Aborted", "AbortError")); + return; + } + + const abortListener = () => { + cleanup(); + destroyWorker(worker); + + rejectCallback(opts.abortSignal?.reason ?? new DOMException("Aborted", "AbortError")); + opts.abortSignal?.removeEventListener("abort", abortListener); + }; + + opts.abortSignal.addEventListener("abort", abortListener); + } + + worker.addEventListener("message", messageHandler); + worker.addEventListener("error", errorHandler); + worker.postMessage({ file: buffer }); + }); + } catch (err) { + console.warn("Failed to use web worker for sha256", err); + } + } + if (!wasmModule) { + wasmModule = await import("../vendor/hash-wasm/sha256-wrapper"); + } + + const sha256 = await wasmModule.createSHA256(); + sha256.init(); + + const reader = buffer.stream().getReader(); + const total = buffer.size; + let bytesDone = 0; + + while (true) { + const { done, value } = await reader.read(); + + if (done) { + break; + } + + sha256.update(value); + bytesDone += value.length; + yield bytesDone / total; + + opts?.abortSignal?.throwIfAborted(); + } + + return sha256.digest("hex"); + } + + if (!cryptoModule) { + cryptoModule = await import("./sha256-node"); + } + + return yield* cryptoModule.sha256Node(buffer, { abortSignal: opts?.abortSignal }); +} + +// eslint-disable-next-line @typescript-eslint/consistent-type-imports +let cryptoModule: typeof import("./sha256-node"); +// eslint-disable-next-line @typescript-eslint/consistent-type-imports +let wasmModule: typeof import("../vendor/hash-wasm/sha256-wrapper"); diff --git a/node_modules/@huggingface/hub/src/utils/shardParser.spec.ts b/node_modules/@huggingface/hub/src/utils/shardParser.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..c8ace91439f295eaab5a73636e3cb84656dedb11 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/shardParser.spec.ts @@ -0,0 +1,27 @@ +import { parseShardData } from "./shardParser"; +import { readFile } from "fs/promises"; +import { expect, describe, it } from "vitest"; +import { init, compute_hmac } from "../vendor/xet-chunk/chunker_wasm"; + +describe("shardParser", () => { + it("should parse a shard", async () => { + const buffer = await readFile("tests/gpt2-64-8bits.tflite.shard"); + const shard = await parseShardData(new Blob([buffer])); + const expectedJson = JSON.parse(await readFile("tests/gpt2-64-8bits.tflite.shard.json", "utf-8")); + + expect(shard.hmacKey).toBe(expectedJson.hmac_key); + expect(shard.xorbs.length).toEqual(expectedJson.xorbs.length); + for (let i = 0; i < shard.xorbs.length; i++) { + expect(shard.xorbs[i].hash).toEqual(expectedJson.xorbs[i].hash); + expect(shard.xorbs[i].chunks.length).toEqual(expectedJson.xorbs[i].chunk_hashes.length); + for (let j = 0; j < shard.xorbs[i].chunks.length; j++) { + expect(shard.xorbs[i].chunks[j].hash).toEqual(expectedJson.xorbs[i].chunk_hashes[j]); + } + } + + await init(); + + const chunkHash = "9502eec19d4b0c9f7b389228fa801f68ecdf15d69ccd1da2f9ddbd0219898335"; + expect(compute_hmac(chunkHash, shard.hmacKey)).toEqual(shard.xorbs[1].chunks[0].hash); + }); +}); diff --git a/node_modules/@huggingface/hub/src/utils/shardParser.ts b/node_modules/@huggingface/hub/src/utils/shardParser.ts new file mode 100644 index 0000000000000000000000000000000000000000..e1a45d40c9a4474db3b7758b72bf37aa6da67d21 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/shardParser.ts @@ -0,0 +1,149 @@ +import { SHARD_FOOTER_VERSION, SHARD_HEADER_VERSION, SHARD_MAGIC_TAG } from "./uploadShards"; + +const HASH_LENGTH = 32; +const XORB_HASH_BOOKEND = "ff".repeat(HASH_LENGTH); + +// Read 4 uint64 in little endian and convert to hex +function readHashFromArray(array: Uint8Array, offset: number): string { + let hash = ""; + for (let i = 0; i < HASH_LENGTH; i += 8) { + hash += `${array[offset + i + 7].toString(16).padStart(2, "0")}${array[offset + i + 6] + .toString(16) + .padStart(2, "0")}${array[offset + i + 5].toString(16).padStart(2, "0")}${array[offset + i + 4] + .toString(16) + .padStart(2, "0")}${array[offset + i + 3].toString(16).padStart(2, "0")}${array[offset + i + 2] + .toString(16) + .padStart(2, "0")}${array[offset + i + 1].toString(16).padStart(2, "0")}${array[offset + i] + .toString(16) + .padStart(2, "0")}`; + } + return hash; +} + +export interface ShardData { + hmacKey: string; + xorbs: Array<{ + hash: string; + chunks: Array<{ + hash: string; + startOffset: number; + unpackedLength: number; + }>; + }>; +} + +export async function parseShardData(shardBlob: Blob): Promise { + const shard = new Uint8Array(await shardBlob.arrayBuffer()); + const shardView = new DataView(shard.buffer); + + const magicTag = shard.slice(0, SHARD_MAGIC_TAG.length); + if (!magicTag.every((byte, i) => byte === SHARD_MAGIC_TAG[i])) { + throw new Error("Invalid shard magic tag"); + } + + const version = shardView.getBigUint64(SHARD_MAGIC_TAG.length, true); + if (version !== SHARD_HEADER_VERSION) { + throw new Error(`Invalid shard version: ${version}`); + } + + const footerSize = Number(shardView.getBigUint64(SHARD_MAGIC_TAG.length + 8, true)); + + // Read footer to get section offsets + const footerStart = shard.length - footerSize; + const footerVersion = shardView.getBigUint64(footerStart, true); + if (footerVersion !== SHARD_FOOTER_VERSION) { + throw new Error(`Invalid shard footer version: ${footerVersion}`); + } + + // version: u64, // Footer version (must be 1) + // file_info_offset: u64, // Offset to file info section + // cas_info_offset: u64, // Offset to CAS info section + // file_lookup_offset: u64, // Offset to file lookup table + // file_lookup_num_entry: u64, // Number of file lookup entries + // cas_lookup_offset: u64, // Offset to CAS lookup table + // cas_lookup_num_entry: u64, // Number of CAS lookup entries + // chunk_lookup_offset: u64, // Offset to chunk lookup table + // chunk_lookup_num_entry: u64, // Number of chunk lookup entries + // chunk_hash_hmac_key: [u64; 4], // HMAC key for chunk hashes (32 bytes) + // shard_creation_timestamp: u64, // Creation time (seconds since epoch) + // shard_key_expiry: u64, // Expiry time (seconds since epoch) + // _buffer: [u64; 6], // Reserved space (48 bytes) + // stored_bytes_on_disk: u64, // Total bytes stored on disk + // materialized_bytes: u64, // Total materialized bytes + // stored_bytes: u64, // Total stored bytes + // footer_offset: u64, + + // const fileInfoStart = Number(shardView.getBigUint64(footerStart + 8, true)); + const xorbInfoStart = Number(shardView.getBigUint64(footerStart + 16, true)); + const fileLookupStart = Number(shardView.getBigUint64(footerStart + 24, true)); + // const numFileLookups = Number(shardView.getBigUint64(footerStart + 32, true)); + // const xorbLookupStart = Number(shardView.getBigUint64(footerStart + 40, true)); + // const numXorbLookups = Number(shardView.getBigUint64(footerStart + 48, true)); + // const chunkLookupStart = Number(shardView.getBigUint64(footerStart + 56, true)); + // const numChunkLookups = Number(shardView.getBigUint64(footerStart + 64, true)); + const hmacKey = readHashFromArray(shard, footerStart + 72); + // const shardCreationTimestamp = Number(shardView.getBigUint64(footerStart + 104, true)); + // const shardKeyExpiry = Number(shardView.getBigUint64(footerStart + 112, true)); + // const storedBytesOnDisk = Number(shardView.getBigUint64(footerStart + 168, true)); + // const materializedBytes = Number(shardView.getBigUint64(footerStart + 176, true)); + // const storedBytes = Number(shardView.getBigUint64(footerStart + 184, true)); + // const footerOffset = Number(shardView.getBigUint64(footerStart + 192, true)); + + // Parse XORB Info Section + const xorbs: ShardData["xorbs"] = []; + let offset = xorbInfoStart; + + while (offset < fileLookupStart) { + // Read xorb entry + const xorbHash = readHashFromArray(shard, offset); + offset += HASH_LENGTH; + + if (xorbHash === XORB_HASH_BOOKEND) { + break; + } + + // const flags = shardView.getUint32(offset, true); + offset += 4; + + const chunkCount = shardView.getUint32(offset, true); + offset += 4; + + // const numBytesInXorb = shardView.getUint32(offset, true); + offset += 4; + + // const numBytesUnpacked = shardView.getUint32(offset, true); + offset += 4; + + // Read chunks for this xorb + const chunks: ShardData["xorbs"][number]["chunks"] = []; + for (let i = 0; i < chunkCount; i++) { + const chunkHash = readHashFromArray(shard, offset); + offset += HASH_LENGTH; + + const startOffset = shardView.getUint32(offset, true); + offset += 4; + + const length = shardView.getUint32(offset, true); + offset += 4; + + // Skip reserved 8 bytes + offset += 8; + + chunks.push({ + hash: chunkHash, + startOffset, + unpackedLength: length, + }); + } + + xorbs.push({ + hash: xorbHash, + chunks, + }); + } + + return { + hmacKey, + xorbs, + }; +} diff --git a/node_modules/@huggingface/hub/src/utils/splitAsyncGenerator.ts b/node_modules/@huggingface/hub/src/utils/splitAsyncGenerator.ts new file mode 100644 index 0000000000000000000000000000000000000000..b077e9abfcb476a5a5785a113fcf7e1098194daa --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/splitAsyncGenerator.ts @@ -0,0 +1,43 @@ +/** + * Split an async generator into multiple async generators, all drawing from the same source. + */ +export function splitAsyncGenerator(source: AsyncGenerator, n: number): Array> { + if (n <= 0) { + return []; + } + + const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); + + let takenIndex: number | null = null; + const generators: AsyncGenerator[] = []; + let remaining = n; + for (let i = 0; i < n; i++) { + generators.push({ + next: async () => { + while (takenIndex !== null) { + await sleep(1); + } + takenIndex = i; + return source.next().then((r) => { + takenIndex = null; + return r; + }); + }, + return: async () => { + remaining--; + if (remaining === 0) { + return source.return(undefined); + } + return { + done: true, + value: undefined, + }; + }, + throw: async (error) => { + return source.throw(error); + }, + [Symbol.asyncIterator]: () => generators[i], + }); + } + return generators; +} diff --git a/node_modules/@huggingface/hub/src/utils/sub-paths.spec.ts b/node_modules/@huggingface/hub/src/utils/sub-paths.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..6dcb773ab7f106e8bcf1d09751ff01b1e0daceba --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/sub-paths.spec.ts @@ -0,0 +1,39 @@ +import { mkdir, writeFile } from "fs/promises"; +import { tmpdir } from "os"; +import { describe, expect, it } from "vitest"; +import { subPaths } from "./sub-paths"; +import { pathToFileURL } from "url"; + +describe("sub-paths", () => { + it("should retrieve all sub-paths of a directory", async () => { + const tmpDir = tmpdir(); + + await mkdir(`${tmpDir}/test-dir/sub`, { recursive: true }); + + await writeFile(`${tmpDir}/test-dir/sub/file1.txt`, "file1"); + await writeFile(`${tmpDir}/test-dir/sub/file2.txt`, "file2"); + await writeFile(`${tmpDir}/test-dir/file3.txt`, "file3"); + await writeFile(`${tmpDir}/test-dir/file4.txt`, "file4"); + const result = await subPaths(pathToFileURL(`${tmpDir}/test-dir`)); + + expect(result).toEqual([ + { + path: pathToFileURL(`${tmpDir}/test-dir/file3.txt`), + relativePath: "file3.txt", + }, + { + path: pathToFileURL(`${tmpDir}/test-dir/file4.txt`), + relativePath: "file4.txt", + }, + + { + path: pathToFileURL(`${tmpDir}/test-dir/sub/file1.txt`), + relativePath: "sub/file1.txt", + }, + { + path: pathToFileURL(`${tmpDir}/test-dir/sub/file2.txt`), + relativePath: "sub/file2.txt", + }, + ]); + }); +}); diff --git a/node_modules/@huggingface/hub/src/utils/sub-paths.ts b/node_modules/@huggingface/hub/src/utils/sub-paths.ts new file mode 100644 index 0000000000000000000000000000000000000000..c15e73393ad2a78e782e5f6b5eb0d1e37d6e9a6f --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/sub-paths.ts @@ -0,0 +1,38 @@ +import { readdir, stat } from "node:fs/promises"; +import { fileURLToPath, pathToFileURL } from "node:url"; + +/** + * Recursively retrieves all sub-paths of a given directory up to a specified depth. + */ +export async function subPaths( + path: URL, + maxDepth = 10, +): Promise< + Array<{ + path: URL; + relativePath: string; + }> +> { + const state = await stat(path); + if (!state.isDirectory()) { + return [{ path, relativePath: "." }]; + } + + const files = await readdir(path, { withFileTypes: true }); + const ret: Array<{ path: URL; relativePath: string }> = []; + for (const file of files) { + const filePath = pathToFileURL(fileURLToPath(path) + "/" + file.name); + if (file.isDirectory()) { + ret.push( + ...(await subPaths(filePath, maxDepth - 1)).map((subPath) => ({ + ...subPath, + relativePath: `${file.name}/${subPath.relativePath}`, + })), + ); + } else { + ret.push({ path: filePath, relativePath: file.name }); + } + } + + return ret; +} diff --git a/node_modules/@huggingface/hub/src/utils/sum.ts b/node_modules/@huggingface/hub/src/utils/sum.ts new file mode 100644 index 0000000000000000000000000000000000000000..9d3fe6f15960f0f373a4b8669cace09c41c4b02f --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/sum.ts @@ -0,0 +1,6 @@ +/** + * Sum of elements in array + */ +export function sum(arr: number[]): number { + return arr.reduce((a, b) => a + b, 0); +} diff --git a/node_modules/@huggingface/hub/src/utils/symlink.spec.ts b/node_modules/@huggingface/hub/src/utils/symlink.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..56edaf4f33c170389d4799cdec7b9c59686f1a63 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/symlink.spec.ts @@ -0,0 +1,89 @@ +/* eslint-disable @typescript-eslint/consistent-type-imports */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { describe, expect, it, vi } from "vitest"; +import { createSymlink } from "./symlink"; +import { readFileSync, writeFileSync } from "node:fs"; +import { lstat, rm } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; + +let failSymlink = false; +vi.mock("node:fs/promises", async (importOriginal) => ({ + ...(await importOriginal()), + symlink: async (...args: any[]) => { + if (failSymlink) { + failSymlink = false; + throw new Error("Symlink not supported"); + } + + // @ts-expect-error - ignore + return (await importOriginal()).symlink(...args); + }, +})); + +describe("utils/symlink", () => { + it("should create a symlink", async () => { + writeFileSync(join(tmpdir(), "test.txt"), "hello world"); + await createSymlink({ + sourcePath: join(tmpdir(), "test.txt"), + finalPath: join(tmpdir(), "test-symlink.txt"), + }); + + const stats = await lstat(join(tmpdir(), "test-symlink.txt")); + expect(stats.isSymbolicLink()).toBe(process.platform !== "win32"); + + // Test file content + const content = readFileSync(join(tmpdir(), "test-symlink.txt"), "utf8"); + expect(content).toBe("hello world"); + + // Cleanup + await rm(join(tmpdir(), "test-symlink.txt")); + await rm(join(tmpdir(), "test.txt")); + }); + + it("should work when symlinking twice", async () => { + writeFileSync(join(tmpdir(), "test.txt"), "hello world"); + writeFileSync(join(tmpdir(), "test2.txt"), "hello world2"); + await createSymlink({ + sourcePath: join(tmpdir(), "test.txt"), + finalPath: join(tmpdir(), "test-symlink.txt"), + }); + await createSymlink({ + sourcePath: join(tmpdir(), "test2.txt"), + finalPath: join(tmpdir(), "test-symlink.txt"), + }); + + const stats = await lstat(join(tmpdir(), "test-symlink.txt")); + expect(stats.isSymbolicLink()).toBe(process.platform !== "win32"); + + // Test file content + const content = readFileSync(join(tmpdir(), "test-symlink.txt"), "utf8"); + expect(content).toBe("hello world2"); + + // Cleanup + await rm(join(tmpdir(), "test-symlink.txt")); + await rm(join(tmpdir(), "test.txt")); + await rm(join(tmpdir(), "test2.txt")); + }); + + it("should work when symlink doesn't work (windows)", async () => { + writeFileSync(join(tmpdir(), "test.txt"), "hello world"); + + failSymlink = true; + await createSymlink({ + sourcePath: join(tmpdir(), "test.txt"), + finalPath: join(tmpdir(), "test-symlink.txt"), + }); + + const stats = await lstat(join(tmpdir(), "test-symlink.txt")); + expect(stats.isSymbolicLink()).toBe(false); + + // Test file content + const content = readFileSync(join(tmpdir(), "test-symlink.txt"), "utf8"); + expect(content).toBe("hello world"); + + // Cleanup + await rm(join(tmpdir(), "test-symlink.txt")); + await rm(join(tmpdir(), "test.txt")); + }); +}); diff --git a/node_modules/@huggingface/hub/src/utils/symlink.ts b/node_modules/@huggingface/hub/src/utils/symlink.ts new file mode 100644 index 0000000000000000000000000000000000000000..17cedf66ad17629435dcd492238fc9a258068961 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/symlink.ts @@ -0,0 +1,65 @@ +/** + * Heavily inspired by https://github.com/huggingface/huggingface_hub/blob/fcfd14361bd03f23f82efced1aa65a7cbfa4b922/src/huggingface_hub/file_download.py#L517 + */ + +import * as fs from "node:fs/promises"; +import * as path from "node:path"; +import * as os from "node:os"; + +function expandUser(path: string): string { + if (path.startsWith("~")) { + return path.replace("~", os.homedir()); + } + return path; +} + +/** + * Create a symbolic link named dst pointing to src. + * + * By default, it will try to create a symlink using a relative path. Relative paths have 2 advantages: + * - If the cache_folder is moved (example: back-up on a shared drive), relative paths within the cache folder will + * not break. + * - Relative paths seems to be better handled on Windows. Issue was reported 3 times in less than a week when + * changing from relative to absolute paths. See https://github.com/huggingface/huggingface_hub/issues/1398, + * https://github.com/huggingface/diffusers/issues/2729 and https://github.com/huggingface/transformers/pull/22228. + * NOTE: The issue with absolute paths doesn't happen on admin mode. + * When creating a symlink from the cache to a local folder, it is possible that a relative path cannot be created. + * This happens when paths are not on the same volume. In that case, we use absolute paths. + * + * The result layout looks something like + * └── [ 128] snapshots + * ├── [ 128] 2439f60ef33a0d46d85da5001d52aeda5b00ce9f + * │ ├── [ 52] README.md -> ../../../blobs/d7edf6bd2a681fb0175f7735299831ee1b22b812 + * │ └── [ 76] pytorch_model.bin -> ../../../blobs/403450e234d65943a7dcf7e05a771ce3c92faa84dd07db4ac20f592037a1e4bd + * + * If symlinks cannot be created on this platform (most likely to be Windows), the workaround is to avoid symlinks by + * having the actual file in `dst`. If it is a new file (`new_blob=True`), we move it to `dst`. If it is not a new file + * (`new_blob=False`), we don't know if the blob file is already referenced elsewhere. To avoid breaking existing + * cache, the file is duplicated on the disk. + */ +export async function createSymlink(params: { + /** + * The path to the symlink. + */ + finalPath: string; + /** + * The path the symlink should point to. + */ + sourcePath: string; +}): Promise { + const abs_src = path.resolve(expandUser(params.sourcePath)); + const abs_dst = path.resolve(expandUser(params.finalPath)); + + try { + await fs.rm(abs_dst); + } catch { + // ignore + } + + try { + await fs.symlink(path.relative(path.dirname(abs_dst), abs_src), abs_dst); + } catch { + console.info(`Symlink not supported. Copying file from ${abs_src} to ${abs_dst}`); + await fs.copyFile(abs_src, abs_dst); + } +} diff --git a/node_modules/@huggingface/hub/src/utils/toRepoId.ts b/node_modules/@huggingface/hub/src/utils/toRepoId.ts new file mode 100644 index 0000000000000000000000000000000000000000..9b6934f8600520d269244af2017be0cf7a6ee1d1 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/toRepoId.ts @@ -0,0 +1,69 @@ +import type { RepoDesignation, RepoId } from "../types/public"; + +export function toRepoId(repo: RepoDesignation): RepoId { + if (typeof repo !== "string") { + return repo; + } + + if (repo.startsWith("model/") || repo.startsWith("models/")) { + throw new TypeError( + "A repo designation for a model should not start with 'models/', directly specify the model namespace / name", + ); + } + + if (repo.startsWith("space/")) { + throw new TypeError("Spaces should start with 'spaces/', plural, not 'space/'"); + } + + if (repo.startsWith("dataset/")) { + throw new TypeError("Datasets should start with 'datasets/', plural, not 'dataset/'"); + } + + if (repo.startsWith("bucket/")) { + throw new TypeError("Buckets should start with 'buckets/', plural, not 'bucket/'"); + } + + const slashes = repo.split("/").length - 1; + + if (repo.startsWith("spaces/")) { + if (slashes !== 2) { + throw new TypeError("Space Id must include namespace and name of the space"); + } + + return { + type: "space", + name: repo.slice("spaces/".length), + }; + } + + if (repo.startsWith("datasets/")) { + if (slashes > 2) { + throw new TypeError("Too many slashes in repo designation: " + repo); + } + + return { + type: "dataset", + name: repo.slice("datasets/".length), + }; + } + + if (repo.startsWith("buckets/")) { + if (slashes !== 2) { + throw new TypeError("Bucket Id must include namespace and name of the bucket"); + } + + return { + type: "bucket", + name: repo.slice("buckets/".length), + }; + } + + if (slashes > 1) { + throw new TypeError("Too many slashes in repo designation: " + repo); + } + + return { + type: "model", + name: repo, + }; +} diff --git a/node_modules/@huggingface/hub/src/utils/typedEntries.ts b/node_modules/@huggingface/hub/src/utils/typedEntries.ts new file mode 100644 index 0000000000000000000000000000000000000000..031ba7daa0cc381ce650224c040f67261fbd56c3 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/typedEntries.ts @@ -0,0 +1,5 @@ +import type { Entries } from "../vendor/type-fest/entries"; + +export function typedEntries>(obj: T): Entries { + return Object.entries(obj) as Entries; +} diff --git a/node_modules/@huggingface/hub/src/utils/typedInclude.ts b/node_modules/@huggingface/hub/src/utils/typedInclude.ts new file mode 100644 index 0000000000000000000000000000000000000000..71e2f7a7e111995a744589dd34cb090d9743ea16 --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/typedInclude.ts @@ -0,0 +1,3 @@ +export function typedInclude(arr: readonly T[], v: V): v is T { + return arr.includes(v as T); +} diff --git a/node_modules/@huggingface/hub/src/utils/uploadShards.ts b/node_modules/@huggingface/hub/src/utils/uploadShards.ts new file mode 100644 index 0000000000000000000000000000000000000000..5d631a7c6f160935515d563e1d1ecc9ff757abde --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/uploadShards.ts @@ -0,0 +1,428 @@ +import { createApiError } from "../error"; +import type { RepoId } from "../types/public"; +import { createXorbs } from "./createXorbs"; +import { sum } from "./sum"; +import { xetWriteToken } from "./xetWriteToken"; + +const SHARD_MAX_SIZE = 64 * 1024 * 1024; +const SHARD_HEADER_SIZE = 48; +const SHARD_FOOTER_SIZE = 200; +const HASH_LENGTH = 32; +const XORB_FOOTER_LENGTH = 48; +const FILE_FOOTER_LENGTH = 48; +export const SHARD_HEADER_VERSION = 2n; +export const SHARD_FOOTER_VERSION = 1n; + +const MDB_FILE_FLAG_WITH_VERIFICATION = 0x80000000; // Cannot define as 1 << 31 because it becomes a negative number +const MDB_FILE_FLAG_WITH_METADATA_EXT = 0x40000000; + +const EMPTY_HEX_HASH = "0".repeat(HASH_LENGTH * 2); + +export const SHARD_MAGIC_TAG = new Uint8Array([ + "H".charCodeAt(0), + "F".charCodeAt(0), + "R".charCodeAt(0), + "e".charCodeAt(0), + "p".charCodeAt(0), + "o".charCodeAt(0), + "M".charCodeAt(0), + "e".charCodeAt(0), + "t".charCodeAt(0), + "a".charCodeAt(0), + "D".charCodeAt(0), + "a".charCodeAt(0), + "t".charCodeAt(0), + "a".charCodeAt(0), + 0, + 85, + 105, + 103, + 69, + 106, + 123, + 129, + 87, + 131, + 165, + 189, + 217, + 92, + 205, + 209, + 74, + 169, +]); + +export interface XetTokenParams { + sessionId?: string; + casUrl?: string; + accessToken?: string; + expiresAt?: Date; + refreshWriteTokenUrl: string; +} + +interface UploadShardsParams { + accessToken: string | undefined; + hubUrl: string; + xetParams: XetTokenParams; + fetch?: typeof fetch; + repo: RepoId; + rev: string; + isPullRequest?: boolean; + yieldCallback?: (event: { event: "fileProgress"; path: string; progress: number }) => void; +} + +/** + * Outputs the file sha256 after their xorbs/shards have been uploaded. + */ +export async function* uploadShards( + source: AsyncGenerator<{ content: Blob; path: string; sha256?: string }>, + params: UploadShardsParams, +): AsyncGenerator< + | { + event: "file"; + path: string; + xetHash: string; + sha256: string | undefined; + dedupRatio: number; + } + | { event: "fileProgress"; path: string; progress: number } +> { + const xorbHashes: Array = []; + + const fileInfoSection = new Uint8Array(Math.floor(SHARD_MAX_SIZE - SHARD_HEADER_SIZE - SHARD_FOOTER_SIZE) * 0.25); + const xorbInfoSection = new Uint8Array(Math.floor(SHARD_MAX_SIZE - SHARD_HEADER_SIZE - SHARD_FOOTER_SIZE) * 0.75); + + const xorbView = new DataView(xorbInfoSection.buffer); + let xorbViewOffset = 0; + const fileInfoView = new DataView(fileInfoSection.buffer); + let fileViewOffset = 0; + let xorbTotalSize = 0n; + let fileTotalSize = 0n; + let xorbTotalUnpackedSize = 0n; + + for await (const output of createXorbs(source, params)) { + switch (output.event) { + case "xorb": { + xorbHashes.push(output.hash); + + // Calculate space needed for this xorb entry + const xorbEntrySize = HASH_LENGTH + 4 + 4 + 4 + 4; // hash + flags + count + unpacked + packed + const chunksSize = output.chunks.length * (HASH_LENGTH + 4 + 4 + 8); // per chunk: hash + length + offset + reserved + const totalXorbSize = xorbEntrySize + chunksSize; + + // Check if adding this xorb would exceed buffer capacity + if (xorbViewOffset + totalXorbSize > xorbInfoSection.length) { + // Upload current shard and reset buffers + if (xorbViewOffset > 0 || fileViewOffset > 0) { + await uploadShard(createShard(), params); + } + } + + // todo: handle when going out of bounds + writeHashToArray(output.hash, xorbInfoSection, xorbViewOffset); + xorbViewOffset += HASH_LENGTH; + xorbView.setUint32(xorbViewOffset, 0, true); // flags + xorbViewOffset += 4; + xorbView.setUint32(xorbViewOffset, output.chunks.length, true); + xorbViewOffset += 4; + const xorbUnpackedSize = sum(output.chunks.map((x) => x.length)); + xorbView.setUint32(xorbViewOffset, xorbUnpackedSize, true); + xorbTotalUnpackedSize += BigInt(xorbUnpackedSize); + xorbTotalSize += BigInt(output.xorb.byteLength); + xorbViewOffset += 4; + xorbView.setUint32(xorbViewOffset, output.xorb.byteLength, true); + xorbViewOffset += 4; + + let chunkBytes = 0; + for (const chunk of output.chunks) { + writeHashToArray(chunk.hash, xorbInfoSection, xorbViewOffset); + xorbViewOffset += HASH_LENGTH; + // start offset + xorbView.setUint32(xorbViewOffset, chunkBytes, true); + xorbViewOffset += 4; + // chunk length + xorbView.setUint32(xorbViewOffset, chunk.length, true); + xorbViewOffset += 4; + xorbView.setBigUint64(xorbViewOffset, 0n, true); // reserved + xorbViewOffset += 8; + chunkBytes += chunk.length; + } + + for (const file of output.files) { + yield { + event: "fileProgress", + path: file.path, + progress: file.lastSentProgress, + }; + } + + await uploadXorb(output, params); + //^ Todo: queue it and do not await it + + for (const file of output.files) { + yield { event: "fileProgress", path: file.path, progress: file.progress }; + } + break; + } + case "file": { + yield { + event: "file", + path: output.path, + xetHash: output.hash, + sha256: output.sha256, + dedupRatio: output.dedupRatio, + }; // Maybe wait until shard is uploaded before yielding. + + // Calculate space needed for this file entry + const fileHeaderSize = HASH_LENGTH + 4 + 4 + 8; // hash + flags + rep length + reserved + const representationSize = output.representation.length * (HASH_LENGTH + 4 + 4 + 4 + 4); // per rep: xorb hash + flags + length + offset + endOffset + const verificationSize = output.representation.length * (HASH_LENGTH + 16); // per rep: range hash + reserved + const metadataSize = HASH_LENGTH + 16; // sha256 + reserved + const totalFileSize = fileHeaderSize + representationSize + verificationSize + metadataSize; + + // Check if adding this file would exceed buffer capacity + if (fileViewOffset + totalFileSize > fileInfoSection.length) { + // Upload current shard and reset buffers + if (xorbViewOffset > 0 || fileViewOffset > 0) { + await uploadShard(createShard(), params); + } + } + + writeHashToArray(output.hash, fileInfoSection, fileViewOffset); + fileViewOffset += HASH_LENGTH; + // Cannot use | binary operator since it works with int32 not uint32 and one of the flags is 1 << 31 + fileInfoView.setUint32(fileViewOffset, MDB_FILE_FLAG_WITH_METADATA_EXT + MDB_FILE_FLAG_WITH_VERIFICATION, true); + fileViewOffset += 4; + fileInfoView.setUint32(fileViewOffset, output.representation.length, true); + fileViewOffset += 4; + fileInfoView.setBigUint64(fileViewOffset, 0n, true); // reserved + fileViewOffset += 8; + + for (const repItem of output.representation) { + writeHashToArray( + typeof repItem.xorbId === "number" ? xorbHashes[repItem.xorbId] : repItem.xorbId, + fileInfoSection, + fileViewOffset, + ); + fileViewOffset += HASH_LENGTH; + fileInfoView.setUint32(fileViewOffset, 0, true); // Xorb flags + fileViewOffset += 4; + fileInfoView.setUint32(fileViewOffset, repItem.length, true); + fileViewOffset += 4; + fileInfoView.setUint32(fileViewOffset, repItem.indexStart, true); + fileViewOffset += 4; + fileInfoView.setUint32(fileViewOffset, repItem.indexEnd, true); + fileViewOffset += 4; + } + + // File verification data + for (const repItem of output.representation) { + writeHashToArray(repItem.rangeHash, fileInfoSection, fileViewOffset); + fileViewOffset += HASH_LENGTH; + // reserved in file verification data + for (let i = 0; i < 16; i++) { + fileInfoSection[fileViewOffset + i] = 0; + } + fileViewOffset += 16; + } + + // File metadata ext + writeHashToArray(output.sha256 ?? EMPTY_HEX_HASH, fileInfoSection, fileViewOffset); + fileViewOffset += HASH_LENGTH; + + // reserved in file metadata ext + for (let i = 0; i < 16; i++) { + fileInfoSection[fileViewOffset + i] = 0; + } + fileViewOffset += 16; + + break; + } + } + } + + function createShard(): Uint8Array { + const shard = new Uint8Array( + SHARD_HEADER_SIZE + SHARD_FOOTER_SIZE + xorbViewOffset + XORB_FOOTER_LENGTH + fileViewOffset + FILE_FOOTER_LENGTH, + ); + + const shardView = new DataView(shard.buffer); + let shardOffset = 0; + + // Header + shard.set(SHARD_MAGIC_TAG, shardOffset); + shardOffset += SHARD_MAGIC_TAG.length; + + shardView.setBigUint64(shardOffset, SHARD_HEADER_VERSION, true); + shardOffset += 8; + + shardView.setBigUint64(shardOffset, BigInt(SHARD_FOOTER_SIZE), true); + shardOffset += 8; + + // File Info Section + shard.set(fileInfoSection.slice(0, fileViewOffset), shardOffset); + shardOffset += fileViewOffset; + + // File info bookend + for (let i = 0; i < 32; i++) { + shard[shardOffset + i] = 0xff; + } + shardOffset += 32; + for (let i = 0; i < 16; i++) { + shard[shardOffset + i] = 0; + } + shardOffset += 16; + + // XORB Info Section + const xorbInfoOffset = shardOffset; + shard.set(xorbInfoSection.slice(0, xorbViewOffset), shardOffset); + shardOffset += xorbViewOffset; + + // Xorb info bookend + for (let i = 0; i < 32; i++) { + shard[shardOffset + i] = 0xff; + } + shardOffset += 32; + for (let i = 0; i < 16; i++) { + shard[shardOffset + i] = 0; + } + shardOffset += 16; + + // Footer + const footerOffset = shardOffset; + + // version: u64, // Footer version (must be 1) + // file_info_offset: u64, // Offset to file info section + // cas_info_offset: u64, // Offset to CAS info section + // reserved 48 bytes + // chunk_hash_hmac_key: [u64; 4], // HMAC key for chunk hashes (32 bytes) + // shard_creation_timestamp: u64, // Creation time (seconds since epoch) + // shard_key_expiry: u64, // Expiry time (seconds since epoch) + // _buffer: [u64; 6], // Reserved space (48 bytes) + // stored_bytes_on_disk: u64, // Total bytes stored on disk + // materialized_bytes: u64, // Total materialized bytes + // stored_bytes: u64, // Total stored bytes + // footer_offset: u64, + + shardView.setBigUint64(shardOffset, SHARD_FOOTER_VERSION, true); + shardOffset += 8; + shardView.setBigUint64(shardOffset, BigInt(SHARD_HEADER_SIZE), true); // beginning of fileinfo section + shardOffset += 8; + shardView.setBigUint64(shardOffset, BigInt(xorbInfoOffset), true); // beginning of xorbinfo section + shardOffset += 8; + + for (let i = 0; i < 48; i++) { + shardView.setUint8(shardOffset + i, 0); + } + shardOffset += 48; + + // Chunk HMAC + for (let i = 0; i < 32; i++) { + shardView.setUint8(shardOffset + i, 0); + } + shardOffset += 32; + + shardView.setBigUint64(shardOffset, BigInt(Math.floor(Date.now() / 1000)), true); + shardOffset += 8; + + // Shard key expiration + shardView.setBigUint64(shardOffset, 0n, true); + shardOffset += 8; + + // Reserved space (48 bytes) + for (let i = 0; i < 48; i++) { + shardView.setUint8(shardOffset + i, 0); + } + shardOffset += 48; + + shardView.setBigUint64(shardOffset, xorbTotalSize, true); + shardOffset += 8; + + shardView.setBigUint64(shardOffset, fileTotalSize, true); + shardOffset += 8; + + shardView.setBigUint64(shardOffset, xorbTotalUnpackedSize, true); + shardOffset += 8; + + shardView.setBigUint64(shardOffset, BigInt(footerOffset), true); + + xorbViewOffset = 0; + fileViewOffset = 0; + xorbTotalSize = 0n; + xorbTotalUnpackedSize = 0n; + fileTotalSize = 0n; + + return shard; + } + + // If un-uploaded data remains, upload it + if (xorbViewOffset || fileViewOffset) { + await uploadShard(createShard(), params); + } +} + +// Todo: switch from hex to non-hex when WASM switches. For now consider hash is hex +function writeHashToArray(hash: string, array: Uint8Array, offset: number) { + for (let i = 0; i < hash.length; i += 16) { + // Write a uint64 in little endian + array[offset + i / 2] = parseInt(hash.substring(i + 2 * 7, i + 2 * 8), 16); + array[offset + i / 2 + 1] = parseInt(hash.substring(i + 2 * 6, i + 2 * 7), 16); + array[offset + i / 2 + 2] = parseInt(hash.substring(i + 2 * 5, i + 2 * 6), 16); + array[offset + i / 2 + 3] = parseInt(hash.substring(i + 2 * 4, i + 2 * 5), 16); + array[offset + i / 2 + 4] = parseInt(hash.substring(i + 2 * 3, i + 2 * 4), 16); + array[offset + i / 2 + 5] = parseInt(hash.substring(i + 2 * 2, i + 2 * 3), 16); + array[offset + i / 2 + 6] = parseInt(hash.substring(i + 2 * 1, i + 2 * 2), 16); + array[offset + i / 2 + 7] = parseInt(hash.substring(i + 2 * 0, i + 2 * 1), 16); + } +} + +async function uploadXorb( + xorb: { hash: string; xorb: Uint8Array; files: Array<{ path: string; progress: number; lastSentProgress: number }> }, + params: UploadShardsParams, +) { + const token = await xetWriteToken(params); + + const resp = await (params.fetch ?? fetch)(`${token.casUrl}/v1/xorbs/default/${xorb.hash}`, { + method: "POST", + body: xorb.xorb, + headers: { + Authorization: `Bearer ${token.accessToken}`, + ...(params.xetParams.sessionId ? { "X-Xet-Session-Id": params.xetParams.sessionId } : {}), + }, + ...{ + progressHint: { + progressCallback: (progress: number) => { + for (const file of xorb.files) { + params.yieldCallback?.({ + event: "fileProgress", + path: file.path, + progress: file.lastSentProgress + (file.progress - file.lastSentProgress) * progress, + }); + } + }, + }, + }, + }); + + if (!resp.ok) { + throw await createApiError(resp); + } +} + +async function uploadShard(shard: Uint8Array, params: UploadShardsParams) { + const token = await xetWriteToken(params); + + const resp = await (params.fetch ?? fetch)(`${token.casUrl}/v1/shards`, { + method: "POST", + body: shard, + headers: { + Authorization: `Bearer ${token.accessToken}`, + ...(params.xetParams.sessionId ? { "X-Xet-Session-Id": params.xetParams.sessionId } : {}), + }, + }); + + if (!resp.ok) { + throw await createApiError(resp); + } +} diff --git a/node_modules/@huggingface/hub/src/utils/xetWriteToken.ts b/node_modules/@huggingface/hub/src/utils/xetWriteToken.ts new file mode 100644 index 0000000000000000000000000000000000000000..e877dc55ae288c930572fdbac9bfbaff6ae41ace --- /dev/null +++ b/node_modules/@huggingface/hub/src/utils/xetWriteToken.ts @@ -0,0 +1,98 @@ +import { createApiError } from "../error"; +import type { XetTokenParams } from "./uploadShards"; + +export interface XetWriteTokenParams { + accessToken: string | undefined; + fetch?: typeof fetch; + xetParams: XetTokenParams; +} + +const JWT_SAFETY_PERIOD = 60_000; +const JWT_CACHE_SIZE = 1_000; + +const jwtPromises: Map> = new Map(); +/** + * Cache to store JWTs, to avoid making many auth requests when downloading multiple files from the same repo + */ +const jwts: Map< + string, + { + accessToken: string; + expiresAt: Date; + casUrl: string; + } +> = new Map(); + +export async function xetWriteToken(params: XetWriteTokenParams): Promise<{ accessToken: string; casUrl: string }> { + if ( + params.xetParams.expiresAt && + params.xetParams.casUrl && + params.xetParams.accessToken && + params.xetParams.expiresAt > new Date(Date.now() + JWT_SAFETY_PERIOD) + ) { + return { accessToken: params.xetParams.accessToken, casUrl: params.xetParams.casUrl }; + } + const key = params.xetParams.refreshWriteTokenUrl; + + const jwt = jwts.get(key); + + if (jwt && jwt.expiresAt > new Date(Date.now() + JWT_SAFETY_PERIOD)) { + return { accessToken: jwt.accessToken, casUrl: jwt.casUrl }; + } + + // If we already have a promise for this repo, return it + const existingPromise = jwtPromises.get(key); + if (existingPromise) { + return existingPromise; + } + + const promise = (async () => { + const resp = await (params.fetch ?? fetch)(params.xetParams.refreshWriteTokenUrl, { + headers: { + ...(params.accessToken + ? { + Authorization: `Bearer ${params.accessToken}`, + } + : {}), + ...(params.xetParams.sessionId ? { "X-Xet-Session-Id": params.xetParams.sessionId } : {}), + }, + }); + + if (!resp.ok) { + throw await createApiError(resp); + } + + const json: { accessToken: string; casUrl: string; exp: number } = await resp.json(); + const jwt = { + accessToken: json.accessToken, + expiresAt: new Date(json.exp * 1000), + casUrl: json.casUrl, + }; + + jwtPromises.delete(key); + + for (const [key, value] of jwts.entries()) { + if (value.expiresAt < new Date(Date.now() + JWT_SAFETY_PERIOD)) { + jwts.delete(key); + } else { + break; + } + } + if (jwts.size >= JWT_CACHE_SIZE) { + const keyToDelete = jwts.keys().next().value; + if (keyToDelete) { + jwts.delete(keyToDelete); + } + } + jwts.set(key, jwt); + + return { + accessToken: json.accessToken, + casUrl: json.casUrl, + }; + })(); + + jwtPromises.set(key, promise); + + return promise; +} diff --git a/node_modules/@huggingface/hub/src/vendor/hash-wasm/LICENSE b/node_modules/@huggingface/hub/src/vendor/hash-wasm/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..689ccbe872a76ddfeb0196e0e4b9d60d67480220 --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/hash-wasm/LICENSE @@ -0,0 +1,39 @@ +MIT License + +Copyright (c) 2020 Dani Biró + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +Embedded C implementations might use other, similarly permissive licenses. +Check the beginning of the files from the /src directory. + +Special thank you to the authors of original C algorithms: + +- Alexander Peslyak +- Aleksey Kravchenko +- Colin Percival +- Stephan Brumme +- Steve Reid +- Samuel Neves +- Solar Designer +- Project Nayuki +- ARM Limited +- Yanbo Li dreamfly281@gmail.com, goldboar@163.comYanbo Li +- Mark Adler +- Yann Collet diff --git a/node_modules/@huggingface/hub/src/vendor/hash-wasm/build.sh b/node_modules/@huggingface/hub/src/vendor/hash-wasm/build.sh new file mode 100644 index 0000000000000000000000000000000000000000..18424dfbc296bf3418e77fce35fbde5298a4a6a3 --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/hash-wasm/build.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd $CURRENT_PATH + +# Clean up +docker kill hash-wasm-builder +docker rm hash-wasm-builder + +# Start container +docker run -it -d --name hash-wasm-builder emscripten/emsdk:3.1.55 bash + +# Copy & compile +docker exec hash-wasm-builder bash -c "mkdir /source" +docker cp ./sha256.c hash-wasm-builder:/source +docker exec hash-wasm-builder bash -c "\ + cd /source && \ + emcc sha256.c -o sha256.js -msimd128 -sSINGLE_FILE -sMODULARIZE=1 -sENVIRONMENT=web,worker -sEXPORTED_FUNCTIONS=_Hash_Init,_Hash_Update,_Hash_Final,_GetBufferPtr -sFILESYSTEM=0 -fno-rtti -fno-exceptions -O1 -sMODULARIZE=1 -sEXPORT_ES6=1 \ + " +# Patch "_scriptDir" variable +docker exec hash-wasm-builder bash -c "\ + cd /source && \ + sed -i 's\var _scriptDir\var _unused\g' ./sha256.js && \ + sed -i 's\_scriptDir\false\g' ./sha256.js \ + " + +# Copy back compiled file +docker cp hash-wasm-builder:/source/sha256.js . + + +# Clean up +docker kill hash-wasm-builder +docker rm hash-wasm-builder diff --git a/node_modules/@huggingface/hub/src/vendor/hash-wasm/sha256-wrapper.ts b/node_modules/@huggingface/hub/src/vendor/hash-wasm/sha256-wrapper.ts new file mode 100644 index 0000000000000000000000000000000000000000..3a897696ed4af0dc0a03c9b3d968f9b10aab1f23 --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/hash-wasm/sha256-wrapper.ts @@ -0,0 +1,62 @@ +import WasmModule from "./sha256"; + +export async function createSHA256(isInsideWorker = false): Promise<{ + init(): void; + update(data: Uint8Array): void; + digest(method: "hex"): string; +}> { + const BUFFER_MAX_SIZE = 8 * 1024 * 1024; + const wasm: Awaited> = isInsideWorker + ? // @ts-expect-error WasmModule will be populated inside self object + await self["SHA256WasmModule"]() + : await WasmModule(); + const heap = wasm.HEAPU8.subarray(wasm._GetBufferPtr()); + return { + init() { + wasm._Hash_Init(256); + }, + update(data: Uint8Array) { + let byteUsed = 0; + while (byteUsed < data.byteLength) { + const bytesLeft = data.byteLength - byteUsed; + const length = Math.min(bytesLeft, BUFFER_MAX_SIZE); + heap.set(data.subarray(byteUsed, byteUsed + length)); + wasm._Hash_Update(length); + byteUsed += length; + } + }, + digest(method: "hex") { + if (method !== "hex") { + throw new Error("Only digest hex is supported"); + } + wasm._Hash_Final(); + const result = Array.from(heap.slice(0, 32)); + return result.map((b) => b.toString(16).padStart(2, "0")).join(""); + }, + }; +} + +export function createSHA256WorkerCode(): string { + return ` + self.addEventListener('message', async (event) => { + const { file } = event.data; + const sha256 = await self.createSHA256(true); + sha256.init(); + const reader = file.stream().getReader(); + const total = file.size; + let bytesDone = 0; + while (true) { + const { done, value } = await reader.read(); + if (done) { + break; + } + sha256.update(value); + bytesDone += value.length; + postMessage({ progress: bytesDone / total }); + } + postMessage({ sha256: sha256.digest('hex') }); + }); + self.SHA256WasmModule = ${WasmModule.toString()}; + self.createSHA256 = ${createSHA256.toString()}; + `; +} diff --git a/node_modules/@huggingface/hub/src/vendor/hash-wasm/sha256.c b/node_modules/@huggingface/hub/src/vendor/hash-wasm/sha256.c new file mode 100644 index 0000000000000000000000000000000000000000..b8c0cb7eaf322cb4f74c42908f2d2542e5894233 --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/hash-wasm/sha256.c @@ -0,0 +1,432 @@ +/* sha256.c - an implementation of SHA-256/224 hash functions + * based on FIPS 180-3 (Federal Information Processing Standart). + * + * Copyright (c) 2010, Aleksey Kravchenko + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + + * Modified for hash-wasm by Dani Biró + */ + +#define WITH_BUFFER + + +////////////////////////////////////////////////////////////////////////// + +#include +#include + +#ifndef NULL +#define NULL 0 +#endif + +#ifdef _MSC_VER +#define WASM_EXPORT +#define __inline__ +#else +#define WASM_EXPORT __attribute__((visibility("default"))) +#endif + +#ifdef WITH_BUFFER + +#define MAIN_BUFFER_SIZE 8 * 1024 * 1024 +alignas(128) uint8_t main_buffer[MAIN_BUFFER_SIZE]; + +WASM_EXPORT +uint8_t *Hash_GetBuffer() { + return main_buffer; +} + +#endif + +// Sometimes LLVM emits these functions during the optimization step +// even with -nostdlib -fno-builtin flags +static __inline__ void* memcpy(void* dst, const void* src, uint32_t cnt) { + uint8_t *destination = dst; + const uint8_t *source = src; + while (cnt) { + *(destination++)= *(source++); + --cnt; + } + return dst; +} + +static __inline__ void* memset(void* dst, const uint8_t value, uint32_t cnt) { + uint8_t *p = dst; + while (cnt--) { + *p++ = value; + } + return dst; +} + +static __inline__ void* memcpy2(void* dst, const void* src, uint32_t cnt) { + uint64_t *destination64 = dst; + const uint64_t *source64 = src; + while (cnt >= 8) { + *(destination64++)= *(source64++); + cnt -= 8; + } + + uint8_t *destination = (uint8_t*)destination64; + const uint8_t *source = (uint8_t*)source64; + while (cnt) { + *(destination++)= *(source++); + --cnt; + } + return dst; +} + +static __inline__ void memcpy16(void* dst, const void* src) { + uint64_t* dst64 = (uint64_t*)dst; + uint64_t* src64 = (uint64_t*)src; + + dst64[0] = src64[0]; + dst64[1] = src64[1]; +} + +static __inline__ void memcpy32(void* dst, const void* src) { + uint64_t* dst64 = (uint64_t*)dst; + uint64_t* src64 = (uint64_t*)src; + + #pragma clang loop unroll(full) + for (int i = 0; i < 4; i++) { + dst64[i] = src64[i]; + } +} + +static __inline__ void memcpy64(void* dst, const void* src) { + uint64_t* dst64 = (uint64_t*)dst; + uint64_t* src64 = (uint64_t*)src; + + #pragma clang loop unroll(full) + for (int i = 0; i < 8; i++) { + dst64[i] = src64[i]; + } +} + +static __inline__ uint64_t widen8to64(const uint8_t value) { + return value | (value << 8) | (value << 16) | (value << 24); +} + +static __inline__ void memset16(void* dst, const uint8_t value) { + uint64_t val = widen8to64(value); + uint64_t* dst64 = (uint64_t*)dst; + + dst64[0] = val; + dst64[1] = val; +} + +static __inline__ void memset32(void* dst, const uint8_t value) { + uint64_t val = widen8to64(value); + uint64_t* dst64 = (uint64_t*)dst; + + #pragma clang loop unroll(full) + for (int i = 0; i < 4; i++) { + dst64[i] = val; + } +} + +static __inline__ void memset64(void* dst, const uint8_t value) { + uint64_t val = widen8to64(value); + uint64_t* dst64 = (uint64_t*)dst; + + #pragma clang loop unroll(full) + for (int i = 0; i < 8; i++) { + dst64[i] = val; + } +} + +static __inline__ void memset128(void* dst, const uint8_t value) { + uint64_t val = widen8to64(value); + uint64_t* dst64 = (uint64_t*)dst; + + #pragma clang loop unroll(full) + for (int i = 0; i < 16; i++) { + dst64[i] = val; + } +} + + +////////////////////////////////////////////////////////////////////////// + +#define sha256_block_size 64 +#define sha256_hash_size 32 +#define sha224_hash_size 28 +#define ROTR32(dword, n) ((dword) >> (n) ^ ((dword) << (32 - (n)))) +#define bswap_32(x) __builtin_bswap32(x) + +struct sha256_ctx { + uint32_t message[16]; /* 512-bit buffer for leftovers */ + uint64_t length; /* number of processed bytes */ + uint32_t hash[8]; /* 256-bit algorithm internal hashing state */ + uint32_t digest_length; /* length of the algorithm digest in bytes */ +}; + +struct sha256_ctx sctx; +struct sha256_ctx* ctx = &sctx; + +/* SHA-224 and SHA-256 constants for 64 rounds. These words represent + * the first 32 bits of the fractional parts of the cube + * roots of the first 64 prime numbers. */ +static const uint32_t rhash_k256[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, + 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, + 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, + 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, + 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, + 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +/* The SHA256/224 functions defined by FIPS 180-3, 4.1.2 */ +/* Optimized version of Ch(x,y,z)=((x & y) | (~x & z)) */ +#define Ch(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +/* Optimized version of Maj(x,y,z)=((x & y) ^ (x & z) ^ (y & z)) */ +#define Maj(x, y, z) (((x) & (y)) ^ ((z) & ((x) ^ (y)))) + +#define Sigma0(x) (ROTR32((x), 2) ^ ROTR32((x), 13) ^ ROTR32((x), 22)) +#define Sigma1(x) (ROTR32((x), 6) ^ ROTR32((x), 11) ^ ROTR32((x), 25)) +#define sigma0(x) (ROTR32((x), 7) ^ ROTR32((x), 18) ^ ((x) >> 3)) +#define sigma1(x) (ROTR32((x), 17) ^ ROTR32((x), 19) ^ ((x) >> 10)) + +/* Recalculate element n-th of circular buffer W using formula + * W[n] = sigma1(W[n - 2]) + W[n - 7] + sigma0(W[n - 15]) + W[n - 16]; */ +#define RECALCULATE_W(W, n) \ + (W[n] += \ + (sigma1(W[(n - 2) & 15]) + W[(n - 7) & 15] + sigma0(W[(n - 15) & 15]))) + +#define ROUND(a, b, c, d, e, f, g, h, k, data) \ + { \ + uint32_t T1 = h + Sigma1(e) + Ch(e, f, g) + k + (data); \ + d += T1, h = T1 + Sigma0(a) + Maj(a, b, c); \ + } +#define ROUND_1_16(a, b, c, d, e, f, g, h, n) \ + ROUND(a, b, c, d, e, f, g, h, rhash_k256[n], W[n] = bswap_32(block[n])) +#define ROUND_17_64(a, b, c, d, e, f, g, h, n) \ + ROUND(a, b, c, d, e, f, g, h, k[n], RECALCULATE_W(W, n)) + +/** + * Initialize context before calculaing hash. + * + */ +void sha256_init() { + /* Initial values. These words were obtained by taking the first 32 + * bits of the fractional parts of the square roots of the first + * eight prime numbers. */ + static const uint32_t SHA256_H0[8] = { + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 + }; + + ctx->length = 0; + ctx->digest_length = sha256_hash_size; + + /* initialize algorithm state */ + + #pragma clang loop vectorize(enable) + for (uint8_t i = 0; i < 8; i += 2) { + *(uint64_t*)&ctx->hash[i] = *(uint64_t*)&SHA256_H0[i]; + } +} + +/** + * Initialize context before calculaing hash. + * + */ +void sha224_init() { + /* Initial values from FIPS 180-3. These words were obtained by taking + * bits from 33th to 64th of the fractional parts of the square + * roots of ninth through sixteenth prime numbers. */ + static const uint32_t SHA224_H0[8] = { + 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, + 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 + }; + + ctx->length = 0; + ctx->digest_length = sha224_hash_size; + + #pragma clang loop vectorize(enable) + for (uint8_t i = 0; i < 8; i += 2) { + *(uint64_t*)&ctx->hash[i] = *(uint64_t*)&SHA224_H0[i]; + } +} + +/** + * The core transformation. Process a 512-bit block. + * + * @param hash algorithm state + * @param block the message block to process + */ +static void sha256_process_block(uint32_t hash[8], uint32_t block[16]) { + uint32_t A, B, C, D, E, F, G, H; + uint32_t W[16]; + const uint32_t* k; + int i; + + A = hash[0], B = hash[1], C = hash[2], D = hash[3]; + E = hash[4], F = hash[5], G = hash[6], H = hash[7]; + + /* Compute SHA using alternate Method: FIPS 180-3 6.1.3 */ + ROUND_1_16(A, B, C, D, E, F, G, H, 0); + ROUND_1_16(H, A, B, C, D, E, F, G, 1); + ROUND_1_16(G, H, A, B, C, D, E, F, 2); + ROUND_1_16(F, G, H, A, B, C, D, E, 3); + ROUND_1_16(E, F, G, H, A, B, C, D, 4); + ROUND_1_16(D, E, F, G, H, A, B, C, 5); + ROUND_1_16(C, D, E, F, G, H, A, B, 6); + ROUND_1_16(B, C, D, E, F, G, H, A, 7); + ROUND_1_16(A, B, C, D, E, F, G, H, 8); + ROUND_1_16(H, A, B, C, D, E, F, G, 9); + ROUND_1_16(G, H, A, B, C, D, E, F, 10); + ROUND_1_16(F, G, H, A, B, C, D, E, 11); + ROUND_1_16(E, F, G, H, A, B, C, D, 12); + ROUND_1_16(D, E, F, G, H, A, B, C, 13); + ROUND_1_16(C, D, E, F, G, H, A, B, 14); + ROUND_1_16(B, C, D, E, F, G, H, A, 15); + + #pragma clang loop vectorize(enable) + for (i = 16, k = &rhash_k256[16]; i < 64; i += 16, k += 16) { + ROUND_17_64(A, B, C, D, E, F, G, H, 0); + ROUND_17_64(H, A, B, C, D, E, F, G, 1); + ROUND_17_64(G, H, A, B, C, D, E, F, 2); + ROUND_17_64(F, G, H, A, B, C, D, E, 3); + ROUND_17_64(E, F, G, H, A, B, C, D, 4); + ROUND_17_64(D, E, F, G, H, A, B, C, 5); + ROUND_17_64(C, D, E, F, G, H, A, B, 6); + ROUND_17_64(B, C, D, E, F, G, H, A, 7); + ROUND_17_64(A, B, C, D, E, F, G, H, 8); + ROUND_17_64(H, A, B, C, D, E, F, G, 9); + ROUND_17_64(G, H, A, B, C, D, E, F, 10); + ROUND_17_64(F, G, H, A, B, C, D, E, 11); + ROUND_17_64(E, F, G, H, A, B, C, D, 12); + ROUND_17_64(D, E, F, G, H, A, B, C, 13); + ROUND_17_64(C, D, E, F, G, H, A, B, 14); + ROUND_17_64(B, C, D, E, F, G, H, A, 15); + } + + hash[0] += A, hash[1] += B, hash[2] += C, hash[3] += D; + hash[4] += E, hash[5] += F, hash[6] += G, hash[7] += H; +} + +/** + * Calculate message hash. + * Can be called repeatedly with chunks of the message to be hashed. + * + * @param size length of the message chunk + */ +WASM_EXPORT +void Hash_Update(uint32_t size) { + const uint8_t* msg = main_buffer; + uint32_t index = (uint32_t)ctx->length & 63; + ctx->length += size; + + /* fill partial block */ + if (index) { + uint32_t left = sha256_block_size - index; + uint32_t end = size < left ? size : left; + uint8_t* message8 = (uint8_t*)ctx->message; + for (uint8_t i = 0; i < end; i++) { + *(message8 + index + i) = msg[i]; + } + if (size < left) return; + + /* process partial block */ + sha256_process_block(ctx->hash, (uint32_t*)ctx->message); + msg += left; + size -= left; + } + + while (size >= sha256_block_size) { + uint32_t* aligned_message_block = (uint32_t*)msg; + + sha256_process_block(ctx->hash, aligned_message_block); + msg += sha256_block_size; + size -= sha256_block_size; + } + + if (size) { + /* save leftovers */ + for (uint8_t i = 0; i < size; i++) { + *(((uint8_t*)ctx->message) + i) = msg[i]; + } + } +} + +/** + * Store calculated hash into the given array. + * + */ +WASM_EXPORT +void Hash_Final() { + uint32_t index = ((uint32_t)ctx->length & 63) >> 2; + uint32_t shift = ((uint32_t)ctx->length & 3) * 8; + + /* pad message and run for last block */ + + /* append the byte 0x80 to the message */ + ctx->message[index] &= ~(0xFFFFFFFFu << shift); + ctx->message[index++] ^= 0x80u << shift; + + /* if no room left in the message to store 64-bit message length */ + if (index > 14) { + /* then fill the rest with zeros and process it */ + while (index < 16) { + ctx->message[index++] = 0; + } + sha256_process_block(ctx->hash, ctx->message); + index = 0; + } + + while (index < 14) { + ctx->message[index++] = 0; + } + + ctx->message[14] = bswap_32((uint32_t)(ctx->length >> 29)); + ctx->message[15] = bswap_32((uint32_t)(ctx->length << 3)); + sha256_process_block(ctx->hash, ctx->message); + + #pragma clang loop vectorize(enable) + for (int32_t i = 7; i >= 0; i--) { + ctx->hash[i] = bswap_32(ctx->hash[i]); + } + + for (uint8_t i = 0; i < ctx->digest_length; i++) { + main_buffer[i] = *(((uint8_t*)ctx->hash) + i); + } +} + +WASM_EXPORT +uint32_t Hash_Init(uint32_t bits) { + if (bits == 224) { + sha224_init(); + } else { + sha256_init(); + } + return 0; +} + +WASM_EXPORT +const uint32_t STATE_SIZE = sizeof(*ctx); + +WASM_EXPORT +uint8_t* Hash_GetState() { + return (uint8_t*) ctx; +} + +WASM_EXPORT +uint32_t GetBufferPtr() { + return (uint32_t) main_buffer; +} diff --git a/node_modules/@huggingface/hub/src/vendor/hash-wasm/sha256.d.ts b/node_modules/@huggingface/hub/src/vendor/hash-wasm/sha256.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b6d0f51481360ced2c39d6140091d7da6681f150 --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/hash-wasm/sha256.d.ts @@ -0,0 +1,8 @@ +declare function Module(): Promise<{ + HEAPU8: Uint8Array; + _Hash_Init(type: number): void; + _Hash_Update(length: number): void; + _Hash_Final(): void; + _GetBufferPtr(): number; +}>; +export default Module; diff --git a/node_modules/@huggingface/hub/src/vendor/hash-wasm/sha256.js b/node_modules/@huggingface/hub/src/vendor/hash-wasm/sha256.js new file mode 100644 index 0000000000000000000000000000000000000000..7ff85e582d49404ba7565cef5428115398baac3f --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/hash-wasm/sha256.js @@ -0,0 +1,685 @@ + +var Module = (() => { + var _unused = import.meta.url; + + return ( +function(moduleArg = {}) { + +// include: shell.js +// The Module object: Our interface to the outside world. We import +// and export values on it. There are various ways Module can be used: +// 1. Not defined. We create it here +// 2. A function parameter, function(Module) { ..generated code.. } +// 3. pre-run appended it, var Module = {}; ..generated code.. +// 4. External script tag defines var Module. +// We need to check if Module already exists (e.g. case 3 above). +// Substitution will be replaced with actual code on later stage of the build, +// this way Closure Compiler will not mangle it (e.g. case 4. above). +// Note that if you want to run closure, and also to use Module +// after the generated code, you will need to define var Module = {}; +// before the code. Then that object will be used in the code, and you +// can continue to use Module afterwards as well. +var Module = moduleArg; + +// Set up the promise that indicates the Module is initialized +var readyPromiseResolve, readyPromiseReject; +Module['ready'] = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; +}); + +// --pre-jses are emitted after the Module integration code, so that they can +// refer to Module (if they choose; they can also define Module) + + +// Sometimes an existing Module object exists with properties +// meant to overwrite the default module functionality. Here +// we collect those properties and reapply _after_ we configure +// the current environment's defaults to avoid having to be so +// defensive during initialization. +var moduleOverrides = Object.assign({}, Module); + +var arguments_ = []; +var thisProgram = './this.program'; +var quit_ = (status, toThrow) => { + throw toThrow; +}; + +// Determine the runtime environment we are in. You can customize this by +// setting the ENVIRONMENT setting at compile time (see settings.js). + +// Attempt to auto-detect the environment +var ENVIRONMENT_IS_WEB = typeof window == 'object'; +var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function'; +// N.b. Electron.js environment is simultaneously a NODE-environment, but +// also a web environment. +var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string'; +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +// `/` should be present at the end if `scriptDirectory` is not empty +var scriptDirectory = ''; +function locateFile(path) { + if (Module['locateFile']) { + return Module['locateFile'](path, scriptDirectory); + } + return scriptDirectory + path; +} + +// Hooks that are implemented differently in different runtime environments. +var read_, + readAsync, + readBinary; + +// Note that this includes Node.js workers when relevant (pthreads is enabled). +// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and +// ENVIRONMENT_IS_NODE. +if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { // Check worker, not web, since window could be polyfilled + scriptDirectory = self.location.href; + } else if (typeof document != 'undefined' && document.currentScript) { // web + scriptDirectory = document.currentScript.src; + } + // When MODULARIZE, this JS may be executed later, after document.currentScript + // is gone, so we saved it, and we use it here instead of any other info. + if (false) { + scriptDirectory = false; + } + // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them. + // otherwise, slice off the final part of the url to find the script directory. + // if scriptDirectory does not contain a slash, lastIndexOf will return -1, + // and scriptDirectory will correctly be replaced with an empty string. + // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #), + // they are removed because they could contain a slash. + if (scriptDirectory.startsWith('blob:')) { + scriptDirectory = ''; + } else { + scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, '').lastIndexOf('/')+1); + } + + // Differentiate the Web Worker from the Node Worker case, as reading must + // be done differently. + { +// include: web_or_worker_shell_read.js +read_ = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + xhr.send(null); + return xhr.responseText; + } + + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + xhr.responseType = 'arraybuffer'; + xhr.send(null); + return new Uint8Array(/** @type{!ArrayBuffer} */(xhr.response)); + }; + } + + readAsync = (url, onload, onerror) => { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'arraybuffer'; + xhr.onload = () => { + if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0 + onload(xhr.response); + return; + } + onerror(); + }; + xhr.onerror = onerror; + xhr.send(null); + } + +// end include: web_or_worker_shell_read.js + } +} else +{ +} + +var out = Module['print'] || console.log.bind(console); +var err = Module['printErr'] || console.error.bind(console); + +// Merge back in the overrides +Object.assign(Module, moduleOverrides); +// Free the object hierarchy contained in the overrides, this lets the GC +// reclaim data used. +moduleOverrides = null; + +// Emit code to handle expected values on the Module object. This applies Module.x +// to the proper local x. This has two benefits: first, we only emit it if it is +// expected to arrive, and second, by using a local everywhere else that can be +// minified. + +if (Module['arguments']) arguments_ = Module['arguments']; + +if (Module['thisProgram']) thisProgram = Module['thisProgram']; + +if (Module['quit']) quit_ = Module['quit']; + +// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message +// end include: shell.js + +// include: preamble.js +// === Preamble library stuff === + +// Documentation for the public APIs defined in this file must be updated in: +// site/source/docs/api_reference/preamble.js.rst +// A prebuilt local version of the documentation is available at: +// site/build/text/docs/api_reference/preamble.js.txt +// You can also build docs locally as HTML or other formats in site/ +// An online HTML version (which may be of a different version of Emscripten) +// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html + +var wasmBinary; +if (Module['wasmBinary']) wasmBinary = Module['wasmBinary']; + +if (typeof WebAssembly != 'object') { + abort('no native wasm support detected'); +} + +// include: base64Utils.js +// Converts a string of base64 into a byte array (Uint8Array). +function intArrayFromBase64(s) { + + var decoded = atob(s); + var bytes = new Uint8Array(decoded.length); + for (var i = 0 ; i < decoded.length ; ++i) { + bytes[i] = decoded.charCodeAt(i); + } + return bytes; +} + +// If filename is a base64 data URI, parses and returns data (Buffer on node, +// Uint8Array otherwise). If filename is not a base64 data URI, returns undefined. +function tryParseAsDataURI(filename) { + if (!isDataURI(filename)) { + return; + } + + return intArrayFromBase64(filename.slice(dataURIPrefix.length)); +} +// end include: base64Utils.js +// Wasm globals + +var wasmMemory; + +//======================================== +// Runtime essentials +//======================================== + +// whether we are quitting the application. no code should run after this. +// set in exit() and abort() +var ABORT = false; + +// set by exit() and abort(). Passed to 'onExit' handler. +// NOTE: This is also used as the process return code code in shell environments +// but only when noExitRuntime is false. +var EXITSTATUS; + +// In STRICT mode, we only define assert() when ASSERTIONS is set. i.e. we +// don't define it at all in release modes. This matches the behaviour of +// MINIMAL_RUNTIME. +// TODO(sbc): Make this the default even without STRICT enabled. +/** @type {function(*, string=)} */ +function assert(condition, text) { + if (!condition) { + // This build was created without ASSERTIONS defined. `assert()` should not + // ever be called in this configuration but in case there are callers in + // the wild leave this simple abort() implementation here for now. + abort(text); + } +} + +// Memory management + +var HEAP, +/** @type {!Int8Array} */ + HEAP8, +/** @type {!Uint8Array} */ + HEAPU8, +/** @type {!Int16Array} */ + HEAP16, +/** @type {!Uint16Array} */ + HEAPU16, +/** @type {!Int32Array} */ + HEAP32, +/** @type {!Uint32Array} */ + HEAPU32, +/** @type {!Float32Array} */ + HEAPF32, +/** @type {!Float64Array} */ + HEAPF64; + +// include: runtime_shared.js +function updateMemoryViews() { + var b = wasmMemory.buffer; + Module['HEAP8'] = HEAP8 = new Int8Array(b); + Module['HEAP16'] = HEAP16 = new Int16Array(b); + Module['HEAPU8'] = HEAPU8 = new Uint8Array(b); + Module['HEAPU16'] = HEAPU16 = new Uint16Array(b); + Module['HEAP32'] = HEAP32 = new Int32Array(b); + Module['HEAPU32'] = HEAPU32 = new Uint32Array(b); + Module['HEAPF32'] = HEAPF32 = new Float32Array(b); + Module['HEAPF64'] = HEAPF64 = new Float64Array(b); +} +// end include: runtime_shared.js +// include: runtime_stack_check.js +// end include: runtime_stack_check.js +// include: runtime_assertions.js +// end include: runtime_assertions.js +var __ATPRERUN__ = []; // functions called before the runtime is initialized +var __ATINIT__ = []; // functions called during startup +var __ATEXIT__ = []; // functions called during shutdown +var __ATPOSTRUN__ = []; // functions called after the main() is called + +var runtimeInitialized = false; + +function preRun() { + if (Module['preRun']) { + if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']]; + while (Module['preRun'].length) { + addOnPreRun(Module['preRun'].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); +} + +function initRuntime() { + runtimeInitialized = true; + + + callRuntimeCallbacks(__ATINIT__); +} + +function postRun() { + + if (Module['postRun']) { + if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']]; + while (Module['postRun'].length) { + addOnPostRun(Module['postRun'].shift()); + } + } + + callRuntimeCallbacks(__ATPOSTRUN__); +} + +function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); +} + +function addOnInit(cb) { + __ATINIT__.unshift(cb); +} + +function addOnExit(cb) { +} + +function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); +} + +// include: runtime_math.js +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc + +// end include: runtime_math.js +// A counter of dependencies for calling run(). If we need to +// do asynchronous work before running, increment this and +// decrement it. Incrementing must happen in a place like +// Module.preRun (used by emcc to add file preloading). +// Note that you can add dependencies in preRun, even though +// it happens right before run - run will be postponed until +// the dependencies are met. +var runDependencies = 0; +var runDependencyWatcher = null; +var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled + +function getUniqueRunDependency(id) { + return id; +} + +function addRunDependency(id) { + runDependencies++; + + Module['monitorRunDependencies']?.(runDependencies); + +} + +function removeRunDependency(id) { + runDependencies--; + + Module['monitorRunDependencies']?.(runDependencies); + + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); // can add another dependenciesFulfilled + } + } +} + +/** @param {string|number=} what */ +function abort(what) { + Module['onAbort']?.(what); + + what = 'Aborted(' + what + ')'; + // TODO(sbc): Should we remove printing and leave it up to whoever + // catches the exception? + err(what); + + ABORT = true; + EXITSTATUS = 1; + + what += '. Build with -sASSERTIONS for more info.'; + + // Use a wasm runtime error, because a JS error might be seen as a foreign + // exception, which means we'd run destructors on it. We need the error to + // simply make the program stop. + // FIXME This approach does not work in Wasm EH because it currently does not assume + // all RuntimeErrors are from traps; it decides whether a RuntimeError is from + // a trap or not based on a hidden field within the object. So at the moment + // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that + // allows this in the wasm spec. + + // Suppress closure compiler warning here. Closure compiler's builtin extern + // definition for WebAssembly.RuntimeError claims it takes no arguments even + // though it can. + // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed. + /** @suppress {checkTypes} */ + var e = new WebAssembly.RuntimeError(what); + + readyPromiseReject(e); + // Throw the error whether or not MODULARIZE is set because abort is used + // in code paths apart from instantiation where an exception is expected + // to be thrown when abort is called. + throw e; +} + +// include: memoryprofiler.js +// end include: memoryprofiler.js +// include: URIUtils.js +// Prefix of data URIs emitted by SINGLE_FILE and related options. +var dataURIPrefix = 'data:application/octet-stream;base64,'; + +/** + * Indicates whether filename is a base64 data URI. + * @noinline + */ +var isDataURI = (filename) => filename.startsWith(dataURIPrefix); + +/** + * Indicates whether filename is delivered via file protocol (as opposed to http/https) + * @noinline + */ +var isFileURI = (filename) => filename.startsWith('file://'); +// end include: URIUtils.js +// include: runtime_exceptions.js +// end include: runtime_exceptions.js +var wasmBinaryFile; + wasmBinaryFile = 'data:application/octet-stream;base64,AGFzbQEAAAABHQZgAX8AYAABf2AAAGABfwF/YAJ/fwBgA39/fwF/Aw0MAgAEAgMBBQABAQADBAUBcAEBAQUGAQGAAoACBg4CfwFB8IuEBAt/AUEACweYAQoGbWVtb3J5AgARX193YXNtX2NhbGxfY3RvcnMAAAtIYXNoX1VwZGF0ZQABCkhhc2hfRmluYWwAAwlIYXNoX0luaXQABAxHZXRCdWZmZXJQdHIABRlfX2luZGlyZWN0X2Z1bmN0aW9uX3RhYmxlAQAJc3RhY2tTYXZlAAkMc3RhY2tSZXN0b3JlAAoKc3RhY2tBbGxvYwALCossDAIAC+4CAgV/AX5BACgCwAoiASABKQNAIgYgAK18NwNAAkACQAJAIAanQT9xIgINAEGACyEBIAAhAgwBC0HAACACayEDAkAgAE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R77vxp3BD8yhDCRvLOktqoR0StypsFzaiPl2UlE+mG3GMajIJwOwx39Zv/ML4MZHkafVUWPKBmcpKRSFCrcnOCEbLvxtLE0TDThTVHMKZbsKanYuycKBhSxykqHov6JLZhqocItLwqNRbMcZ6JLRJAaZ1oU1DvRwoGoQFsGkGQhsNx5Md0gntbywNLMMHDlKqthOT8qcW/NvLmjugo90b2OleBR4yIQIAseM+v++kOtsUKT3o/m+8nhxxgBBwAoLBIAFgAA='; + if (!isDataURI(wasmBinaryFile)) { + wasmBinaryFile = locateFile(wasmBinaryFile); + } + +function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + var binary = tryParseAsDataURI(file); + if (binary) { + return binary; + } + if (readBinary) { + return readBinary(file); + } + throw 'both async and sync fetching of the wasm failed'; +} + +function getBinaryPromise(binaryFile) { + + // Otherwise, getBinarySync should be able to get it synchronously + return Promise.resolve().then(() => getBinarySync(binaryFile)); +} + +function instantiateArrayBuffer(binaryFile, imports, receiver) { + return getBinaryPromise(binaryFile).then((binary) => { + return WebAssembly.instantiate(binary, imports); + }).then(receiver, (reason) => { + err(`failed to asynchronously prepare wasm: ${reason}`); + + abort(reason); + }); +} + +function instantiateAsync(binary, binaryFile, imports, callback) { + return instantiateArrayBuffer(binaryFile, imports, callback); +} + +// Create the wasm instance. +// Receives the wasm imports, returns the exports. +function createWasm() { + // prepare imports + var info = { + 'env': wasmImports, + 'wasi_snapshot_preview1': wasmImports, + }; + // Load the wasm module and create an instance of using native support in the JS engine. + // handle a generated wasm instance, receiving its exports and + // performing other necessary setup + /** @param {WebAssembly.Module=} module*/ + function receiveInstance(instance, module) { + wasmExports = instance.exports; + + + + wasmMemory = wasmExports['memory']; + + updateMemoryViews(); + + addOnInit(wasmExports['__wasm_call_ctors']); + + removeRunDependency('wasm-instantiate'); + return wasmExports; + } + // wait for the pthread pool (if any) + addRunDependency('wasm-instantiate'); + + // Prefer streaming instantiation if available. + function receiveInstantiationResult(result) { + // 'result' is a ResultObject object which has both the module and instance. + // receiveInstance() will swap in the exports (to Module.asm) so they can be called + // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line. + // When the regression is fixed, can restore the above PTHREADS-enabled path. + receiveInstance(result['instance']); + } + + // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback + // to manually instantiate the Wasm module themselves. This allows pages to + // run the instantiation parallel to any other async startup actions they are + // performing. + // Also pthreads and wasm workers initialize the wasm instance through this + // path. + if (Module['instantiateWasm']) { + + try { + return Module['instantiateWasm'](info, receiveInstance); + } catch(e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + // If instantiation fails, reject the module ready promise. + readyPromiseReject(e); + } + } + + // If instantiation fails, reject the module ready promise. + instantiateAsync(wasmBinary, wasmBinaryFile, info, receiveInstantiationResult).catch(readyPromiseReject); + return {}; // no exports yet; we'll fill them in later +} + +// Globals used by JS i64 conversions (see makeSetValue) +var tempDouble; +var tempI64; + +// include: runtime_debug.js +// end include: runtime_debug.js +// === Body === +// end include: preamble.js + + + /** @constructor */ + function ExitStatus(status) { + this.name = 'ExitStatus'; + this.message = `Program terminated with exit(${status})`; + this.status = status; + } + + var callRuntimeCallbacks = (callbacks) => { + while (callbacks.length > 0) { + // Pass the module as the first argument. + callbacks.shift()(Module); + } + }; + + + /** + * @param {number} ptr + * @param {string} type + */ + function getValue(ptr, type = 'i8') { + if (type.endsWith('*')) type = '*'; + switch (type) { + case 'i1': return HEAP8[ptr]; + case 'i8': return HEAP8[ptr]; + case 'i16': return HEAP16[((ptr)>>1)]; + case 'i32': return HEAP32[((ptr)>>2)]; + case 'i64': abort('to do getValue(i64) use WASM_BIGINT'); + case 'float': return HEAPF32[((ptr)>>2)]; + case 'double': return HEAPF64[((ptr)>>3)]; + case '*': return HEAPU32[((ptr)>>2)]; + default: abort(`invalid type for getValue: ${type}`); + } + } + + var noExitRuntime = Module['noExitRuntime'] || true; + + + /** + * @param {number} ptr + * @param {number} value + * @param {string} type + */ + function setValue(ptr, value, type = 'i8') { + if (type.endsWith('*')) type = '*'; + switch (type) { + case 'i1': HEAP8[ptr] = value; break; + case 'i8': HEAP8[ptr] = value; break; + case 'i16': HEAP16[((ptr)>>1)] = value; break; + case 'i32': HEAP32[((ptr)>>2)] = value; break; + case 'i64': abort('to do setValue(i64) use WASM_BIGINT'); + case 'float': HEAPF32[((ptr)>>2)] = value; break; + case 'double': HEAPF64[((ptr)>>3)] = value; break; + case '*': HEAPU32[((ptr)>>2)] = value; break; + default: abort(`invalid type for setValue: ${type}`); + } + } +var wasmImports = { + +}; +var wasmExports = createWasm(); +var ___wasm_call_ctors = () => (___wasm_call_ctors = wasmExports['__wasm_call_ctors'])(); +var _Hash_Update = Module['_Hash_Update'] = (a0) => (_Hash_Update = Module['_Hash_Update'] = wasmExports['Hash_Update'])(a0); +var _Hash_Final = Module['_Hash_Final'] = () => (_Hash_Final = Module['_Hash_Final'] = wasmExports['Hash_Final'])(); +var _Hash_Init = Module['_Hash_Init'] = (a0) => (_Hash_Init = Module['_Hash_Init'] = wasmExports['Hash_Init'])(a0); +var _GetBufferPtr = Module['_GetBufferPtr'] = () => (_GetBufferPtr = Module['_GetBufferPtr'] = wasmExports['GetBufferPtr'])(); +var stackSave = () => (stackSave = wasmExports['stackSave'])(); +var stackRestore = (a0) => (stackRestore = wasmExports['stackRestore'])(a0); +var stackAlloc = (a0) => (stackAlloc = wasmExports['stackAlloc'])(a0); + + +// include: postamble.js +// === Auto-generated postamble setup entry stuff === + + + + +var calledRun; + +dependenciesFulfilled = function runCaller() { + // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false) + if (!calledRun) run(); + if (!calledRun) dependenciesFulfilled = runCaller; // try this again later, after new deps are fulfilled +}; + +function run() { + + if (runDependencies > 0) { + return; + } + + preRun(); + + // a preRun added a dependency, run will be called later + if (runDependencies > 0) { + return; + } + + function doRun() { + // run may have just been called through dependencies being fulfilled just in this very frame, + // or while the async setStatus time below was happening + if (calledRun) return; + calledRun = true; + Module['calledRun'] = true; + + if (ABORT) return; + + initRuntime(); + + readyPromiseResolve(Module); + if (Module['onRuntimeInitialized']) Module['onRuntimeInitialized'](); + + postRun(); + } + + if (Module['setStatus']) { + Module['setStatus']('Running...'); + setTimeout(function() { + setTimeout(function() { + Module['setStatus'](''); + }, 1); + doRun(); + }, 1); + } else + { + doRun(); + } +} + +if (Module['preInit']) { + if (typeof Module['preInit'] == 'function') Module['preInit'] = [Module['preInit']]; + while (Module['preInit'].length > 0) { + Module['preInit'].pop()(); + } +} + +run(); + +// end include: postamble.js + + + + return moduleArg.ready +} +); +})(); +export default Module; \ No newline at end of file diff --git a/node_modules/@huggingface/hub/src/vendor/lz4js/LICENSE b/node_modules/@huggingface/hub/src/vendor/lz4js/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..7dfda0d31577cba1033826adacb3c799c234790a --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/lz4js/LICENSE @@ -0,0 +1,11 @@ +ISC License + +Copyright 2019 John Chadwick + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +--- + +Note: this license is not actually included in https://github.com/Benzinga/lz4js, but the package.json specifies the ISC license diff --git a/node_modules/@huggingface/hub/src/vendor/lz4js/index.ts b/node_modules/@huggingface/hub/src/vendor/lz4js/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..150805de6f593a353bc282dba723794182145d0e --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/lz4js/index.ts @@ -0,0 +1,537 @@ +// lz4.js - An implementation of Lz4 in plain JavaScript. +// +// TODO: +// - Unify header parsing/writing. +// - Support options (block size, checksums) +// - Support streams +// - Better error handling (handle bad offset, etc.) +// - HC support (better search algorithm) +// - Tests/benchmarking + +import * as xxhash from "./xxh32.js"; +import * as util from "./util.js"; + +// Constants +// -- + +// Compression format parameters/constants. +const minMatch = 4; +const matchSearchLimit = 12; +const minTrailingLitterals = 5; +const skipTrigger = 6; +const hashSize = 1 << 16; + +// Token constants. +const mlBits = 4; +const mlMask = (1 << mlBits) - 1; +const runBits = 4; +const runMask = (1 << runBits) - 1; + +// Shared buffers +const blockBuf = makeBuffer(5 << 20); +const hashTable = makeHashTable(); + +// Frame constants. +const magicNum = 0x184d2204; + +// Frame descriptor flags. +const fdContentChksum = 0x4; +const fdContentSize = 0x8; +const fdBlockChksum = 0x10; +// var fdBlockIndep = 0x20; +const fdVersion = 0x40; +const fdVersionMask = 0xc0; + +// Block sizes. +const bsUncompressed = 0x80000000; +const bsDefault = 7; +const bsShift = 4; +const bsMask = 7; +const bsMap: Record = { + 4: 0x10000, + 5: 0x40000, + 6: 0x100000, + 7: 0x400000, +}; + +// Utility functions/primitives +// -- + +// Makes our hashtable. On older browsers, may return a plain array. +function makeHashTable() { + try { + return new Uint32Array(hashSize); + } catch (error) { + const hashTable = new Array(hashSize); + + for (let i = 0; i < hashSize; i++) { + hashTable[i] = 0; + } + + return hashTable; + } +} + +// Clear hashtable. +function clearHashTable(table: Uint32Array | number[]) { + for (let i = 0; i < hashSize; i++) { + table[i] = 0; + } +} + +// Makes a byte buffer. On older browsers, may return a plain array. +function makeBuffer(size: number) { + return new Uint8Array(size); +} + +function sliceArray(array: Uint8Array, start: number, end: number) { + return array.slice(start, end); +} + +// Implementation +// -- + +// Calculates an upper bound for lz4 compression. +export function compressBound(n: number) { + return (n + n / 255 + 16) | 0; +} + +// Calculates an upper bound for lz4 decompression, by reading the data. +export function decompressBound(src: Uint8Array) { + let sIndex = 0; + + // Read magic number + if (util.readU32(src, sIndex) !== magicNum) { + throw new Error("invalid magic number"); + } + + sIndex += 4; + + // Read descriptor + const descriptor = src[sIndex++]; + + // Check version + if ((descriptor & fdVersionMask) !== fdVersion) { + throw new Error("incompatible descriptor version " + (descriptor & fdVersionMask)); + } + + // Read flags + const useBlockSum = (descriptor & fdBlockChksum) !== 0; + const useContentSize = (descriptor & fdContentSize) !== 0; + + // Read block size + const bsIdx = (src[sIndex++] >> bsShift) & bsMask; + + if (bsMap[bsIdx] === undefined) { + throw new Error("invalid block size " + bsIdx); + } + + const maxBlockSize = bsMap[bsIdx]; + + // Get content size + if (useContentSize) { + return util.readU64(src, sIndex); + } + + // Checksum + sIndex++; + + // Read blocks. + let maxSize = 0; + while (true) { + let blockSize = util.readU32(src, sIndex); + sIndex += 4; + + if (blockSize & bsUncompressed) { + blockSize &= ~bsUncompressed; + maxSize += blockSize; + } else if (blockSize > 0) { + maxSize += maxBlockSize; + } + + if (blockSize === 0) { + return maxSize; + } + + if (useBlockSum) { + sIndex += 4; + } + + sIndex += blockSize; + } +} + +// Decompresses a block of Lz4. +export function decompressBlock(src: Uint8Array, dst: Uint8Array, sIndex: number, sLength: number, dIndex: number) { + let mLength, mOffset, sEnd, n, i; + const hasCopyWithin = dst.copyWithin !== undefined && dst.fill !== undefined; + + // Setup initial state. + sEnd = sIndex + sLength; + + // Consume entire input block. + while (sIndex < sEnd) { + const token = src[sIndex++]; + + // Copy literals. + let literalCount = token >> 4; + if (literalCount > 0) { + // Parse length. + if (literalCount === 0xf) { + while (true) { + literalCount += src[sIndex]; + if (src[sIndex++] !== 0xff) { + break; + } + } + } + + // Copy literals + for (n = sIndex + literalCount; sIndex < n; ) { + dst[dIndex++] = src[sIndex++]; + } + } + + if (sIndex >= sEnd) { + break; + } + + // Copy match. + mLength = token & 0xf; + + // Parse offset. + mOffset = src[sIndex++] | (src[sIndex++] << 8); + + // Parse length. + if (mLength === 0xf) { + while (true) { + mLength += src[sIndex]; + if (src[sIndex++] !== 0xff) { + break; + } + } + } + + mLength += minMatch; + + // Copy match + // prefer to use typedarray.copyWithin for larger matches + // NOTE: copyWithin doesn't work as required by LZ4 for overlapping sequences + // e.g. mOffset=1, mLength=30 (repeach char 30 times) + // we special case the repeat char w/ array.fill + if (hasCopyWithin && mOffset === 1) { + dst.fill(dst[dIndex - 1] | 0, dIndex, dIndex + mLength); + dIndex += mLength; + } else if (hasCopyWithin && mOffset > mLength && mLength > 31) { + dst.copyWithin(dIndex, dIndex - mOffset, dIndex - mOffset + mLength); + dIndex += mLength; + } else { + for (i = dIndex - mOffset, n = i + mLength; i < n; ) { + dst[dIndex++] = dst[i++] | 0; + } + } + } + + return dIndex; +} + +// Compresses a block with Lz4. +export function compressBlock( + src: Uint8Array, + dst: Uint8Array, + sIndex: number, + sLength: number, + hashTable: Uint32Array | number[], +) { + let mIndex, mAnchor, mLength, mOffset, mStep; + let literalCount, dIndex, sEnd, n; + + // Setup initial state. + dIndex = 0; + sEnd = sLength + sIndex; + mAnchor = sIndex; + + let searchMatchCount = (1 << skipTrigger) + 3; + + // Search for matches with a limit of matchSearchLimit bytes + // before the end of block (Lz4 spec limitation.) + while (sIndex <= sEnd - matchSearchLimit) { + const seq = util.readU32(src, sIndex); + let hash = util.hashU32(seq) >>> 0; + + // Crush hash to 16 bits. + hash = (((hash >> 16) ^ hash) >>> 0) & 0xffff; + + // Look for a match in the hashtable. NOTE: remove one; see below. + mIndex = hashTable[hash] - 1; + + // Put pos in hash table. NOTE: add one so that zero = invalid. + hashTable[hash] = sIndex + 1; + + // Determine if there is a match (within range.) + if (mIndex < 0 || (sIndex - mIndex) >>> 16 > 0 || util.readU32(src, mIndex) !== seq) { + mStep = searchMatchCount++ >> skipTrigger; + sIndex += mStep; + continue; + } + + searchMatchCount = (1 << skipTrigger) + 3; + + // Calculate literal count and offset. + literalCount = sIndex - mAnchor; + mOffset = sIndex - mIndex; + + // We've already matched one word, so get that out of the way. + sIndex += minMatch; + mIndex += minMatch; + + // Determine match length. + // N.B.: mLength does not include minMatch, Lz4 adds it back + // in decoding. + mLength = sIndex; + while (sIndex < sEnd - minTrailingLitterals && src[sIndex] === src[mIndex]) { + sIndex++; + mIndex++; + } + mLength = sIndex - mLength; + + // Write token + literal count. + const token = mLength < mlMask ? mLength : mlMask; + if (literalCount >= runMask) { + dst[dIndex++] = (runMask << mlBits) + token; + for (n = literalCount - runMask; n >= 0xff; n -= 0xff) { + dst[dIndex++] = 0xff; + } + dst[dIndex++] = n; + } else { + dst[dIndex++] = (literalCount << mlBits) + token; + } + + // Write literals. + for (let i = 0; i < literalCount; i++) { + dst[dIndex++] = src[mAnchor + i]; + } + + // Write offset. + dst[dIndex++] = mOffset; + dst[dIndex++] = mOffset >> 8; + + // Write match length. + if (mLength >= mlMask) { + for (n = mLength - mlMask; n >= 0xff; n -= 0xff) { + dst[dIndex++] = 0xff; + } + dst[dIndex++] = n; + } + + // Move the anchor. + mAnchor = sIndex; + } + + // Nothing was encoded. + if (mAnchor === 0) { + return 0; + } + + // Write remaining literals. + // Write literal token+count. + literalCount = sEnd - mAnchor; + if (literalCount >= runMask) { + dst[dIndex++] = runMask << mlBits; + for (n = literalCount - runMask; n >= 0xff; n -= 0xff) { + dst[dIndex++] = 0xff; + } + dst[dIndex++] = n; + } else { + dst[dIndex++] = literalCount << mlBits; + } + + // Write literals. + sIndex = mAnchor; + while (sIndex < sEnd) { + dst[dIndex++] = src[sIndex++]; + } + + return dIndex; +} + +// Decompresses a frame of Lz4 data. +export function decompressFrame(src: Uint8Array, dst: Uint8Array) { + let useBlockSum, useContentSum, useContentSize, descriptor; + let sIndex = 0; + let dIndex = 0; + + // Read magic number + if (util.readU32(src, sIndex) !== magicNum) { + throw new Error("invalid magic number"); + } + + sIndex += 4; + + // Read descriptor + descriptor = src[sIndex++]; + + // Check version + if ((descriptor & fdVersionMask) !== fdVersion) { + throw new Error("incompatible descriptor version"); + } + + // Read flags + useBlockSum = (descriptor & fdBlockChksum) !== 0; + useContentSum = (descriptor & fdContentChksum) !== 0; + useContentSize = (descriptor & fdContentSize) !== 0; + + // Read block size + const bsIdx = (src[sIndex++] >> bsShift) & bsMask; + + if (bsMap[bsIdx] === undefined) { + throw new Error("invalid block size"); + } + + if (useContentSize) { + // TODO: read content size + sIndex += 8; + } + + sIndex++; + + // Read blocks. + while (true) { + var compSize; + + compSize = util.readU32(src, sIndex); + sIndex += 4; + + if (compSize === 0) { + break; + } + + if (useBlockSum) { + // TODO: read block checksum + sIndex += 4; + } + + // Check if block is compressed + if ((compSize & bsUncompressed) !== 0) { + // Mask off the 'uncompressed' bit + compSize &= ~bsUncompressed; + + // Copy uncompressed data into destination buffer. + for (let j = 0; j < compSize; j++) { + dst[dIndex++] = src[sIndex++]; + } + } else { + // Decompress into blockBuf + dIndex = decompressBlock(src, dst, sIndex, compSize, dIndex); + sIndex += compSize; + } + } + + if (useContentSum) { + // TODO: read content checksum + sIndex += 4; + } + + return dIndex; +} + +// Compresses data to an Lz4 frame. +export function compressFrame(src: Uint8Array, dst: Uint8Array) { + let dIndex = 0; + + // Write magic number. + util.writeU32(dst, dIndex, magicNum); + dIndex += 4; + + // Descriptor flags. + dst[dIndex++] = fdVersion; + dst[dIndex++] = bsDefault << bsShift; + + // Descriptor checksum. + dst[dIndex] = xxhash.hash(0, dst, 4, dIndex - 4) >> 8; + dIndex++; + + // Write blocks. + const maxBlockSize = bsMap[bsDefault]; + let remaining = src.length; + let sIndex = 0; + + // Clear the hashtable. + clearHashTable(hashTable); + + // Split input into blocks and write. + while (remaining > 0) { + let compSize = 0; + const blockSize = remaining > maxBlockSize ? maxBlockSize : remaining; + + compSize = compressBlock(src, blockBuf, sIndex, blockSize, hashTable); + + if (compSize > blockSize || compSize === 0) { + // Output uncompressed. + util.writeU32(dst, dIndex, 0x80000000 | blockSize); + dIndex += 4; + + for (let z = sIndex + blockSize; sIndex < z; ) { + dst[dIndex++] = src[sIndex++]; + } + + remaining -= blockSize; + } else { + // Output compressed. + util.writeU32(dst, dIndex, compSize); + dIndex += 4; + + for (let j = 0; j < compSize; ) { + dst[dIndex++] = blockBuf[j++]; + } + + sIndex += blockSize; + remaining -= blockSize; + } + } + + // Write blank end block. + util.writeU32(dst, dIndex, 0); + dIndex += 4; + + return dIndex; +} + +// Decompresses a buffer containing an Lz4 frame. maxSize is optional; if not +// provided, a maximum size will be determined by examining the data. The +// buffer returned will always be perfectly-sized. +export function decompress(src: Uint8Array, maxSize: number) { + let dst, size; + + if (maxSize === undefined) { + maxSize = decompressBound(src); + } + dst = makeBuffer(maxSize); + size = decompressFrame(src, dst); + + if (size !== maxSize) { + dst = sliceArray(dst, 0, size); + } + + return dst; +} + +// Compresses a buffer to an Lz4 frame. maxSize is optional; if not provided, +// a buffer will be created based on the theoretical worst output size for a +// given input size. The buffer returned will always be perfectly-sized. +export function compress(src: Uint8Array, maxSize?: number) { + let dst, size; + + if (maxSize === undefined) { + maxSize = compressBound(src.length); + } + + dst = makeBuffer(maxSize); + size = compressFrame(src, dst); + + if (size !== maxSize) { + dst = sliceArray(dst, 0, size); + } + + return dst; +} diff --git a/node_modules/@huggingface/hub/src/vendor/lz4js/util.ts b/node_modules/@huggingface/hub/src/vendor/lz4js/util.ts new file mode 100644 index 0000000000000000000000000000000000000000..5d579b76604d2fe13537423de069f61eca50a2d4 --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/lz4js/util.ts @@ -0,0 +1,54 @@ +// Simple hash function, from: http://burtleburtle.net/bob/hash/integer.html. +// Chosen because it doesn't use multiply and achieves full avalanche. +export function hashU32(a: number): number { + a = a | 0; + a = (a + 2127912214 + (a << 12)) | 0; + a = a ^ -949894596 ^ (a >>> 19); + a = (a + 374761393 + (a << 5)) | 0; + a = (a + -744332180) ^ (a << 9); + a = (a + -42973499 + (a << 3)) | 0; + return (a ^ -1252372727 ^ (a >>> 16)) | 0; +} + +// Reads a 64-bit little-endian integer from an array. +export function readU64(b: Uint8Array, n: number): number { + let x = 0; + x |= b[n++] << 0; + x |= b[n++] << 8; + x |= b[n++] << 16; + x |= b[n++] << 24; + x |= b[n++] << 32; + x |= b[n++] << 40; + x |= b[n++] << 48; + x |= b[n++] << 56; + return x; +} + +// Reads a 32-bit little-endian integer from an array. +export function readU32(b: Uint8Array, n: number): number { + let x = 0; + x |= b[n++] << 0; + x |= b[n++] << 8; + x |= b[n++] << 16; + x |= b[n++] << 24; + return x; +} + +// Writes a 32-bit little-endian integer from an array. +export function writeU32(b: Uint8Array, n: number, x: number): void { + b[n++] = (x >> 0) & 0xff; + b[n++] = (x >> 8) & 0xff; + b[n++] = (x >> 16) & 0xff; + b[n++] = (x >> 24) & 0xff; +} + +// Multiplies two numbers using 32-bit integer multiplication. +// Algorithm from Emscripten. +export function imul(a: number, b: number): number { + const ah = a >>> 16; + const al = a & 65535; + const bh = b >>> 16; + const bl = b & 65535; + + return (al * bl + ((ah * bl + al * bh) << 16)) | 0; +} diff --git a/node_modules/@huggingface/hub/src/vendor/lz4js/xxh32.ts b/node_modules/@huggingface/hub/src/vendor/lz4js/xxh32.ts new file mode 100644 index 0000000000000000000000000000000000000000..b9d135c657c69da01cda9beab2abe1b06b009e2e --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/lz4js/xxh32.ts @@ -0,0 +1,96 @@ +// xxh32.js - implementation of xxhash32 in plain JavaScript +import * as util from "./util.js"; + +// xxhash32 primes +const prime1 = 0x9e3779b1; +const prime2 = 0x85ebca77; +const prime3 = 0xc2b2ae3d; +const prime4 = 0x27d4eb2f; +const prime5 = 0x165667b1; + +// Utility functions/primitives +// -- +function rotl32(x: number, r: number): number { + x = x | 0; + r = r | 0; + + return (x >>> ((32 - r) | 0)) | (x << r) | 0; +} + +function rotmul32(h: number, r: number, m: number): number { + h = h | 0; + r = r | 0; + m = m | 0; + + return util.imul((h >>> ((32 - r) | 0)) | (h << r), m) | 0; +} + +function shiftxor32(h: number, s: number): number { + h = h | 0; + s = s | 0; + + return ((h >>> s) ^ h) | 0; +} + +// Implementation +// -- + +function xxhapply(h: number, src: number, m0: number, s: number, m1: number): number { + return rotmul32(util.imul(src, m0) + h, s, m1); +} + +function xxh1(h: number, src: Uint8Array, index: number): number { + return rotmul32(h + util.imul(src[index], prime5), 11, prime1); +} + +function xxh4(h: number, src: Uint8Array, index: number): number { + return xxhapply(h, util.readU32(src, index), prime3, 17, prime4); +} + +function xxh16(h: number[], src: Uint8Array, index: number): number[] { + return [ + xxhapply(h[0], util.readU32(src, index + 0), prime2, 13, prime1), + xxhapply(h[1], util.readU32(src, index + 4), prime2, 13, prime1), + xxhapply(h[2], util.readU32(src, index + 8), prime2, 13, prime1), + xxhapply(h[3], util.readU32(src, index + 12), prime2, 13, prime1), + ]; +} + +function xxh32(seed: number, src: Uint8Array, index: number, len: number): number { + let h; + const l = len; + if (len >= 16) { + h = [seed + prime1 + prime2, seed + prime2, seed, seed - prime1]; + + while (len >= 16) { + h = xxh16(h, src, index); + + index += 16; + len -= 16; + } + + h = rotl32(h[0], 1) + rotl32(h[1], 7) + rotl32(h[2], 12) + rotl32(h[3], 18) + l; + } else { + h = (seed + prime5 + len) >>> 0; + } + + while (len >= 4) { + h = xxh4(h, src, index); + + index += 4; + len -= 4; + } + + while (len > 0) { + h = xxh1(h, src, index); + + index++; + len--; + } + + h = shiftxor32(util.imul(shiftxor32(util.imul(shiftxor32(h, 15), prime2), 13), prime3), 16); + + return h >>> 0; +} + +export const hash = xxh32; diff --git a/node_modules/@huggingface/hub/src/vendor/type-fest/basic.ts b/node_modules/@huggingface/hub/src/vendor/type-fest/basic.ts new file mode 100644 index 0000000000000000000000000000000000000000..3fa40a039955fec376a3e8cdc42dc425a00a859b --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/type-fest/basic.ts @@ -0,0 +1,31 @@ +/** +Matches a JSON object. + +This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`. + +@category JSON +*/ +export type JsonObject = { [Key in string]: JsonValue } & { [Key in string]?: JsonValue | undefined }; + +/** +Matches a JSON array. + +@category JSON +*/ +export type JsonArray = JsonValue[] | readonly JsonValue[]; + +/** +Matches any valid JSON primitive value. + +@category JSON +*/ +export type JsonPrimitive = string | number | boolean | null; + +/** +Matches any valid JSON value. + +@see `Jsonify` if you need to transform a type to one that is assignable to `JsonValue`. + +@category JSON +*/ +export type JsonValue = JsonPrimitive | JsonObject | JsonArray; diff --git a/node_modules/@huggingface/hub/src/vendor/type-fest/entries.ts b/node_modules/@huggingface/hub/src/vendor/type-fest/entries.ts new file mode 100644 index 0000000000000000000000000000000000000000..3975d823ae3297d6bd021dd5aae2568e66dea6d7 --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/type-fest/entries.ts @@ -0,0 +1,66 @@ +import type { ArrayEntry, MapEntry, ObjectEntry, SetEntry } from "./entry"; + +type ArrayEntries = Array>; +type MapEntries = Array>; +type ObjectEntries = Array>; +type SetEntries> = Array>; + +/** +Many collections have an `entries` method which returns an array of a given object's own enumerable string-keyed property [key, value] pairs. The `Entries` type will return the type of that collection's entries. + +For example the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`}, and {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`} collections all have this method. Note that `WeakMap` and `WeakSet` do not have this method since their entries are not enumerable. + +@see `Entry` if you want to just access the type of a single entry. + +@example +``` +import type {Entries} from 'type-fest'; + +interface Example { + someKey: number; +} + +const manipulatesEntries = (examples: Entries) => examples.map(example => [ + // Does some arbitrary processing on the key (with type information available) + example[0].toUpperCase(), + + // Does some arbitrary processing on the value (with type information available) + example[1].toFixed() +]); + +const example: Example = {someKey: 1}; +const entries = Object.entries(example) as Entries; +const output = manipulatesEntries(entries); + +// Objects +const objectExample = {a: 1}; +const objectEntries: Entries = [['a', 1]]; + +// Arrays +const arrayExample = ['a', 1]; +const arrayEntries: Entries = [[0, 'a'], [1, 1]]; + +// Maps +const mapExample = new Map([['a', 1]]); +const mapEntries: Entries = [['a', 1]]; + +// Sets +const setExample = new Set(['a', 1]); +const setEntries: Entries = [['a', 'a'], [1, 1]]; +``` + +@category Object +@category Map +@category Set +@category Array +*/ +export type Entries = + BaseType extends Map + ? MapEntries + : BaseType extends Set + ? SetEntries + : BaseType extends readonly unknown[] + ? ArrayEntries + : BaseType extends object + ? ObjectEntries + : never; diff --git a/node_modules/@huggingface/hub/src/vendor/type-fest/entry.ts b/node_modules/@huggingface/hub/src/vendor/type-fest/entry.ts new file mode 100644 index 0000000000000000000000000000000000000000..1f8dd55ccc1d6b750408519e733cc0e848f26f4a --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/type-fest/entry.ts @@ -0,0 +1,69 @@ +type MapKey = BaseType extends Map ? KeyType : never; +type MapValue = BaseType extends Map ? ValueType : never; + +export type ArrayEntry = [number, BaseType[number]]; +export type MapEntry = [MapKey, MapValue]; +export type ObjectEntry = [keyof BaseType, BaseType[keyof BaseType]]; +export type SetEntry = BaseType extends Set ? [ItemType, ItemType] : never; + +/** +Many collections have an `entries` method which returns an array of a given object's own enumerable string-keyed property [key, value] pairs. The `Entry` type will return the type of that collection's entry. + +For example the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`}, and {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`} collections all have this method. Note that `WeakMap` and `WeakSet` do not have this method since their entries are not enumerable. + +@see `Entries` if you want to just access the type of the array of entries (which is the return of the `.entries()` method). + +@example +``` +import type {Entry} from 'type-fest'; + +interface Example { + someKey: number; +} + +const manipulatesEntry = (example: Entry) => [ + // Does some arbitrary processing on the key (with type information available) + example[0].toUpperCase(), + + // Does some arbitrary processing on the value (with type information available) + example[1].toFixed(), +]; + +const example: Example = {someKey: 1}; +const entry = Object.entries(example)[0] as Entry; +const output = manipulatesEntry(entry); + +// Objects +const objectExample = {a: 1}; +const objectEntry: Entry = ['a', 1]; + +// Arrays +const arrayExample = ['a', 1]; +const arrayEntryString: Entry = [0, 'a']; +const arrayEntryNumber: Entry = [1, 1]; + +// Maps +const mapExample = new Map([['a', 1]]); +const mapEntry: Entry = ['a', 1]; + +// Sets +const setExample = new Set(['a', 1]); +const setEntryString: Entry = ['a', 'a']; +const setEntryNumber: Entry = [1, 1]; +``` + +@category Object +@category Map +@category Array +@category Set +*/ +export type Entry = + BaseType extends Map + ? MapEntry + : BaseType extends Set + ? SetEntry + : BaseType extends readonly unknown[] + ? ArrayEntry + : BaseType extends object + ? ObjectEntry + : never; diff --git a/node_modules/@huggingface/hub/src/vendor/type-fest/except.ts b/node_modules/@huggingface/hub/src/vendor/type-fest/except.ts new file mode 100644 index 0000000000000000000000000000000000000000..d6a38169ee1fe3239f8b8b561600007ebab6c0f1 --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/type-fest/except.ts @@ -0,0 +1,68 @@ +import type { IsEqual } from "./is-equal"; + +/** +Filter out keys from an object. + +Returns `never` if `Exclude` is strictly equal to `Key`. +Returns `never` if `Key` extends `Exclude`. +Returns `Key` otherwise. + +@example +``` +type Filtered = Filter<'foo', 'foo'>; +//=> never +``` + +@example +``` +type Filtered = Filter<'bar', string>; +//=> never +``` + +@example +``` +type Filtered = Filter<'bar', 'foo'>; +//=> 'bar' +``` + +@see {Except} +*/ +type Filter = + IsEqual extends true ? never : KeyType extends ExcludeType ? never : KeyType; + +/** +Create a type from an object type without certain keys. + +We recommend setting the `requireExactProps` option to `true`. + +This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically. + +This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)). + +@example +``` +import type {Except} from 'type-fest'; + +type Foo = { + a: number; + b: string; +}; + +type FooWithoutA = Except; +//=> {b: string} + +const fooWithoutA: FooWithoutA = {a: 1, b: '2'}; +//=> errors: 'a' does not exist in type '{ b: string; }' + +type FooWithoutB = Except; +//=> {a: number} & Partial> + +const fooWithoutB: FooWithoutB = {a: 1, b: '2'}; +//=> errors at 'b': Type 'string' is not assignable to type 'undefined'. +``` + +@category Object +*/ +export type Except = { + [KeyType in keyof ObjectType as Filter]: ObjectType[KeyType]; +}; diff --git a/node_modules/@huggingface/hub/src/vendor/type-fest/is-equal.ts b/node_modules/@huggingface/hub/src/vendor/type-fest/is-equal.ts new file mode 100644 index 0000000000000000000000000000000000000000..d6ff2e53c4d25df11584f0a59504e08170e0a3b8 --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/type-fest/is-equal.ts @@ -0,0 +1,27 @@ +/** +Returns a boolean for whether the two given types are equal. + +@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650 +@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796 + +Use-cases: +- If you want to make a conditional branch based on the result of a comparison of two types. + +@example +``` +import type {IsEqual} from 'type-fest'; + +// This type returns a boolean for whether the given array includes the given item. +// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal. +type Includes = + Value extends readonly [Value[0], ...infer rest] + ? IsEqual extends true + ? true + : Includes + : false; +``` + +@category Type Guard +@category Utilities +*/ +export type IsEqual = (() => G extends A ? 1 : 2) extends () => G extends B ? 1 : 2 ? true : false; diff --git a/node_modules/@huggingface/hub/src/vendor/type-fest/license-cc0 b/node_modules/@huggingface/hub/src/vendor/type-fest/license-cc0 new file mode 100644 index 0000000000000000000000000000000000000000..0e259d42c996742e9e3cba14c677129b2c1b6311 --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/type-fest/license-cc0 @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/node_modules/@huggingface/hub/src/vendor/type-fest/license-mit b/node_modules/@huggingface/hub/src/vendor/type-fest/license-mit new file mode 100644 index 0000000000000000000000000000000000000000..fa7ceba3eb4a9657a9db7f3ffca4e4e97a9019de --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/type-fest/license-mit @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@huggingface/hub/src/vendor/type-fest/set-required.ts b/node_modules/@huggingface/hub/src/vendor/type-fest/set-required.ts new file mode 100644 index 0000000000000000000000000000000000000000..8e4c6417a92e2b600e66cb00d2c4ff9675620269 --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/type-fest/set-required.ts @@ -0,0 +1,34 @@ +import type { Except } from "./except"; +import type { Simplify } from "./simplify"; + +/** +Create a type that makes the given keys required. The remaining keys are kept as is. The sister of the `SetOptional` type. + +Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required. + +@example +``` +import type {SetRequired} from 'type-fest'; + +type Foo = { + a?: number; + b: string; + c?: boolean; +} + +type SomeRequired = SetRequired; +// type SomeRequired = { +// a?: number; +// b: string; // Was already required and still is. +// c: boolean; // Is now required. +// } +``` + +@category Object +*/ +export type SetRequired = Simplify< + // Pick just the keys that are optional from the base type. + Except & + // Pick the keys that should be required from the base type and make them required. + Required> +>; diff --git a/node_modules/@huggingface/hub/src/vendor/type-fest/simplify.ts b/node_modules/@huggingface/hub/src/vendor/type-fest/simplify.ts new file mode 100644 index 0000000000000000000000000000000000000000..f4564fe7043dd43ce6ac4de4b332d7c85915910c --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/type-fest/simplify.ts @@ -0,0 +1,59 @@ +/** +Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability. + +@example +``` +import type {Simplify} from 'type-fest'; + +type PositionProps = { + top: number; + left: number; +}; + +type SizeProps = { + width: number; + height: number; +}; + +// In your editor, hovering over `Props` will show a flattened object with all the properties. +type Props = Simplify; +``` + +Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface. + +If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify` if you can't re-declare the `value`. + +@example +``` +import type {Simplify} from 'type-fest'; + +interface SomeInterface { + foo: number; + bar?: string; + baz: number | undefined; +} + +type SomeType = { + foo: number; + bar?: string; + baz: number | undefined; +}; + +const literal = {foo: 123, bar: 'hello', baz: 456}; +const someType: SomeType = literal; +const someInterface: SomeInterface = literal; + +function fn(object: Record): void {} + +fn(literal); // Good: literal object type is sealed +fn(someType); // Good: type is sealed +fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened +fn(someInterface as Simplify); // Good: transform an `interface` into a `type` +``` + +@link https://github.com/microsoft/TypeScript/issues/15300 + +@category Object +*/ +// eslint-disable-next-line @typescript-eslint/ban-types +export type Simplify = { [KeyType in keyof T]: T[KeyType] } & {}; diff --git a/node_modules/@huggingface/hub/src/vendor/xet-chunk/.prettierignore b/node_modules/@huggingface/hub/src/vendor/xet-chunk/.prettierignore new file mode 100644 index 0000000000000000000000000000000000000000..4c43fe68f6405ee8c6c641998a414c8fa66b0aba --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/xet-chunk/.prettierignore @@ -0,0 +1 @@ +*.js \ No newline at end of file diff --git a/node_modules/@huggingface/hub/src/vendor/xet-chunk/README.md b/node_modules/@huggingface/hub/src/vendor/xet-chunk/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e0c55e0aafc8f2ff89b431780d0bc4e11ec7772e --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/xet-chunk/README.md @@ -0,0 +1,7 @@ +# Xet-Chunk + +WASM utilities to chunk & hash data. + +An assembly script implementation is available in `@huggingface/xetchunk-wasm`, but for performance reasons we're using WASM directly compiled from the rust source, see https://github.com/huggingface/xet-core/tree/main/hf_xet_wasm which on my local machine processes data at 480MB/s. + +The `chunker_wasm_bg.js`and `chunker_wasm_bg.wasm.base64.ts` are generated with `pnpm --filter hub build:xet-wasm`. diff --git a/node_modules/@huggingface/hub/src/vendor/xet-chunk/chunker_wasm.ts b/node_modules/@huggingface/hub/src/vendor/xet-chunk/chunker_wasm.ts new file mode 100644 index 0000000000000000000000000000000000000000..efc7d0294bbb4702589a7970fb068382a0304baa --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/xet-chunk/chunker_wasm.ts @@ -0,0 +1,68 @@ +// export * from "./chunker_wasm_bg.js"; +import * as __glue_imports from "./chunker_wasm_bg.js"; +// @ts-expect-error no types +import { __wbg_set_wasm } from "./chunker_wasm_bg.js"; +// @ts-expect-error no types +import { wasmBinary } from "./chunker_wasm_bg.wasm.base64.ts"; + +let initPromise: Promise | null = null; + +async function init(): Promise { + if (initPromise) { + return initPromise; + } + let resolve: (value: void) => void; + let reject: (reason?: unknown) => void; + initPromise = new Promise((_resolve, _reject) => { + resolve = _resolve; + reject = _reject; + }); + + await Promise.resolve(); + + try { + const wasmModule = await WebAssembly.compile(wasmBinary); + const imports = Object.entries( + WebAssembly.Module.imports(wasmModule).reduce( + (result, item) => ({ + ...result, + // @ts-expect-error ok for any type + [item.module]: [...(result[item.module] || []), item.name], + }), + {}, + ), + ).map(([from, names]) => ({ from, names })); + const wasm = await WebAssembly.instantiate(wasmModule, { + "./hf_xet_thin_wasm_bg.js": Object.fromEntries( + // @ts-expect-error ok for any type + (imports[0].names as string[]).map((name) => [name, __glue_imports[name]]), + ), + }); + __wbg_set_wasm(wasm.exports); + // console.log("exports", exports); + // @ts-expect-error it's assigned + wasm.exports.__wbindgen_start(); + + // @ts-expect-error it's assigned + resolve(); + } catch (error) { + // @ts-expect-error it's assigned + reject(error); + } +} + +init(); + +export { init }; + +export { + compute_xorb_hash, + compute_file_hash, + Chunker, + compute_verification_hash, + compute_hmac, +} from "./chunker_wasm_bg.js"; + +// const exports = WebAssembly.Module.exports(wasmModule).map((item) => item.name); + +// console.log("imports", imports); diff --git a/node_modules/@huggingface/hub/src/vendor/xet-chunk/chunker_wasm_bg.d.ts b/node_modules/@huggingface/hub/src/vendor/xet-chunk/chunker_wasm_bg.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..52c6d5edafe830f44981919ec97d0ff2028d398a --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/xet-chunk/chunker_wasm_bg.d.ts @@ -0,0 +1,12 @@ +/* tslint:disable */ +/* eslint-disable */ +export function compute_xorb_hash(chunks_array: Array<{ hash: string; length: number }>): string; +export function compute_verification_hash(chunkHashes: string[]): string; +export function compute_file_hash(chunks_array: Array<{ hash: string; length: number }>): string; +export function compute_hmac(hash: string, key: string): string; +export class Chunker { + free(): void; + constructor(target_chunk_size: number); + add_data(data: Uint8Array): Array<{ hash: string; length: number; dedup: boolean }>; + finish(): Array<{ hash: string; length: number; dedup: boolean }>; +} diff --git a/node_modules/@huggingface/hub/src/vendor/xet-chunk/chunker_wasm_bg.js b/node_modules/@huggingface/hub/src/vendor/xet-chunk/chunker_wasm_bg.js new file mode 100644 index 0000000000000000000000000000000000000000..f5e249e67dd69202a563353c63b389923ad3fd0f --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/xet-chunk/chunker_wasm_bg.js @@ -0,0 +1,577 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +let WASM_VECTOR_LEN = 0; + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder; + +let cachedTextEncoder = new lTextEncoder('utf-8'); + +const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' + ? function (arg, view) { + return cachedTextEncoder.encodeInto(arg, view); +} + : function (arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; +}); + +function passStringToWasm0(arg, malloc, realloc) { + + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + + const mem = getUint8ArrayMemory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; + } + + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); + const ret = encodeString(arg, view); + + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; + } + + WASM_VECTOR_LEN = offset; + return ptr; +} + +let cachedDataViewMemory0 = null; + +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); + } + return cachedDataViewMemory0; +} + +function addToExternrefTable0(obj) { + const idx = wasm.__externref_table_alloc(); + wasm.__wbindgen_export_4.set(idx, obj); + return idx; +} + +function handleError(f, args) { + try { + return f.apply(this, args); + } catch (e) { + const idx = addToExternrefTable0(e); + wasm.__wbindgen_exn_store(idx); + } +} + +function debugString(val) { + // primitive types + const type = typeof val; + if (type == 'number' || type == 'boolean' || val == null) { + return `${val}`; + } + if (type == 'string') { + return `"${val}"`; + } + if (type == 'symbol') { + const description = val.description; + if (description == null) { + return 'Symbol'; + } else { + return `Symbol(${description})`; + } + } + if (type == 'function') { + const name = val.name; + if (typeof name == 'string' && name.length > 0) { + return `Function(${name})`; + } else { + return 'Function'; + } + } + // objects + if (Array.isArray(val)) { + const length = val.length; + let debug = '['; + if (length > 0) { + debug += debugString(val[0]); + } + for(let i = 1; i < length; i++) { + debug += ', ' + debugString(val[i]); + } + debug += ']'; + return debug; + } + // Test for built-in + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); + let className; + if (builtInMatches && builtInMatches.length > 1) { + className = builtInMatches[1]; + } else { + // Failed to match the standard '[object ClassName]' + return toString.call(val); + } + if (className == 'Object') { + // we're a user defined class or Object + // JSON.stringify avoids problems with cycles, and is generally much + // easier than looping through ownProperties of `val`. + try { + return 'Object(' + JSON.stringify(val) + ')'; + } catch (_) { + return 'Object'; + } + } + // errors + if (val instanceof Error) { + return `${val.name}: ${val.message}\n${val.stack}`; + } + // TODO we could test for more things here, like `Set`s and `Map`s. + return className; +} + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +function isLikeNone(x) { + return x === undefined || x === null; +} + +function passArray8ToWasm0(arg, malloc) { + const ptr = malloc(arg.length * 1, 1) >>> 0; + getUint8ArrayMemory0().set(arg, ptr / 1); + WASM_VECTOR_LEN = arg.length; + return ptr; +} + +function takeFromExternrefTable0(idx) { + const value = wasm.__wbindgen_export_4.get(idx); + wasm.__externref_table_dealloc(idx); + return value; +} +/** + * takes an Array of Objects of the form { "hash": string, "length": number } + * and returns a string of a hash + * @param {any} chunks_array + * @returns {string} + */ +export function compute_xorb_hash(chunks_array) { + let deferred2_0; + let deferred2_1; + try { + const ret = wasm.compute_xorb_hash(chunks_array); + var ptr1 = ret[0]; + var len1 = ret[1]; + if (ret[3]) { + ptr1 = 0; len1 = 0; + throw takeFromExternrefTable0(ret[2]); + } + deferred2_0 = ptr1; + deferred2_1 = len1; + return getStringFromWasm0(ptr1, len1); + } finally { + wasm.__wbindgen_free(deferred2_0, deferred2_1, 1); + } +} + +/** + * takes an Array of Objects of the form { "hash": string, "length": number } + * and returns a string of a hash + * @param {any} chunks_array + * @returns {string} + */ +export function compute_file_hash(chunks_array) { + let deferred2_0; + let deferred2_1; + try { + const ret = wasm.compute_file_hash(chunks_array); + var ptr1 = ret[0]; + var len1 = ret[1]; + if (ret[3]) { + ptr1 = 0; len1 = 0; + throw takeFromExternrefTable0(ret[2]); + } + deferred2_0 = ptr1; + deferred2_1 = len1; + return getStringFromWasm0(ptr1, len1); + } finally { + wasm.__wbindgen_free(deferred2_0, deferred2_1, 1); + } +} + +function passArrayJsValueToWasm0(array, malloc) { + const ptr = malloc(array.length * 4, 4) >>> 0; + for (let i = 0; i < array.length; i++) { + const add = addToExternrefTable0(array[i]); + getDataViewMemory0().setUint32(ptr + 4 * i, add, true); + } + WASM_VECTOR_LEN = array.length; + return ptr; +} +/** + * takes an Array of hashes as strings and returns the verification hash for that range of chunk hashes + * @param {string[]} chunk_hashes + * @returns {string} + */ +export function compute_verification_hash(chunk_hashes) { + let deferred3_0; + let deferred3_1; + try { + const ptr0 = passArrayJsValueToWasm0(chunk_hashes, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.compute_verification_hash(ptr0, len0); + var ptr2 = ret[0]; + var len2 = ret[1]; + if (ret[3]) { + ptr2 = 0; len2 = 0; + throw takeFromExternrefTable0(ret[2]); + } + deferred3_0 = ptr2; + deferred3_1 = len2; + return getStringFromWasm0(ptr2, len2); + } finally { + wasm.__wbindgen_free(deferred3_0, deferred3_1, 1); + } +} + +/** + * takes a hash and HMAC key (both as hex strings) and returns the HMAC result as a hex string + * @param {string} hash_hex + * @param {string} hmac_key_hex + * @returns {string} + */ +export function compute_hmac(hash_hex, hmac_key_hex) { + let deferred4_0; + let deferred4_1; + try { + const ptr0 = passStringToWasm0(hash_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + const ptr1 = passStringToWasm0(hmac_key_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + const ret = wasm.compute_hmac(ptr0, len0, ptr1, len1); + var ptr3 = ret[0]; + var len3 = ret[1]; + if (ret[3]) { + ptr3 = 0; len3 = 0; + throw takeFromExternrefTable0(ret[2]); + } + deferred4_0 = ptr3; + deferred4_1 = len3; + return getStringFromWasm0(ptr3, len3); + } finally { + wasm.__wbindgen_free(deferred4_0, deferred4_1, 1); + } +} + +const ChunkerFinalization = (typeof FinalizationRegistry === 'undefined') + ? { register: () => {}, unregister: () => {} } + : new FinalizationRegistry(ptr => wasm.__wbg_chunker_free(ptr >>> 0, 1)); + +export class Chunker { + + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + ChunkerFinalization.unregister(this); + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); + wasm.__wbg_chunker_free(ptr, 0); + } + /** + * @param {number} target_chunk_size + */ + constructor(target_chunk_size) { + const ret = wasm.chunker_new(target_chunk_size); + this.__wbg_ptr = ret >>> 0; + ChunkerFinalization.register(this, this.__wbg_ptr, this); + return this; + } + /** + * @param {Uint8Array} data + * @returns {any} + */ + add_data(data) { + const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.chunker_add_data(this.__wbg_ptr, ptr0, len0); + if (ret[2]) { + throw takeFromExternrefTable0(ret[1]); + } + return takeFromExternrefTable0(ret[0]); + } + /** + * @returns {any} + */ + finish() { + const ret = wasm.chunker_finish(this.__wbg_ptr); + if (ret[2]) { + throw takeFromExternrefTable0(ret[1]); + } + return takeFromExternrefTable0(ret[0]); + } +} + +export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) { + const ret = String(arg1); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; + +export function __wbg_buffer_609cc3eee51ed158(arg0) { + const ret = arg0.buffer; + return ret; +}; + +export function __wbg_call_672a4d21634d4a24() { return handleError(function (arg0, arg1) { + const ret = arg0.call(arg1); + return ret; +}, arguments) }; + +export function __wbg_done_769e5ede4b31c67b(arg0) { + const ret = arg0.done; + return ret; +}; + +export function __wbg_get_67b2ba62fc30de12() { return handleError(function (arg0, arg1) { + const ret = Reflect.get(arg0, arg1); + return ret; +}, arguments) }; + +export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) { + const ret = arg0[arg1 >>> 0]; + return ret; +}; + +export function __wbg_getwithrefkey_1dc361bd10053bfe(arg0, arg1) { + const ret = arg0[arg1]; + return ret; +}; + +export function __wbg_instanceof_ArrayBuffer_e14585432e3737fc(arg0) { + let result; + try { + result = arg0 instanceof ArrayBuffer; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; + +export function __wbg_instanceof_Uint8Array_17156bcf118086a9(arg0) { + let result; + try { + result = arg0 instanceof Uint8Array; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; + +export function __wbg_isArray_a1eab7e0d067391b(arg0) { + const ret = Array.isArray(arg0); + return ret; +}; + +export function __wbg_isSafeInteger_343e2beeeece1bb0(arg0) { + const ret = Number.isSafeInteger(arg0); + return ret; +}; + +export function __wbg_iterator_9a24c88df860dc65() { + const ret = Symbol.iterator; + return ret; +}; + +export function __wbg_length_a446193dc22c12f8(arg0) { + const ret = arg0.length; + return ret; +}; + +export function __wbg_length_e2d2a49132c1b256(arg0) { + const ret = arg0.length; + return ret; +}; + +export function __wbg_new_405e22f390576ce2() { + const ret = new Object(); + return ret; +}; + +export function __wbg_new_78feb108b6472713() { + const ret = new Array(); + return ret; +}; + +export function __wbg_new_a12002a7f91c75be(arg0) { + const ret = new Uint8Array(arg0); + return ret; +}; + +export function __wbg_next_25feadfc0913fea9(arg0) { + const ret = arg0.next; + return ret; +}; + +export function __wbg_next_6574e1a8a62d1055() { return handleError(function (arg0) { + const ret = arg0.next(); + return ret; +}, arguments) }; + +export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) { + arg0[arg1 >>> 0] = arg2; +}; + +export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) { + arg0[arg1] = arg2; +}; + +export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) { + arg0.set(arg1, arg2 >>> 0); +}; + +export function __wbg_value_cd1ffa7b1ab794f1(arg0) { + const ret = arg0.value; + return ret; +}; + +export function __wbindgen_as_number(arg0) { + const ret = +arg0; + return ret; +}; + +export function __wbindgen_boolean_get(arg0) { + const v = arg0; + const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2; + return ret; +}; + +export function __wbindgen_debug_string(arg0, arg1) { + const ret = debugString(arg1); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; + +export function __wbindgen_error_new(arg0, arg1) { + const ret = new Error(getStringFromWasm0(arg0, arg1)); + return ret; +}; + +export function __wbindgen_in(arg0, arg1) { + const ret = arg0 in arg1; + return ret; +}; + +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_4; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + +export function __wbindgen_is_function(arg0) { + const ret = typeof(arg0) === 'function'; + return ret; +}; + +export function __wbindgen_is_object(arg0) { + const val = arg0; + const ret = typeof(val) === 'object' && val !== null; + return ret; +}; + +export function __wbindgen_is_undefined(arg0) { + const ret = arg0 === undefined; + return ret; +}; + +export function __wbindgen_jsval_loose_eq(arg0, arg1) { + const ret = arg0 == arg1; + return ret; +}; + +export function __wbindgen_memory() { + const ret = wasm.memory; + return ret; +}; + +export function __wbindgen_number_get(arg0, arg1) { + const obj = arg1; + const ret = typeof(obj) === 'number' ? obj : undefined; + getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); +}; + +export function __wbindgen_number_new(arg0) { + const ret = arg0; + return ret; +}; + +export function __wbindgen_string_get(arg0, arg1) { + const obj = arg1; + const ret = typeof(obj) === 'string' ? obj : undefined; + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; + +export function __wbindgen_string_new(arg0, arg1) { + const ret = getStringFromWasm0(arg0, arg1); + return ret; +}; + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/node_modules/@huggingface/hub/src/vendor/xet-chunk/chunker_wasm_bg.wasm.base64.ts b/node_modules/@huggingface/hub/src/vendor/xet-chunk/chunker_wasm_bg.wasm.base64.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ecdcfc36bc0071a5a27a56d7022d82207bad226 --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/xet-chunk/chunker_wasm_bg.wasm.base64.ts @@ -0,0 +1,1370 @@ +// Generated by build-xet-wasm.sh +// Repository: https://github.com/huggingface/xet-core.git +// Branch: main +// Package: hf_xet_thin_wasm +// JS Target: bundler +// Build Date: 2025-09-10 23:53:23 UTC + +export const wasmBase64 = atob( + ` +AGFzbQEAAAABwAIuYAJ/fwF/YAN/f38Bf2ACf38AYAN/f38AYAR/f39/AGABfwBgAW8Bf2ABfwF/YAAEf39/f2AFf39/f38AYAFv +AW9gAABgAn9vAGAAAW9gBn9/f39/fwBgAAN/f39gAm9vAW9gBn9/f39/fwF/YAV/f39/fwF/YAR/f39/AX9gAn9/AW9gAm9vAX9g +AW8Ef39/f2ABbwF8YAF8AW9gA29vbwBgAm9/AW9gA29/bwBgA29vfwBgBX9/f35/AGAHf39/fn9/fwF/YAl/f39/f39+fn4AYAAB +f2ADfn9/AX9gB39/f39/f38Bf2AEf39/fwR/f39/YAJ/fwR/f39/YAN/f38Df39/YAF/A39/f2AFf399f38AYAR/fX9/AGAFf398 +f38AYAR/fH9/AGAFf39+f38AYAR/fn9/AGACf34BfgK/ECcYLi9oZl94ZXRfdGhpbl93YXNtX2JnLmpzFV9fd2JpbmRnZW5fc3Ry +aW5nX25ldwAUGC4vaGZfeGV0X3RoaW5fd2FzbV9iZy5qcxRfX3diaW5kZ2VuX2Vycm9yX25ldwAUGC4vaGZfeGV0X3RoaW5fd2Fz +bV9iZy5qcxRfX3diaW5kZ2VuX2lzX29iamVjdAAGGC4vaGZfeGV0X3RoaW5fd2FzbV9iZy5qcxdfX3diaW5kZ2VuX2lzX3VuZGVm +aW5lZAAGGC4vaGZfeGV0X3RoaW5fd2FzbV9iZy5qcw1fX3diaW5kZ2VuX2luABUYLi9oZl94ZXRfdGhpbl93YXNtX2JnLmpzFV9f +d2JpbmRnZW5fc3RyaW5nX2dld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IAQdyGwQBB0IbBADYCAEHQhsEAQciGwQA2AgBB5IbBAEHYhsEANgIAQdiGwQBB +0IbBADYCAEHshsEAQeCGwQA2AgBB4IbBAEHYhsEANgIAQfSGwQBB6IbBADYCAEHohsEAQeCGwQA2AgBB/IbBAEHwhsEANgIAQfCG +wQBB6IbBADYCAEGUh8EAIAFBD2pBeHEiAEEIayICNgIAQfiGwQBB8IbBADYCAEGMh8EAIARBKGsiAyABIABrakEIaiIANgIAIAIg +AEEBcjYCBCABIANqQSg2AgRBoIfBAEGAgIABNgIADAgLIAIgA0kgASACTXINACAAKAIMIgNBAXENACADQQF2IAZGDQMLQaSHwQBB +pIfBACgCACIAIAEgACABSRs2AgAgASAEaiEDQeiEwQAhAAJAAkADQCADIAAoAgAiB0cEQCAAKAIIIgANAQwCCwsgACgCDCIDQQFx +DQAgA0EBdiAGRg0BC0HohMEAIQADQAJAIAIgACgCACIDTwRAIAIgAyAAKAIEaiIHSQ0BCyAAKAIIIQAMAQsLQZSHwQAgAUEPakF4 +cSIAQQhrIgM2AgBBjIfBACAEQShrIgkgASAAa2pBCGoiADYCACADIABBAXI2AgQgASAJakEoNgIEQaCHwQBBgICAATYCACACIAdB +IGtBeHFBCGsiACAAIAJBEGpJGyIDQRs2AgRB6ITBACkCACEKIANBEGpB8ITBACkCADcCACADIAo3AghB9ITBACAGNgIAQeyEwQAg +BDYCAEHohMEAIAE2AgBB8ITBACADQQhqNgIAIANBHGohAANAIABBBzYCACAAQQRqIgAgB0kNAAsgAiADRg0HIAMgAygCBEF+cTYC +BCACIAMgAmsiAEEBcjYCBCADIAA2AgAgAEGAAk8EQCACIAAQVQwICyAAQfgBcUH4hMEAaiEBAn9BgIfBACgCACIDQQEgAEEDdnQi +AHFFBEBBgIfBACAAIANyNgIAIAEMAQsgASgCCAshACABIAI2AgggACACNgIMIAIgATYCDCACIAA2AggMBwsgACABNgIAIAAgACgC +BCAEajYCBCABQQ9qQXhxQQhrIgIgBUEDcjYCBCAHQQ9qQX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BEEBaiwAAEG/f0pqIARBAmosAABBv39KaiAEQQNqLAAAQb9/SmohAyAIIAVBBGoiBUcN +AAsLIAZFDQAgASAFaiEEA0AgAyAELAAAQb9/SmohAyAEQQFqIQQgBkEBayIGDQALCwJAIAMgB0kEQCAHIANrIQYCQAJAAkAgAC0A +GCIEQQAgBEEDRxsiA0EBaw4CAAECCyAGIQNBACEGDAELIAZBAXYhAyAGQQFqQQF2IQYLIANBAWohAyAAKAIQIQUgACgCICEEIAAo +AhwhAANAIANBAWsiA0UNAiAAIAUgBCgCEBEAAEUNAAtBAQ8LDAILIAAgASACIAQoAgwRAQAEQEEBDwtBACEDA0AgAyAGRgRAQQAP +CyADQQFqIQMgACAFIAQoAhARAABFDQALIANBAWsgBkkPCyAAKAIcIAEgAiAAKAIgKAIMEQEADwsgACgCHCABIAIgACgCICgCDBEB +AAveCAIKfwF+IwBBgAJrIgQkACAEIAEpABg3AhggBCABKQAQNwIQIAQgASkACDcCCCAEIAEpAAA3AgACfyADQYEITwRAIARBIGoh +BSMAQeAAayIBJAAgAUE4aiIGQgA3AwAgAUEwaiIHQgA3AwAgAUEoaiIIQgA3AwAgAUEgaiIJQgA3AwAgAUEYaiIKQgA3AwAgAUEQ +aiILQgA3AwAgAUEIaiIMQgA3AwAgAUIANwMAIAIgAyAEQgBBECABQcAAECohAiABQdgAakIANwMAIAFB0ABqQgA3AwAgAUHIAGpC +ADcDACABQgA3A0ACQAJAAkACQCACQQNPBEADQCACQQV0IgJBwQBPDQIgASACIARBECABQUBrIg1BIBA9IgJBBXQiA0HBAE8NAyAD +QSFPDQQgASANIAMQNRogAkECSw0ACwsgBSABKQMANwAAIAVBOGogBikDADcAACAFQTBqIAcpAwA3AAAgBUEoaiAIKQMANwAAIAVB +IGogCSkDADcAACAFQRhqIAopAwA3AAAgBUEQaiALKQMANwAAIAVBCGogDCkDADcAACABQeAAaiQADAMLIAJBwABBgL7AABDOAQAL +IANBwABBkL7AABDOAQALIANBIEGgvsAAEM4BAAsgBEH4AGogBEEYaikCADcDACAEQfAAaiAEQRBqKQIANwMAIARB6ABqIARBCGop +AgA3AwAgBCAEKQIANwNgQcAAIQNBFAwBCyAEQcgBakIANwMAIARBwAFqQgA3AwAgBEG4AWpCADcDACAEQbABakIANwMAIARBqAFq +QgA3AwAgBEGYAWpCADcDACAEQRA6APoBIARBoAFqQgA3AwAgBEHYAWoiBSAEQQhqKQIANwMAIARB6AFqIgYgBEEYaikCADcDACAE +QeABaiIHIARBEGopAgA3AwAgBEIANwOQASAEIAQpAgA3A9ABIARBADsB+AEgBEIANwPwASAEQZABaiACIAMQRSEBIARB6ABqIAUp +AwA3AwAgBEHwAGogBykDADcDACAEQfgAaiAGKQMANwMAIARBKGogAUEIaikDADcDACAEQTBqIAFBEGopAwA3AwAgBEE4aiABQRhq +KQMANwMAIARBQGsgAUEgaikDADcDACAEQcgAaiABQShqKQMANwMAIARB0ABqIAFBMGopAwA3AwAgBEHYAGogAUE4aikDADcDACAE +IAQpA9ABNwNgIAQgASkDADcDICAEKQPwASEOIAQtAPgBIQMgBC0A+gEgBC0A+QFFckECcgshASAEIA43A4ABIAQgAzoAiAEgBCAB +OgCJASAEQagBaiICIARB+ABqKQMANwMAIARBoAFqIgUgBEHwAGopAwA3AwAgBEGYAWoiBiAEQegAaikDADcDACAEIAQpA2A3A5AB +IARBkAFqIARBIGogA0IAIAFBCHIQJyAAIAIpAwA3ABggACAFKQMANwAQIAAgBikDADcACCAAIAQpA5ABNwAAIARBgAJqJAALuAsB +BX8jAEEgayIEJAACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAQ4oBgEBAQEBAQEBAgQBAQMBAQEBAQEBAQEBAQEBAQEBAQEBAQgB +AQEBBwALIAFB3ABGDQQLIAJBAXFFIAFBgAZJcg0HAn8CQEERQQAgAUGvsARPGyICIAJBCHIiAyABQQt0IgIgA0ECdEHg+8AAaigC +AEELdEkbIgMgA0EEciIDIANBAnRB4PvAAGooAgBBC3QgAksbIgMgA0ECciIDIANBA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QQFqLQAAOgAAIANBAmogAUECai0AADoAACADQQNqIAFBA2otAAA6AAAgA0EEaiABQQRqLQAAOgAA +IANBBWogAUEFai0AADoAACADQQZqIAFBBmotAAA6AAAgA0EHaiABQQdqLQAAOgAAIAFBCGohASADQQhqIgMgBkcNAAsLIAALhAYC +AX8BfCMAQTBrIgIkAAJ/AkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIAAtAABBAWsOEQECAwQFBgcICQoLDA0O +DxARAAsgAiAALQABOgAIIAJBAjYCFCACQdi/wAA2AhAgAkIBNwIcIAIgAkEIaq1CgICAgOAHhDcDKCACIAJBKGo2AhggASgCHCAB +KAIgIAJBEGoQOAwRCyACIAApAwg3AwggAkECNgIUIAJB9L/AADYCECACQgE3AhwgAiACQQhqrUKAgICA8AeENwMoIAIgAkEoajYC +GCABKAIcIAEoAiAgAkEQahA4DBALIAIgACkDCDcDCCACQQI2AhQgAkH0v8AANgIQIAJCATcCHCACIAJBCGqtQoCAgICACIQ3Aygg +AiACQShqNgIYIAEoAhwgASgCICACQRBqEDgMDwsgACsDCCEDIAJBAjYCFCACQZTAwAA2AhAgAkIBNwIcIAIgAkEoaq1CgICAgJAI +hDcDCCACIAM5AyggAiACQQhqNgIYIAEoAhwgASgCICACQRBqEDgMDgsgAiAAKAIENgIIIAJBAjYCFCACQbDAwAA2AhAgAkIBNwIc +IAIgAkEIaq1CgICAgKAIhDcDKCACIAJBKGo2AhggASgCHCABKAIgIAJBEGoQOAwNCyACIAApAgQ3AgggAkEBNgIUIAJByMDAADYC +ECACQgE3AhwgAiACQQhqrUKAgICAsAiENwMoIAIgAkEoajYCGCABKAIcIAEoAiAgAkEQahA4DAwLIAFBxL/AAEEKELoBDAsLIAFB +0MDAAEEKELoBDAoLIAFB2sDAAEEMELoBDAkLIAFB5sDAAEEOELoBDAgLIAFB9MDAAEEIELoBDAcLIAFB/MDAAEEDELoBDAYLIAFB +/8DAAEEEELoBDAULIAFBg8HAAEEMELoBDAQLIAFBj8HAAEEPELoBDAMLIAFBnsHAAEENELoBDAILIAFBq8HAAEEOELoBDAELIAEg +ACgCBCAAKAIIELoBCyACQTBqJAAL/gUBBX8gAEEIayIBIABBBGsoAgAiA0F4cSIAaiECAkACQCADQQFxDQAgA0ECcUUNASABKAIA +IgMgAGohACABIANrIgFBkIfBACgCAEYEQCACKAIEQQNxQQNHDQFBiIfBACAANgIAIAIgAigCBEF+cTYCBCABIABBAXI2AgQgAiAA +NgIADwsgASADEFALAkACQAJAAkACQCACKAIEIgNBAnFFBEAgAkGUh8EAKAIARg0CIAJBkIfBACgCAEYNAyACIANBeHEiAhBQIAEg +ACACaiIAQQFyNgIEIAAgAWogADYCACABQZCHwQAoAgBHDQFBiIfBACAANgIADwsgAiADQX5xNgIEIAEgAEEBcjYCBCAAIAFqIAA2 +AgALIABBgAJJDQIgASAAEFVBACEBQaiHwQBBqIfBACgCAEEBayIANgIAIAANBEHwhMEAKAIAIgAEQANAIAFBAWohASAAKAIIIgAN +AAsLQaiHwQBB/x8gASABQf8fTRs2AgAPC0GUh8EAIAE2AgBBjIfBAEGMh8EAKAIAIABqIgA2AgAgASAAQQFyNgIEQZCHwQAoAgAg +AUYEQEGIh8EAQQA2AgBBkIfBAEEANgIACyAAQaCHwQAoAgAiA00NA0GUh8EAKAIAIgJFDQNBACEAQYyHwQAoAgAiBEEpSQ0CQeiE +wQAhAQNAIAIgASgCACIFTwRAIAIgBSABKAIEakkNBAsgASgCCCEBDAALAAtBkIfBACABNgIAQYiHwQBBiIfBACgCACAAaiIANgIA +IAEgAEEBcjYCBCAAIAFqIAA2AgAPCyAAQfgBcUH4hMEAaiECAn9BgIfBACgCACIDQQEgAEEDdnQiAHFFBEBBgIfBACAAIANyNgIA +IAIMAQsgAigCCAshACACIAE2AgggACABNgIMIAEgAjYCDCABIAA2AggPC0HwhMEAKAIAIgEEQANAIABBAWohACABKAIIIgENAAsL +QaiHwQBB/x8gACAAQf8fTRs2AgAgAyAETw0AQaCHwQBBfzYCAAsL6gQBCn8jAEEwayIDJAAgAyABNgIsIAMgADYCKCADQQM6ACQg +A0IgNwIcIANBADYCFCADQQA2AgwCfwJAAkACQCACKAIQIgpFBEAgAigCDCIARQ0BIAIoAggiASAAQQN0aiEEIABBAWtB/////wFx +QQFqIQcgAigCACEAA0AgAEEEaigCACIFBEAgAygCKCAAKAIAIAUgAygCLCgCDBEBAA0ECyABKAIAIANBDGogAUEEaigCABEAAA0D +IABBCGohACABQQhqIgEgBEcNAAsMAQsgAigCFCIARQ0AIABBBXQhCyAAQQFrQf///z9xQQFqIQcgAigCCCEFIAIoAgAhAANAIABB +BGooAgAiAQRAIAMoAiggACgCACABIAMoAiwoAgwRAQANAwsgAyAIIApqIgFBEGooAgA2AhwgAyABQRxqLQAAOgAkIAMgAUEYaigC +ADYCICABQQxqKAIAIQRBACEJQQAhBgJAAkACQCABQQhqKAIAQQFrDgIAAgELIARBA3QgBWoiDCgCAA0BIAwoAgQhBAtBASEGCyAD +IAQ2AhAgAyAGNgIMIAFBBGooAgAhBAJAAkACQCABKAIAQQFrDgIAAgELIARBA3QgBWoiBigCAA0BIAYoAgQhBAtBASEJCyADIAQ2 +AhggAyAJNgIUIAUgAUEUaigCAEEDdGoiASgCACADQQxqIAFBBGooAgARAAANAiAAQQhqIQAgCyAIQSBqIghHDQALCyAHIAIoAgRP +DQEgAygCKCACKAIAIAdBA3RqIgAoAgAgACgCBCADKAIsKAIMEQEARQ0BC0EBDAELQQALIANBMGokAAvGBAEJfyMAQRBrIgQkAAJA +AkACfwJAIAAoAgBBAUYEQCAAKAIEIQcgBCABKAIMIgM2AgwgBCABKAIIIgI2AgggBCABKAIEIgU2AgQgBCABKAIAIgE2AgAgAC0A +GCEJIAAoAhAhCiAALQAUQQhxDQEgCiEIIAkMAgsgACgCHCAAKAIgIAEQPCECDAMLIAAoAhwgASAFIAAoAiAoAgwRAQANASAAQQE6 +ABhBMCEIIABBMDYCECAEQgE3AgAgByAFayEBQQAhBSABQQAgASAHT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BEAgASgCGCEDA0AgAygCACIGBEAgA0EEaigCACAGEMoBCyADQRBqIQMgAkEBayICDQALCyABKAIUIgME +QCABKAIYIANBBHQQygELIAEoAgwiA0GDAUsNAQwCCyAIIAEpAhQ3AgAgCEEIaiABQRxqKAIANgIAIAEoAgwiA0GDAU0NAQsgAxBv +CyABQTBqJAALIAcoAgwiAUGDAUsEQCABEG8LIAdBIGokACAEKAIQIQECQAJAAkAgBCgCDCIDQYCAgIB4RwRAIAQgAzYCICAEIAE2 +AhwgBCABNgIYIAQgASAEKAIUQQR0ajYCJCMAQYACayICJAAgBEEYaiIDKAIIIQkgAygCACEOIAMoAgQiByEBAkACQAJAAn8CQAJA +AkAgByADKAIMIgVGIgZFBEAgBzUCDCESIAcoAgAhASACQdgBaiAHKAIEIgMgBygCCBA0IAIoAtgBIgpFBEAgAkHQAWogAkH4AWop +AwA3AwAgAkHIAWogAkHwAWopAwA3AwAgAkHAAWogAkHoAWopAwA3AwAgAiACKQPgATcDuAELIAEEQCADIAEQygELIAdBEGohASAK +QQFxRQ0BCyABIAVHBEAgBSABa0EEdiEDA0AgASgCACIKBEAgAUEEaigCACAKEMoBCyABQRBqIQEgA0EBayIDDQALCyAJRQ0BIA4g +CUEEdBDKASAGDQIMBQsgAkEwaiIDIAJB0AFqKQMANwMAIAJBKGoiBiACQcgBaikDADcDACACQSBqIgogAkHAAWopAwA3AwAgAiAC +KQO4ATcDGEH5gsEALQAAGkGgAUEIEL4BIgdFDQMgByACKQMYNwMAIAcgEjcDICAHQRhqIAMpAwA3AwAgB0EQaiAGKQMANwMAIAdB +CGogCikDADcDAEEBIQYgAkEBNgIUIAIgBzYCECACQQQ2AgwCfwJAIAEgBUYEQCABIQMMAQsgAkHgAWohCkHIACEMA0AgATUCDCES +IAEoAgAhAyACQdgBaiABKAIEIgsgASgCCBA0IAIoAtgBIg1FBEAgAkHQAWogCkEYaikDADcDACACQcgBaiAKQRBqKQMANwMAIAJB +wAFqIApBCGopAwA3AwAgAiAKK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4BAAsgAyACQfDhwAAQzgEACyACIANPDQAgAyACQYDiwAAQzgEACyAAIAQ7AQggACADNgIEIAAgATYCAA8LIABBADYCAAub +AwECfwJAAkACQAJAIAAtAGgiAwRAIANBwQBPDQMgACADaiABIAJBwAAgA2siAyACIANJGyIDEDUaIAAgAC0AaCADaiIEOgBoIAEg +A2ohASACIANrIgJFBEBBACECDAILIABBQGsgAEHAACAAKQNgIAAtAGogAC0AaUVyECcgAEIANwMAIABBADoAaCAAQQhqQgA3AwAg +AEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgACAALQBpQQFqOgBpC0EA +IQMgAkHBAEkNASAAQUBrIQQgAC0AaSEDA0AgBCABQcAAIAApA2AgAC0AaiADQf8BcUVyECcgACAALQBpQQFqIgM6AGkgAUFAayEB +IAJBQGoiAkHAAEsNAAsgAC0AaCEECyAEQf8BcSIDQcEATw0CCyAAIANqIAEgAkHAACADayIBIAEgAksbIgEQNRogACAALQBoIAFq +OgBoIAAPCyADQcAAQfC8wAAQzQEACyADQcAAQfC8wAAQzQEAC+cCAQV/AkBBzf97QRAgACAAQRBNGyIAayABTQ0AIABBECABQQtq +QXhxIAFBC0kbIgRqQQxqECgiAkUNACACQQhrIQECQCAAQQFrIgMgAnFFBEAgASEADAELIAJBBGsiBSgCACIGQXhxIAIgA2pBACAA +a3FBCGsiAiAAQQAgAiABa0EQTRtqIgAgAWsiAmshAyAGQQNxBEAgACADIAAoAgRBAXFyQQJyNgIEIAAgA2oiAyADKAIEQQFyNgIE +IAUgAiAFKAIAQQFxckECcjYCACABIAJqIgMgAygCBEEBcjYCBCABIAIQQQwBCyABKAIAIQEgACADNgIEIAAgASACajYCAAsCQCAA +KAIEIgFBA3FFDQAgAUF4cSICIARBEGpNDQAgACAEIAFBAXFyQQJyNgIEIAAgBGoiASACIARrIgRBA3I2AgQgACACaiICIAIoAgRB +AXI2AgQgASAEEEELIABBCGohAwsgAwuCA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AA2AggMCgtBvJzAABDRAQALIAFBADYCGCABQQE2AgwgAUG8m8AANgIIDAgLIAMoAhgFQZSD +wQALKAIAIABsIgFPDQQgAUEASA0FQfmCwQAtAAAaQQEhByABQQEQvgEiBUUNBSAEIAE2AhwgBCAGNgIYIARB0JzAADYCCCAEQgA3 +AwAgBEEANgIoIAQgBTYCJCAEIAE2AiAgBCAAQQFrIgCtIABnQSBzrYY3AxAgA0EgaiQADAcLIANBADYCACMAQRBrIgAkACAAQaiV +wAA2AgwgACADQRxqNgIIIABBCGpB/LLAACAAQQxqQfyywAAgA0GQlsAAEEsAC0GglsAAQShByJbAABCQAQALQdiWwABBN0GQl8AA +EJABAAtBoJfAABCXAQALQbCXwABBL0Hgl8AAEJABAAsgByABQfCXwAAQsQEACyABQgQ3AhAgAUEIakHAmsAAEJ0BAAsgAkE4aiIA +QQA6AAAgAkH4AGogACkDADcCACACQfAAaiACQTBqKQMANwIAIAJB6ABqIAJBKGopAwA3AgAgAkHgAGogAkEgaikDADcCACACQdgA +aiACQRhqKQMANwIAIAJB0ABqIAJBEGopAwA3AgBB+YLBAC0AABogAiACKQMINwJIQcgAQQgQvgEiAEUEQEEIQcgAEOMBAAsgAEEA +NgIIIABCgYCAgBA3AwAgACACKQJENwIMIABBFGogAkHMAGopAgA3AgAgAEEcaiACQdQAaikCADcCACAAQSRqIAJB3ABqKQIANwIA +IABBLGogAkHkAGopAgA3AgAgAEE0aiACQewAaikCADcCACAAQTxqIAJB9ABqKQIANwIAIABBxABqIAJB/ABqKAIANgIAIAJBgAFq +JAAgAEEIagurAgEBfyMAQfAAayIGJAAgBiABNgIMIAYgADYCCCAGIAM2AhQgBiACNgIQIAZBuOXAADYCGCAGQQI2AhwCQCAEKAIA +RQRAIAZBAzYCXCAGQfTlwAA2AlggBkIDNwJkIAYgBkEQaq1CgICAgJAMhDcDSCAGIAZBCGqtQoCAgICQDIQ3A0AMAQsgBkEwaiAE +QRBqKQIANwMAIAZBKGogBEEIaikCADcDACAGI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ACIAFBBnZB +wAFyOgAMQQILIQMgBCABQT9xQYABcjoAACADIAAoAgAgACgCCCIBa0sEQCAAIAEgA0EBQQEQWCAAKAIIIQELIAAoAgQgAWogAkEM +aiADEDUaIAAgASADajYCCAwBCyAAKAIIIgMgACgCAEYEQCAAQZyMwAAQbAsgACgCBCADaiABOgAAIAAgA0EBajYCCAsgAkEQaiQA +QQALxAIBA38jAEEQayICJAACQCABQYABTwRAIAJBADYCDAJ/IAFBgBBPBEAgAUGAgARPBEAgAkEMakEDciEEIAIgAUESdkHwAXI6 +AAwgAiABQQZ2QT9xQYABcjoADiACIAFBDHZBP3FBgAFyOgANQQQMAgsgAkEMakECciEEIAIgAUEMdkHgAXI6AAwgAiABQQZ2QT9x +QYABcjoADUEDDAELIAJBDGpBAXIhBCACIAFBBnZBwAFyOgAMQQILIQMgBCABQT9xQYABcjoAACADIAAoAgAgACgCCCIBa0sEQCAA +IAEgAxBnIAAoAgghAQsgACgCBCABaiACQQxqIAMQNRogACABIANqNgIIDAELIAAoAggiAyAAKAIARgRAIABBnM3AABBsCyAAIANB +AWo2AgggACgCBCADaiABOgAACyACQRBqJABBAAvCAgECfyMAQRBrIgIkAAJAIAFBgAFPBEAgAkEANgIMAn8gAUGAEE8EQCABQYCA +BE8EQCACIAFBP3FBgAFyOgAPIAIgAUESdkHwAXI6AAwgAiABQQZ2QT9xQYABcjoADiACIAFBDHZBP3FBgAFyOgANQQQMAgsgAiAB +QT9xQYABcjoADiACIAFBDHZB4AFyOgAMIAIgAUEGdkE/cUGAAXI6AA1BAwwBCyACIAFBP3FBgAFyOgANIAIgAUEGdkHAAXI6AAxB +AgshASABIAAoAgAgACgCCCIDa0sEQCAAIAMgARBgIAAoAgghAwsgACgCBCADaiACQQxqIAEQNRogACABIANqNgIIDAELIAAoAggi +AyAAKAIARgRAIABBuMbAABBsCyAAKAIEIANqIAE6AAAgACADQQFqNgIICyACQRBqJABBAAvEAgEEfyAAQgA3AhAgAAJ/QQAgAUGA +AkkNAB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ADBH8gASADQQR0NgIcIAEgACgC +BDYCFEEEBUEACzYCGCABQQhqQQQgBCABQRRqEHMgASgCCEEBRw0BIAEoAhAhBSABKAIMBUEACyAFQbiQwAAQsQEACyABKAIMIQMg +ACACNgIAIAAgAzYCBCABQSBqJAAL8gEBAn8jAEEwayICJAACQCAAKQMAQv///////////wCDQoCAgICAgID4/wBaBEAgAkEBNgIU +IAJBvMHAADYCECACQgE3AhwgAiAArUKAgICAwAiENwMoIAIgAkEoajYCGCABKAIcIAEoAiAgAkEQahA4IQMMAQsgAkEAOgAMIAIg +ATYCCEEBIQMgAkEBNgIUIAJBvMHAADYCECACQgE3AhwgAiAArUKAgICAwAiENwMoIAIgAkEoajYCGCACQQhqQaS/wAAgAkEQahA4 +DQAgAi0ADEUEQCABQcTBwABBAhC6AQ0BC0EAIQMLIAJBMGokACADC7sBAQJ/IwBBIGsiAyQAAkACf0EAIAEgASACaiICSw0AGkEA +QQggAiAAKAIAIgFBAXQiBCACIARLGyICIAJBCE0bIgRBAEgNABpBACECIAMgAQR/IAMgATYCHCADIAAoAgQ2AhRBAQUgAgs2Ahgg +A0EIakEBIAQgA0EUahBzIAMoAghBAUcNASADKAIQIQAgAygCDAsgAEHQy8AAELEBAAsgAygCDCEBIAAgBDYCACAAIAE2AgQgA0Eg +aiQAC70BAQN/IwBBEGsiAiQAAkACQAJAIAFFBEAgAEUNASAAQQhrIgEoAgBBAUcNAiAAKAIsIAAoAighAyABQQA2AgACQCABQX9G +DQAgAEEEayIAIAAoAgBBAWsiADYCACAADQAgAUHIABDKAQsgA0UNAyADEMoBDAMLIABFDQAgAiAAQQhrIgA2AgwgACAAKAIAQQFr +IgA2AgAgAA0CIAJBDGoQjQEMAgsQ3QEAC0HbhcAAQT8Q3AEACyACQRBqJAALwQECA38BfiMAQTBrIgIkACABKAIAQYCAgIB4RgRA +IAEoAgwhAyACQRRqIgRBADYCACACQoCAgIAQNwIMIAJBIGogAygCACIDQQhqKQIANwMAIAJBKGogA0EQaikC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8AADAILQQRBDBDjAQALIAJBAXIhAUG4t8AACyEDIAAgATYCDCAA +IAQ2AgggACACNgIEIAAgAzYCAAukAQEBfyMAQUBqIgIkACAAKAIAIQAgAkIANwM4IAJBOGogACUBECMgAiACKAI8IgA2AjQgAiAC +KAI4NgIwIAIgADYCLCACIAJBLGqtQoCAgICACYQ3AyAgAkECNgIMIAJBoMPAADYCCCACQgE3AhQgAiACQSBqNgIQIAEoAhwgASgC +ICACQQhqEDggAigCLCIBBEAgAigCMCABEMoBCyACQUBrJAALiwEBAX8CQCACQQBOBEACfyADKAIEBEACQCADKAIIIgRFBEAMAQsg +AygCACAEIAEgAhC2AQwCCwsgASACRQ0AGkH5gsEALQAAGiACIAEQvgELIgMEQCAAIAI2AgggACADNgIEIABBADYCAA8LIAAgAjYC +CCAAIAE2AgQMAQsgAEEANgIECyAAQQE2AgALwAECBX8BbwJAIAEoAgAiBRDsASIDQQBIDQACQCADRQRAQQEhBAwBC0H5gsEALQAA +GkEBIQIgA0EBEL4BIgRFDQELECUhBxBIIgEgByYBIAEiBiUBEB4hBxBIIgEgByYBIAEQtQEhAiABQYQBTwRAIAEQbwsgAiUBIAUl +ASAEECAgAkGEAU8EQCACEG8LIAZBhAFPBEAgBhBvCyAAIAUQ7AE2AgggACAENgIEIAAgAzYCAA8LIAIgA0Hss8AAELEBAAuMAQEC +fwJAIAJBAEgNAAJ/IAJFBEBBACEBQQEhBEHAtsAADAELQfmCwQAtAAAaQQEhAyACQQEQvgEiBEUNAUHMt8AAIAQgASACEDUiAUEB +cQ0AGiABQQFyIQFBuLfAAAshAyAAIAE2AgwgACACNgIIIAAgBDYCBCAAIAM2AgAPCyADIAJBpLbAABCxAQALkgEBBH8jAEEQayIC +JABBASEEAkAgASgCHCIDQScgASgCICIFKAIQIgERAAANACACQQRqIAAoAgBBgQIQMwJAIAItAARBgAFGBEAgAyACKAIIIAERAABF +DQEMAgsgAyACLQAOIgAgAkEEamogAi0ADyAAayAFKAIMEQEADQELIANBJyAB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IoAgghASACKAIEDAILIAEoAgAiASgCBCIAQQBIDQIgASgCACEFIABFBEBB +ASEBQQAhAAwBC0H5gsEALQAAGkEBIQQgAEEBEL4BIgFFDQILIAEgBSAAEDUaIAALIQQgASAAELQBIAQEQCABIAQQygELIAJBEGok +AAwBCyAEIABBzJPAABCxAQALIANBMGokAAtqAgF/AX4jAEEwayIDJAAgAyABNgIEIAMgADYCACADQQI2AgwgA0GY5cAANgIIIANC +AjcCFCADQoCAgICgCSIEIAOthDcDKCADIAQgA0EEaq2ENwMgIAMgA0EgajYCECADQQhqIAIQnQEAC2cAIwBBMGsiACQAQfiCwQAt +AAAEQCAAQQI2AgwgAEGIycAANgIIIABCATcCFCAAIAE2AiwgACAAQSxqrUKAgICAoAmENwMgIAAgAEEgajYCECAAQQhqQbDJwAAQ +nQEACyAAQTBqJAALnAICA38BfiMAQRBrIgEkACABQaiDwQA2AgQgAEGwg8EALQAAQQNHBH8gASABQQRqNgIIIAEgAUEIajYCDCAB +QQxqIQIjAEEgayIAJAACQAJAAkACQAJAAkACQEGwg8EALQAAQQFrDgMCBAEAC0Gwg8EAQQI6AAAgAigCACIDKAIAIQIgA0EANgIA +IAJFDQIgAigCAEKACDcDAEGwg8EAQQM6AAALIABBIGokAAwECyAAQQA2AhggAEEBNgIMIABBqLDAADYCCAwCC0HoscAAENEBAAsg +AEEANgIYIABBATYCDCAAQeiwwAA2AggLIABCBDcCECAAQQhqQeyvwAAQnQEACyABKAIEBUGog8EACykDABCuASABQRBqJABQC14B +AX8jAEEwayICJAAgAiABNgIMIAIgADYCCCACQQI2AhQgAkHojMAANgIQIAJCATcCHCACIAJBCGqtQoCAgICwAYQ3AyggAiACQShq +NgIYIAJBEGoQZCACQTBqJAALXgEBfyMAQTBrIgIkACACIAE2AgwgAiAANgIIIAJBAjYCFCACQYyNwAA2AhAgAkIBNwIcIAIgAkEI +aq1CgICAgLABhDcDKCACIAJBKGo2AhggAkEQahBkIAJBMGokAAtbAQF/IAEoAgAiBEEBcQRAIAAgASAEIARBfnEgAiADEG0PCyAE +IAQoAggiAUEBajYCCCABQQBOBEAgACAENgIMIAAgAzYCCCAAIAI2AgQgAEG8uMAANgIADwsAC2MBAX9BACEBAkAgA0EATgRAIANF +BEBBASEEDAILQfmCwQAtAAAaQQEhASADQQEQvgEiBA0BCyABIANBpLbAABCxAQALIAQgAiADEDUhASAAIAM2AgggACABNgIEIAAg +AzYCAAtYAQF/IAEoAgAiBEEBcQRAIAAgASAEIAQgAiADEG0PCyAEIAQoAggiAUEBajYCCCABQQBOBEAgACAENgIMIAAgAzYCCCAA +IAI2AgQgAEG8uMAANgIADwsAC1gBAX8jAEEgayIDJAAgA0EYaiACQRhqKQAANwMAIANBEGogAkEQaikAADcDACADQQhqIAJBCGop +AAA3AwAgAyACKQAANwMAIAAgAyABQSAQMiADQSBqJAALTgAjAEEgayIAJAAgAEEBNgIEIABB4L7AADYCACAAQgE3AgwgAELIvsCA +wAc3AxggACAAQRhqNgIIIAEoAhwgASgCICAAEDggAEEgaiQAC00BAX8jAEEwayIBJAAgAUEBNgIMIAFBsOTAADYCCCABQgE3AhQg +ASABQS9qrUKAgICAgAyENwMgIAEgAUEgajYCECABQQhqIAAQnQEAC0MAIAEoAgAiAUEBcQRAIAFBfnEgAiADEOUBIQEgACADNgII +IAAgATYCBCAAIAIgA2ogAWs2AgAPCyAAIAEgAiADEF4LOgEBfyMAQSBrIgAkACAAQQA2AhggAEEBNgIMIABBtMrAADYCCCAAQgQ3 +AhAgAEEIakHoysAAEJ0BAAtFAQF/IAIgACgCACAAKAIIIgNrSwRAIAAgAyACQQFBARBYIAAoAgghAwsgACgCBCADaiABIAIQNRog +ACACIANqNgIIQQALQQEBfyACIAAoAgAgACgCCCIDa0sEQCAAIAMgAhBgIAAoAgghAwsgACgCBCADaiABIAIQNRogACACIANqNgII +QQALQAAgASgCACIBQQFxBEAgASACIAMQ5QEhASAAIAM2AgggACABNgIEIAAgAiADaiABazYCAA8LIAAgASACIAMQXgtCAQF/IAAo +AgAiACgCMCIBBEAgACgCNCABEMoBCwJAIABBf0YNACAAIAAoAgRBAWsiATYCBCABDQAgAEHIABDKAQsLTwECf0H5gsEALQAAGiAB +KAIEIQIgASgCACEDQQhBBBC+ASIBRQRAQQRBCBDjAQALIAEgAjYCBCABIAM2AgAgAEHQycAANgIEIAAgATYCAAtBAQF/IAIgACgC +ACAAKAIIIgNrSwRAIAAgAyACEGcgACgCCCEDCyAAKAIEIANqIAEgAhA1GiAAIAIgA2o2AghBAAtCAQF/IwBBIGsiAyQAIANBADYC +ECADQQE2AgQgA0IENwIIIAMgATYCHCADIAA2AhggAyADQRhqNgIAIAMgAhCdAQALQAEBfyABKAIAIgEgASgCCCIEQQFqNgIIIARB +AEgEQAALIAAgATYCDCAAIAM2AgggACACNgIEIABBvLjAADYCAAs8ACAAIAEpAAA3AAAgAEEYaiABQRhqKQAANwAAIABBEGogAUEQ +aikAADcAACAAQQhqIAFBCGopAAA3AAALjgIBA38gACgCACECIAEoAhQiAEEQcUUEQCAAQSBxRQRAIAIgARDQAQ8LQQAhACMAQYAB +ayIEJAAgAigCACECA0AgACAEakH/AGogAkEPcSIDQTByIANBN2ogA0EKSRs6AAAgAEEBayEAIAJBD0sgAkEEdiECDQALIAFBAUHc +5sAAQQIgACAEakGAAWpBACAAaxAwIARBgAFqJAAPC0EAIQAjAEGAAWsiBCQAIAIoAgAhAgNAIAAgBGpB/wBqIAJBD3EiA0EwciAD +QdcAaiADQQpJGzoAACAAQQFrIQAgAkEPSyACQQR2IQINAAsgAUEBQdzmwABBAiAAIARqQYABakEAIABrEDAgBEGAAWokAAvgcwMj +fxp+AXwgASgCFEEBcSECIAArAwAhPwJAIAEoAghBAUYEQAJ/IAEhCCABKAIMIRNBACEAIwBB8AhrIgkkACA/vSEnAn9BAyA/mUQA +AAAAAADwf2ENABpBAiAnQoCAgICAgID4/wCDIiZCgICAgICAgPj/AFENABogJ0L/////////B4MiKUKAgICAgICACIQgJ0IBhkL+ +////////D4MgJ0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EuARghACAFICU+ +AgwgBUEBQQIgJUKAgICAEFQiARs2AqwBIAVBACAlQiCIpyABGzYCECAFQRRqQQBBmAEQQxogBUG0AWpBAEGcARBDGiAFQQE2ArAB +IAVBATYC0AIgAKwgJUIBfXl9QsKawegEfkKAoc2gtAJ8QiCIpyIBwSEPAkAgAEEATgRAIAVBDGogABA/GgwBCyAFQbABakEAIABr +wRA/GgsCQCAPQQBIBEAgBUEMakEAIA9rQf//A3EQKQwBCyAFQbABaiABQf//AXEQKQsgBSgC0AIhDiAFQZwFaiAFQbABakGgARA1 +GiAFIA42ArwGIAciBkEKTwRAIAVBlAVqIQEDQCAFKAK8BiIEQSlPDQoCQCAERQ0AIARBAnQhAAJ/IARB/////wNqIgJB/////wNx +IgNFBEBCACElIAVBnAVqIABqDAELIAAgAWohBCADQQFqQf7///8HcSEDQgAhJQNAIARBBGoiACAANQIAICVCIIaEIiVCgJTr3AOA +IiY+AgAgBCAENQIAICUgJkKAlOvcA359QiCGhCIlQoCU69wDgCImPgIAICUgJkKAlOvcA359ISUgBEEIayEEIANBAmsiAw0ACyAE +QQhqCyACQQFxDQBBBGsiACAANQIAICVCIIaEQoCU69wDgD4CAAsgBkEJayIGQQlLDQALCyAGQQJ0QZjhwABqKAIAQQF0IgFFDQUg +BSgCvAYiBEEpTw0IIAQEfyAEQQJ0IQAgAa0hJQJ/IARB/////wNqIgFB/////wNxIgJFBEBCACEmIAVBnAVqIABqDAELIAJBAWpB +/v///wdxIQMgACAFakGUBWohBEIAISYDQCAEQQRqIgAgADUCACAmQiCGhCImICWAIic+AgAgBCAENQIAICYgJSAnfn1CIIaEIiYg +JYAiJz4CACAmICUgJ359ISYgBEEIayEEIANBAmsiAw0ACyAEQQhqCyEAIAFBAXFFBEAgAEEEayIAIAA1AgAgJkIghoQgJYA+AgAL +IAUoArwGBUEACyEAIAUoAqwBIgEgACAAIAFJGyIAQShLDREgAEUEQEEAIQAMCAsgAEEBcSEMIABBAUYEQEEAIQYMBwsgAEE+c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MiKUKAgICAgICACIQgJkIBhkL+////////D4MgJkI0 +iKdB/w9xIgAbIiVCAYMhKCAnUARAQQQgKVANARogAEGzCGshAEIBIScgKFAMAQtCgICAgICAgCAgJUIBhiAlQoCAgICAgIAIUSID +GyElQgJCASADGyEnQct3Qcx3IAMbIABqIQAgKFALIQMgBCAAOwF4IAQgJzcDcCAEQgE3A2ggBCAlNwNgIAQgAzoAegJAAn8CQAJA +AkAgA0ECayIDBEBBASEAQbvjwABBvOPAACAmQgBTIgYbQbvjwABBASAGGyACGyEYQQEgJkI/iKcgAhshGUEDIAMgA0EDTxtBAmsO +AgMCAQsgBEEDNgIoIARBvePAADYCJCAEQQI7ASBBASEYQQEhACAEQSBqDAMLIARBAzYCKCAEQcDjwAA2AiQgBEECOwEgIARBIGoM +AgsgBEEgaiEGIARBD2oiDiEIIwBBMGsiAyQAAkACQAJ/AkACQAJAAkACQAJAAkACQCAEQeAAaiIMIgApAwAiJVBFBEAgACkDCCIn +UA0BIAApAxAiJlANAiAlICZ8IiYgJVQNAyAlICdUDQQgJkKAgICAgICAgCBaDQUgAyAALwEYIgA7AQggAyAlICd9Iic3AwAgACAA +QSBrIAAgJkKAgICAEFQiAhsiC0EQayALICZCIIYgJiACGyImQoCAgICAgMAAVCICGyILQQhrIAsgJkIQhiAmIAIbIiZCgICAgICA +gIABVCICGyILQQRrIAsgJkIIhiAmIAIbIiZCgICAgICAgIAQVCICGyILQQJrIAsgJkIEhiAmIAIbIiZCgICAgICAgIDAAFQiAhsg +JkIChiAmIAIbIihCAFkiC2siAmvBIglBAEgNBiADQn8gCa0iKYgiJiAngzcDECAmICdUDQogAyAAOwEIIAMgJTcDACADICUgJoM3 +AxAgJSAmVg0KQaB/IAJrwUHQAGxBsKcFakHOEG0iAEHRAE8NByAAQQR0IgBBgNTAAGopAwAiKkL/////D4MiJiAlIClCP4MiJYYi +K0IgiCI1fiIsQiCIIjEgKkIgiCIpIDV+IjJ8ICkgK0L/////D4MiKn4iK0IgiCI2fCEzICxC/////w+DICYgKn5CIIh8ICtC//// +/w+DfCI3QoCAgIAIfEIgiCErQgFBACACIABBiNTAAGovAQBqa0E/ca0iLIYiKkIBfSEuICYgJyAlhiIlQiCIIid+Ii1C/////w+D +ICYgJUL/////D4MiJX5CIIh8ICUgKX4iJUL/////D4N8Ij5CgICAgAh8QiCIITQgJyApfiE4ICVCIIghOSAtQiCIITogAEGK1MAA +ai8BACEJICkgKCALrYYiJUIgiCI7fiI8ICYgO34iJ0IgiCIvfCApICVC/////w+DIiV+IihCIIgiMHwgJ0L/////D4MgJSAmfkIg +iHwgKEL/////D4N8Ij1CgICAgAh8QiCIfEIBfCItICyIpyIAQZDOAE8EQCAAQcCEPUkNCSAAQYDC1y9PBEBBCEEJIABBgJTr3ANJ +IgIbIQtBgMLXL0GAlOvcAyACGwwLC0EGQQcgAEGAreIESSICGyELQcCEPUGAreIEIAIbDAoLIABB5ABPBEBBAkEDIABB6AdJIgIb +IQtB5ABB6AcgAhsMCgtBCkEBIABBCUsiCxsMCQtB18/AAEEcQdDewAAQkAEAC0GE0MAAQR1B4N7AABCQAQALQbTQwABBHEHw3sAA +EJABAAtBmNLAAEE2QZDgwAAQkAEAC0HQ0cAAQTdBgODAABCQAQALQZDfwABBLUHA38AAEJABAAtBrM3AAEEdQezNwAAQkAEACyAA +QdEAQcDewAAQfQALQQRBBSAAQaCNBkkiAhshC0GQzgBBoI0GIAIbCyECICsgM3whMyAtIC6DISYgCyAJa0EBaiEJIC0gOCA6fCA5 +fCA0fH0iNEIBfCIoIC6DIScCQAJAAkACQAJAAkACQAJAA0AgACACbiEKIAFBEUYNAiABIAhqIg8gCkEwaiINOgAAAkAgACACIAps +ayIArSAshiIrICZ8IiUgKFoEQCABIAtHDQEgAUEBaiEBQgEhJQNAICUhKCAnISkgAUERTw0GIAEgCGogJkIKfiImICyIp0EwaiIC +OgAAIAFBAWohASAlQgp+ISUgJ0IKfiInICYgLoMiJlgNAAsgJSAtIDN9fiIsICV8ISsgJyAmfSAqVCIADQcgLCAlfSIsICZWDQMM +BwsgKCAlfSInIAKtICyGIihUIQIgLSAzfSIsQgF8ISogJyAoVCAsQgF9IiwgJVhyDQUgPUKAgICACHxCIIgiLSAvIDB8fCA8fCEn +QgIgOSA6fCA+QoCAgIAIfEIgiHwgOHwgJiAofCIlICt8fH0hLkIAIDEgNnwgN0KAgICACHxCIIh8IjEgMnwgJiArfHx9ITIgJSAx +fCApIDUgO31+fCAvfSAwfSAtfSEpA0AgJSArfCIvICxUICcgMnwgKSArfFpyRQRAICYgK3whJUEAIQIMBwsgDyANQQFrIg06AAAg +JiAofCEmICcgLnwhLSAsIC9WBEAgKCApfCEpICUgKHwhJSAnICh9IScgKCAtWA0BCwsgKCAtViECICYgK3whJQwFCyABQQFqIQEg +AkEKSSACQQpuIQJFDQALQdDfwAAQlwEACyABIAhqQQFrIQsgKiAxIDZ8IDdCgICAgAh8QiCIfCAyfEIKfiAvIDB8ID1CgICAgAh8 +QiCIfCA8fEIKfn0gKH58IS0gKUIKfiAmICp8fSEuICwgJn0hL0IAISkDQCAmICp8IiUgLFQgKSAvfCAmIC18WnJFBEBBACEADAUL +IAsgAkEBayICOgAAICkgLnwiMCAqVCEAICUgLFoNBSApICp9ISkgJSEmICogMFgNAAsMBAtBEUERQeDfwAAQfQALIAFBEUHw38AA +EH0ACwJAICUgKlogAnINACAqICUgKHwiJlggKiAlfSAmICp9VHENACAGQQA2AgAMBAsgJSA0QgN9WCAlQgJacUUEQCAGQQA2AgAM +BAsgBiAJOwEIIAYgAUEBajYCBAwCCyAmISULAkAgJSArWiAAcg0AICsgJSAqfCImWCArICV9ICYgK31UcQ0AIAZBADYCAAwCCyAl +IChCWH4gJ3xYICUgKEIUflpxRQRAIAZBADYCAAwCCyAGIAk7AQggBiABNgIECyAGIAg2AgALIANBMGokAAwBCyADQQA2AhgjAEEQ +ayIAJAAgACADNgIMIAAgA0EQajYCCCAAQQhqQajlwAAgAEEMakGo5cAAIANBGGpB/M3AABBLAAsCQC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ACAAIAZJIAAgB0tyBSAF +C0UNACACQShGDQMgAUH8CGogAkECdGpBATYCACACQQFqIQILIAEgAjYCnAogAiABKAKMBSIHIAIgB0sbIgBBKU8NAyAAQQJ0IQAC +QANAIAAEQEF/IABBBGsiACABQfwIamooAgAiAiAAIAFB7ANqaigCACIGRyACIAZLGyIIRQ0BDAILC0F/QQAgABshCAsgCCATSARA +IA1BAWohDQwCCwJAIANFBEBBACEDDAELIANBAWtB/////wNxIgBBAWoiAkEDcSEIAkAgAEEDSQRAIAEhAEIAISUMAQsgAkH8//// +B3EhBSABIQBCACElA0AgACAANQIAQgp+ICV8IiU+AgAgAEEEaiICIAI1AgBCCn4gJUIgiHwiJT4CACAAQQhqIgIgAjUCAEIKfiAl +QiCIfCIlPgIAIABBDGoiAiACNQIAQgp+ICVCIIh8Iic+AgAgJ0IgiCElIABBEGohACAFQQRrIgUNAAsLIAgEQANAIAAgADUCAEIK +fiAlfCInPgIAIABBBGohACAnQiCIISUgCEEBayIIDQALCyAnQoCAgIAQVA0AIANBKEYNAyABIANBAnRqICU+AgAgA0EBaiEDCyAB +IAM2AqABAkAgASgCxAIiBkEpSQRAQQAhAkEAIAZFDQIaIAZBAWtB/////wNxIgBBAWoiA0EDcSEIIABBA0kEQCABQaQBaiEAQgAh +JQwCCyADQfz///8HcSEFIAFBpAFqIQBCACElA0AgACAANQIAQgp+ICV8IiU+AgAgAEEEaiIDIAM1AgBCCn4gJUIgiHwiJT4CACAA +QQhqIgMgAzUCAEIKfiAlQiCIfCIlPgIAIABBDGoiAyADNQIAQgp+ICVCIIh8Iic+AgAgJ0IgiCElIABBEGohACAFQQRrIgUNAAsM +AQsMCgsgCARAA0AgACAANQIAQgp+ICV8Iic+AgAgAEEEaiEAICdCIIghJSAIQQFrIggNAAsLIAYgJ0KAgICAEFQNABogBkEoRg0C +IAFBpAFqIAZBAnRqICU+AgAgBkEBags2AsQCAkAgC0UNACALQQFrQf////8DcSIAQQFqIgJBA3EhCAJAIABBA0kEQC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oAgQgAkYEQCAFQQRqIQwjAEEgayIBJAACQAJAIAJBfyARIA5rQQAgBBsiBiAYIABrQQAgFBtqIhIg +BiASSxtBAWoiBkF/IAYbIAJqIgZLDQBBCCAGIAwoAgAiEkEBdCIVIAYgFUsbIgYgBkEITRsiFa0iHUIgiFBFDQAgHaciHEH///// +B0sNACABIBIEfyABIBI2AhwgASAMKAIENgIUQQEFQQALNgIYIAFBCGpBASAcIAFBFGoQcyABKAIIQQFHDQEgASgCECEGIAEoAgwh +FgsgFiAGQeyywAAQsQEACyABKAIMIQYgDCAVNgIAIAwgBjYCBCABQSBqJAAgBSgCCCEGCyACIAZqIBs6AAAgBSACQQFqIgI2AgwM +AAsACyAIIAFB0K3AABCxAQALIAVBEGokACAHQUBrIgBB4K7AACAHKAIQIgEgBygCFBAyIANBKGoiAiAAEJIBIAcoAgwiAARAIAEg +ABDKAQsgB0HgAGokACAPIAIQViAXRQ0BIBAgF0EFdBDKAQwBCyADQQA2AiQgA0KAgICAEDcCHCADQaCCwAA2AkggA0EDOgBAIANC +IDcCOCADQQA2AjAgA0EANgIoIAMgA0EcajYCRCADQc8AaiADQShqELcBDQEgAygCHCEAIAMoAiAiASADKAIkELMBIQIgAARAIAEg +ABDKAQsgD0GAgICAeDYCACAPIAI2AgQLIANB0ABqJAAMAQtByILAAEE3IANBzwBqQbiCwABB8IPAABB5AAsCQAJAIA0CfyAKKAIU +IgNBgICAgHhGBEBBACEAIAooAhghAUEBDAELIAooAhghAQJAIAooAhwiEyADTwRAIAEhAAwBCyATRQRAQQEhACABIAMQygEMAQsg +ASADQQEgExC2ASIARQ0CC0EAIQFBAAs2AgwgDSABNgIIIA0gEzYCBCANIAA2AgAgCkEgaiQADAELQQEgE0GQgsAAELEBAAsgDSgC +ACANKAIEIA0oAgggDSgCDCANQRBqJAALqQ0CGX8EfiMAQRBrIgskACMAQSBrIgYkAAJAAkACQCAABEAgAEEIayINIA0oAgBBAWoi +CTYCACAJRQ0BIAAoAgANAiAAQX82A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ASAENwIEIwBBEGsiACQAIAFBBGoiASgCACICKAIMIQMCQAJAAkACQCACKAIEDgIAAQILIAMNAUEBIQJBACED +DAILIAMNACACKAIAIgIoAgQhAyACKAIAIQIMAQsgAEGAgICAeDYCACAAIAE2AgwgAEH8ycAAIAEoAgQgASgCCCIALQAIIAAtAAkQ +agALIAAgAzYCBCAAIAI2AgAgAEHgycAAIAEoAgQgASgCCCIALQAIIAAtAAkQagALmwYBCn8jAEEQayIGJAAjAEEgayIFJAACQAJA +AkAgAARAIABBCGsiByAHKAIAQQFqIgM2AgAgA0UNASAAKAIADQIgAEF/NgIAIAUgBzYCHCAFIAA2AhggBSAAQQhqIgM2AhQgBUEI +aiEJIwBBkAFrIgEkACABQQA2AhQgAUKAgICAwAA3AgwjAEFAaiICJAAgAkEIaiADQQFBAEEBEC4gAUEYaiIEQShqIAJBMGopAwA3 +AwAgBEEgaiACQShqKQMANwMAIARBGGogAkEgaikDADcDACAEQRBqIAJBGGopAwA3AwAgBEEIaiACQRBqKQMANwMAIAQgAikDCDcD +ACACQUBrJAAgASgCGARAIAFB8ABqIAFBQGspAwA3AwAgAUHoAGogAUE4aikDADcDACABQeAAaiABQTBqKQMANwMAIAFB2ABqIgIg +AUEoaikDADcDACABQdAAaiIEIAFBIGopAwA3AwAgASABKQMYNwNIIAIQfyEIIAFB/ABqIAIQViABIAg6AIwBIAEgBCgCACICNgKI +ASABQdQAaiABKAJMIAIgASgCSCgCEBEDACABKAIUIgIgASgCDEYEQCABQQxqQcSGwAAQYwsgASgCECACQRRsaiIEIAEpAnw3AgAg +BEEIaiABQYQBaikCADcCACAEQRBqIAFBjAFqKAIANgIAIANBAToAMCABIAJBAWo2AhQLIAFBADYCGCABIAFBGGogAUEMahBhIAEo +AgQhBCABKAIAIQggASgCFCICBEAgASgCECEDA0AgAygCACIKBEAgA0EEaigCACAKEMoBCyADQRRqIQMgAkEBayICDQALCyABKAIM +IgMEQCABKAIQIANBFGwQygELIAkgBDYCBCAJIAg2AgAg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AAiAAQoCAgICAAjcC+AEg +AEECNgLwASAAQQM6AOwBIABBCDYC6AEgAEKggICAIDcC4AEgAEKAgICAgAI3AtgBIABBAjYC0AEgAEEDOgDMASAAQQg2AsgBIABC +oICAgBA3AsABIABCgICAgIACNwK4ASAAQQI2ArABIABBAzoArAEgAEEINgKoASAAQiA3AqABIABCgICAgIACNwKYASAAQQI2ApAB +IABBBDYCTCAAQQQ2AjwgAEHkusAANgI4IABBBDYCRCAAIABBkAFqNgJIIAAgAEHQAGo2AkAgAEEsaiICIABBOGoQRyAAIAKtQoCA +gICwB4Q3AyAgAEEBNgIMIABB9LvAADYCCCAAQgE3AhQgACAAQSBqNgIQIAEoAhwgASgCICAAQQhqEDggACgCLCICBEAgACgCMCAC +EMoBCyAAQZACaiQACw0AIABBiJLAACABEDgLDgAgAUG0tsAAQQsQugELDQAgAEGkv8AAIAEQOAsJACAAIAEQJAALDQBBgMXAAEEb +ENwBAAsOAEGbxcAAQc8AENwBAAsNACAAQaTHwAAgARA4CwwAIAAgASkCADcDAAsNACAAQYDLwAAgARA4Cw4AIAFB+MrAAEEFELoB +CxoAIAAgAUHUg8EAKAIAIgBBywAgABsRAgAACwoAIAIgACABEDELxgkBCH8CQAJAIAIiBSAAIgcgAWtLBEAgASACaiEAIAIgB2oh +AiAFQRBJDQFBACACQQNxIgZrIQkCQCACQXxxIgMgAk8NACAGQQFrAkAgBkUEQCAAIQQMAQsgBiEIIAAhBANAIAJBAWsiAiAEQQFr +IgQtAAA6AAAgCEEBayIIDQALC0EDSQ0AIARBBGshBANAIAJBAWsgBEEDai0AADoAACACQQJrIARBAmotAAA6AAAgAkEDayAEQQFq +LQAAOgAAIAJBBGsiAiAELQAAOgAAIARBBGshBCACIANLDQALCyADIAUgBmsiBEF8cSIFayECQQAgBWshBgJAIAAgCWoiAEEDcUUE +QCACIANPDQEgASAEakEEayEBA0AgA0EEayIDIAEoAgA2AgAgAUEEayEBIAIgA0kNAAsMAQsgAiADTw0AIABBA3QiBUE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GAQIBnQEDCBUCOQIBAQEBDAEJAQ4HAwVDAQIGAQECAQEDBAMBAQ4CVQgCAwEBFwFRAQIGAQEC +AQECAQLrAQIEBgIBAhsCVQgCAQECagEBAQIIZQEBAQIEAQUACQEC9QEKBAQBkAQCAgQBIAooBgIECAEJBgIDLg0BAgAHAQYBAVIW +AgcBAgECegYDAQECAQcBAUgCAwEBAQACCwI0BQUDFwEAAQYPAAwDAwAFOwcAAT8EUQELAgACAC4CFwAFAwYICAIHHgSUAwA3BDII +AQ4BFgUBDwAHARECBwECAQVkAaAHAAE9BAAE/gIAB20HAGCA8ABB8ILBAAsBSQBwCXByb2R1Y2VycwIIbGFuZ3VhZ2UBBFJ1c3QA +DHByb2Nlc3NlZC1ieQMFcnVzdGMdMS44Ni4wICgwNWY5ODQ2ZjggMjAyNS0wMy0zMSkGd2FscnVzBjAuMjMuMwx3YXNtLWJpbmRn +ZW4HMC4yLjEwMABJD3RhcmdldF9mZWF0dXJlcwQrD211dGFibGUtZ2xvYmFscysIc2lnbi1leHQrD3JlZmVyZW5jZS10eXBlcysK +bXVsdGl2YWx1ZQ== +` + .trim() + .replaceAll("\n", ""), +); +const wasmBinary = new Uint8Array(wasmBase64.length); +for (let i = 0; i < wasmBase64.length; i++) { + wasmBinary[i] = wasmBase64.charCodeAt(i); +} +export { wasmBinary }; diff --git a/node_modules/@huggingface/hub/src/vendor/xet-chunk/chunker_wasm_bg.wasm.d.ts b/node_modules/@huggingface/hub/src/vendor/xet-chunk/chunker_wasm_bg.wasm.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f801c69db889b8f690c747f2ac6a4d5ba31e3175 --- /dev/null +++ b/node_modules/@huggingface/hub/src/vendor/xet-chunk/chunker_wasm_bg.wasm.d.ts @@ -0,0 +1,19 @@ +/* tslint:disable */ +/* eslint-disable */ +export const memory: WebAssembly.Memory; +export const __wbg_chunker_free: (a: number, b: number) => void; +export const chunker_new: (a: number) => number; +export const chunker_add_data: (a: number, b: number, c: number) => [number, number, number]; +export const chunker_finish: (a: number) => [number, number, number]; +export const compute_xorb_hash: (a: any) => [number, number, number, number]; +export const compute_file_hash: (a: any) => [number, number, number, number]; +export const compute_verification_hash: (a: number, b: number) => [number, number, number, number]; +export const compute_hmac: (a: number, b: number, c: number, d: number) => [number, number, number, number]; +export const __wbindgen_malloc: (a: number, b: number) => number; +export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; +export const __wbindgen_exn_store: (a: number) => void; +export const __externref_table_alloc: () => number; +export const __wbindgen_export_4: WebAssembly.Table; +export const __externref_table_dealloc: (a: number) => void; +export const __wbindgen_free: (a: number, b: number, c: number) => void; +export const __wbindgen_start: () => void; diff --git a/node_modules/@huggingface/hub/tsconfig.json b/node_modules/@huggingface/hub/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..39d83f3de17ed66fd4c6afa8dad7491bd1fd356c --- /dev/null +++ b/node_modules/@huggingface/hub/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "lib": ["ES2022", "DOM"], + "module": "CommonJS", + "moduleResolution": "node", + "target": "ES2022", + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "strict": true, + "noImplicitAny": true, + "strictNullChecks": true, + "skipLibCheck": true, + "noImplicitOverride": true, + "outDir": "./dist", + "declaration": true, + "declarationMap": true, + "sourceMap": true + }, + "include": ["src", "index.ts", "cli.ts"], + "exclude": ["dist"] +} diff --git a/node_modules/@huggingface/tasks/LICENSE b/node_modules/@huggingface/tasks/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..1e25cde938b8abaa64a25aba817a01b7aba6472d --- /dev/null +++ b/node_modules/@huggingface/tasks/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Hugging Face + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/README.md b/node_modules/@huggingface/tasks/README.md new file mode 100644 index 0000000000000000000000000000000000000000..3d49eb3a8a963177742bf062d844fdf2c7f7890a --- /dev/null +++ b/node_modules/@huggingface/tasks/README.md @@ -0,0 +1,32 @@ +# Tasks + +This package contains the definition files (written in Typescript) for the huggingface.co hub's: + +- **pipeline types** (a.k.a. **task types**) - used to determine which widget to display on the model page, and which inference API to run. +- **default widget inputs** - when they aren't provided in the model card. +- definitions and UI elements for **model and dataset libraries**. + +Please add any missing ones to these definitions by opening a PR. Thanks 🔥 + +⚠️ The hub's definitive doc is at https://huggingface.co/docs/hub. + +## Definition of Tasks + +This package also contains data used to define https://huggingface.co/tasks. + +The Task pages are made to lower the barrier of entry to understand a task that can be solved with machine learning and use or train a model to accomplish it. It's a collaborative documentation effort made to help out software developers, social scientists, or anyone with no background in machine learning that is interested in understanding how machine learning models can be used to solve a problem. + +The task pages avoid jargon to let everyone understand the documentation, and if specific terminology is needed, it is explained on the most basic level possible. This is important to understand before contributing to Tasks: at the end of every task page, the user is expected to be able to find and pull a model from the Hub and use it on their data and see if it works for their use case to come up with a proof of concept. + +## How to Contribute +You can open a pull request to contribute a new documentation about a new task. Under `src/tasks` we have a folder for every task that contains two files, `about.md` and `data.ts`. `about.md` contains the markdown part of the page, use cases, resources and minimal code block to infer a model that belongs to the task. `data.ts` contains redirections to canonical models and datasets, metrics, the schema of the task and the information the inference widget needs. + +![Anatomy of a Task Page](https://huggingface.co/datasets/huggingfacejs/tasks/resolve/main/contribution-guide/anatomy.png) + +We have a [`dataset`](https://huggingface.co/datasets/huggingfacejs/tasks) that contains data used in the inference widget. The last file is `const.ts`, which has the task to library mapping (e.g. spacy to token-classification) where you can add a library. They will look in the top right corner like below. + +![Libraries of a Task](https://huggingface.co/datasets/huggingfacejs/tasks/resolve/main/contribution-guide/libraries.png) + +This might seem overwhelming, but you don't necessarily need to add all of these in one pull request or on your own, you can simply contribute one section. Feel free to ask for help whenever you need. + +## Feedback (feature requests, bugs, etc.) is super welcome 💙💚💛💜♥️🧡 diff --git a/node_modules/@huggingface/tasks/dist/commonjs/dataset-libraries.d.ts b/node_modules/@huggingface/tasks/dist/commonjs/dataset-libraries.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7dc46b97a7ba271fef3a38989e1f0dcd6a5e6af6 --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/dataset-libraries.d.ts @@ -0,0 +1,99 @@ +/** + * Elements configurable by a dataset library. + */ +export interface DatasetLibraryUiElement { + /** + * Pretty name of the library. + * displayed (in tags?, and) on the main + * call-to-action button on the dataset page. + */ + prettyLabel: string; + /** + * Repo name of the library's (usually on GitHub) code repo + */ + repoName: string; + /** + * URL to library's (usually on GitHub) code repo + */ + repoUrl: string; + /** + * URL to library's docs + */ + docsUrl?: string; +} +export declare const DATASET_LIBRARIES_UI_ELEMENTS: { + mlcroissant: { + prettyLabel: string; + repoName: string; + repoUrl: string; + docsUrl: string; + }; + webdataset: { + prettyLabel: string; + repoName: string; + repoUrl: string; + docsUrl: string; + }; + datasets: { + prettyLabel: string; + repoName: string; + repoUrl: string; + docsUrl: string; + }; + pandas: { + prettyLabel: string; + repoName: string; + repoUrl: string; + docsUrl: string; + }; + dask: { + prettyLabel: string; + repoName: string; + repoUrl: string; + docsUrl: string; + }; + distilabel: { + prettyLabel: string; + repoName: string; + repoUrl: string; + docsUrl: string; + }; + fiftyone: { + prettyLabel: string; + repoName: string; + repoUrl: string; + docsUrl: string; + }; + lance: { + prettyLabel: string; + repoName: string; + repoUrl: string; + docsUrl: string; + }; + argilla: { + prettyLabel: string; + repoName: string; + repoUrl: string; + docsUrl: string; + }; + polars: { + prettyLabel: string; + repoName: string; + repoUrl: string; + docsUrl: string; + }; + duckdb: { + prettyLabel: string; + repoName: string; + repoUrl: string; + docsUrl: string; + }; + datadesigner: { + prettyLabel: string; + repoName: string; + repoUrl: string; + docsUrl: string; + }; +}; +export type DatasetLibraryKey = keyof typeof DATASET_LIBRARIES_UI_ELEMENTS; +//# sourceMappingURL=dataset-libraries.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/dist/commonjs/dataset-libraries.d.ts.map b/node_modules/@huggingface/tasks/dist/commonjs/dataset-libraries.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..8c7553eddf91259a20de8bdc39ec70c1733e4dac --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/dataset-libraries.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"dataset-libraries.d.ts","sourceRoot":"","sources":["../../src/dataset-libraries.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyES,CAAC;AAGpD,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,6BAA6B,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/dist/commonjs/dataset-libraries.js b/node_modules/@huggingface/tasks/dist/commonjs/dataset-libraries.js new file mode 100644 index 0000000000000000000000000000000000000000..2fe1f0c33dbca3fe6c3c511730fd43c4b28eb6a9 --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/dataset-libraries.js @@ -0,0 +1,77 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DATASET_LIBRARIES_UI_ELEMENTS = void 0; +exports.DATASET_LIBRARIES_UI_ELEMENTS = { + mlcroissant: { + prettyLabel: "Croissant", + repoName: "croissant", + repoUrl: "https://github.com/mlcommons/croissant/tree/main/python/mlcroissant", + docsUrl: "https://huggingface.co/docs/dataset-viewer/mlcroissant", + }, + webdataset: { + prettyLabel: "WebDataset", + repoName: "webdataset", + repoUrl: "https://github.com/webdataset/webdataset", + docsUrl: "https://huggingface.co/docs/hub/datasets-webdataset", + }, + datasets: { + prettyLabel: "Datasets", + repoName: "datasets", + repoUrl: "https://github.com/huggingface/datasets", + docsUrl: "https://huggingface.co/docs/hub/datasets-usage", + }, + pandas: { + prettyLabel: "pandas", + repoName: "pandas", + repoUrl: "https://github.com/pandas-dev/pandas", + docsUrl: "https://huggingface.co/docs/hub/datasets-pandas", + }, + dask: { + prettyLabel: "Dask", + repoName: "dask", + repoUrl: "https://github.com/dask/dask", + docsUrl: "https://huggingface.co/docs/hub/datasets-dask", + }, + distilabel: { + prettyLabel: "Distilabel", + repoName: "distilabel", + repoUrl: "https://github.com/argilla-io/distilabel", + docsUrl: "https://huggingface.co/docs/hub/datasets-distilabel", + }, + fiftyone: { + prettyLabel: "FiftyOne", + repoName: "fiftyone", + repoUrl: "https://github.com/voxel51/fiftyone", + docsUrl: "https://huggingface.co/docs/hub/datasets-fiftyone", + }, + lance: { + prettyLabel: "Lance", + repoName: "lance", + repoUrl: "https://github.com/lance-format/lance", + docsUrl: "https://huggingface.co/docs/hub/datasets-lance", + }, + argilla: { + prettyLabel: "Argilla", + repoName: "argilla", + repoUrl: "https://github.com/argilla-io/argilla", + docsUrl: "https://huggingface.co/docs/hub/datasets-argilla", + }, + polars: { + prettyLabel: "Polars", + repoName: "polars", + repoUrl: "https://github.com/pola-rs/polars", + docsUrl: "https://huggingface.co/docs/hub/datasets-polars", + }, + duckdb: { + prettyLabel: "DuckDB", + repoName: "duckdb", + repoUrl: "https://github.com/duckdb/duckdb", + docsUrl: "https://huggingface.co/docs/hub/datasets-duckdb", + }, + datadesigner: { + prettyLabel: "NeMo Data Designer", + repoName: "datadesigner", + repoUrl: "https://github.com/NVIDIA-NeMo/DataDesigner", + docsUrl: "https://nvidia-nemo.github.io/DataDesigner/", + }, +}; diff --git a/node_modules/@huggingface/tasks/dist/commonjs/default-widget-inputs.d.ts b/node_modules/@huggingface/tasks/dist/commonjs/default-widget-inputs.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b9bd77d2be8a451d248b0f8776226127e315a039 --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/default-widget-inputs.d.ts @@ -0,0 +1,6 @@ +import type { WidgetExample } from "./widget-example.js"; +import type { WidgetType } from "./pipelines.js"; +type PerLanguageMapping = Map; +export declare const MAPPING_DEFAULT_WIDGET: Map; +export {}; +//# sourceMappingURL=default-widget-inputs.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/dist/commonjs/default-widget-inputs.d.ts.map b/node_modules/@huggingface/tasks/dist/commonjs/default-widget-inputs.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..e652e43f9eb09082b9409d0ec2c35eca1d52a541 --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/default-widget-inputs.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"default-widget-inputs.d.ts","sourceRoot":"","sources":["../../src/default-widget-inputs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAIjD,KAAK,kBAAkB,GAAG,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,CAAC,CAAC;AAoqBtE,eAAO,MAAM,sBAAsB,iCAejC,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/dist/commonjs/default-widget-inputs.js b/node_modules/@huggingface/tasks/dist/commonjs/default-widget-inputs.js new file mode 100644 index 0000000000000000000000000000000000000000..9bfab33a3603c28c68a01d8827e69f21526b670c --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/default-widget-inputs.js @@ -0,0 +1,677 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MAPPING_DEFAULT_WIDGET = void 0; +/// NOTE TO CONTRIBUTORS: +/// +/// When adding sample inputs for a new language, you don't +/// necessarily have to translate the inputs from existing languages. +/// (which were quite random to begin with) +/// +/// i.e. Feel free to be creative and provide better samples. +// +/// The placeholder will be replaced by the correct mask token +/// in the following examples, depending on the model type +/// +/// see [INTERNAL] github.com/huggingface/moon-landing/blob/c5c3d45fe0ab27347b3ab27bdad646ef20732351/server/lib/App.ts#L254 +// +const MAPPING_EN = new Map([ + ["text-classification", [`I like you. I love you`]], + [ + "token-classification", + [ + `My name is Wolfgang and I live in Berlin`, + `My name is Sarah and I live in London`, + `My name is Clara and I live in Berkeley, California.`, + ], + ], + [ + "table-question-answering", + [ + { + text: `How many stars does the transformers repository have?`, + table: { + Repository: ["Transformers", "Datasets", "Tokenizers"], + Stars: [36542, 4512, 3934], + Contributors: [651, 77, 34], + "Programming language": ["Python", "Python", "Rust, Python and NodeJS"], + }, + }, + ], + ], + [ + "question-answering", + [ + { + text: `Where do I live?`, + context: `My name is Wolfgang and I live in Berlin`, + }, + { + text: `Where do I live?`, + context: `My name is Sarah and I live in London`, + }, + { + text: `What's my name?`, + context: `My name is Clara and I live in Berkeley.`, + }, + { + text: `Which name is also used to describe the Amazon rainforest in English?`, + context: `The Amazon rainforest (Portuguese: Floresta Amazônica or Amazônia; Spanish: Selva Amazónica, Amazonía or usually Amazonia; French: Forêt amazonienne; Dutch: Amazoneregenwoud), also known in English as Amazonia or the Amazon Jungle, is a moist broadleaf forest that covers most of the Amazon basin of South America. This basin encompasses 7,000,000 square kilometres (2,700,000 sq mi), of which 5,500,000 square kilometres (2,100,000 sq mi) are covered by the rainforest. This region includes territory belonging to nine nations. The majority of the forest is contained within Brazil, with 60% of the rainforest, followed by Peru with 13%, Colombia with 10%, and with minor amounts in Venezuela, Ecuador, Bolivia, Guyana, Suriname and French Guiana. States or departments in four nations contain "Amazonas" in their names. The Amazon represents over half of the planet's remaining rainforests, and comprises the largest and most biodiverse tract of tropical rainforest in the world, with an estimated 390 billion individual trees divided into 16,000 species.`, + }, + ], + ], + [ + "zero-shot-classification", + [ + { + text: "I have a problem with my iphone that needs to be resolved asap!", + candidate_labels: "urgent, not urgent, phone, tablet, computer", + multi_class: true, + }, + { + text: "Last week I upgraded my iOS version and ever since then my phone has been overheating whenever I use your app.", + candidate_labels: "mobile, website, billing, account access", + multi_class: false, + }, + { + text: "A new model offers an explanation for how the Galilean satellites formed around the solar system’s largest world. Konstantin Batygin did not set out to solve one of the solar system’s most puzzling mysteries when he went for a run up a hill in Nice, France. Dr. Batygin, a Caltech researcher, best known for his contributions to the search for the solar system’s missing “Planet Nine,” spotted a beer bottle. At a steep, 20 degree grade, he wondered why it wasn’t rolling down the hill. He realized there was a breeze at his back holding the bottle in place. Then he had a thought that would only pop into the mind of a theoretical astrophysicist: “Oh! This is how Europa formed.” Europa is one of Jupiter’s four large Galilean moons. And in a paper published Monday in the Astrophysical Journal, Dr. Batygin and a co-author, Alessandro Morbidelli, a planetary scientist at the Côte d’Azur Observatory in France, present a theory explaining how some moons form around gas giants like Jupiter and Saturn, suggesting that millimeter-sized grains of hail produced during the solar system’s formation became trapped around these massive worlds, taking shape one at a time into the potentially habitable moons we know today.", + candidate_labels: "space & cosmos, scientific discovery, microbiology, robots, archeology", + multi_class: true, + }, + ], + ], + ["translation", [`My name is Wolfgang and I live in Berlin`, `My name is Sarah and I live in London`]], + [ + "summarization", + [ + `The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct.`, + ], + ], + [ + "conversational", + [ + `Hi, what can you help me with?`, + `What is 84 * 3 / 2?`, + `Tell me an interesting fact about the universe!`, + `Explain quantum computing in simple terms.`, + ], + ], + [ + "text-generation", + [ + `My name is Julien and I like to`, + `I like traveling by train because`, + `Paris is an amazing place to visit,`, + `Once upon a time,`, + ], + ], + ["fill-mask", [`Paris is the of France.`, `The goal of life is .`]], + [ + "sentence-similarity", + [ + { + source_sentence: "That is a happy person", + sentences: ["That is a happy dog", "That is a very happy person", "Today is a sunny day"], + }, + ], + ], +]); +const MAPPING_ZH = new Map([ + ["text-classification", [`我喜欢你。 我爱你`]], + ["token-classification", [`我叫沃尔夫冈,我住在柏林。`, `我叫萨拉,我住在伦敦。`, `我叫克拉拉,我住在加州伯克利。`]], + [ + "question-answering", + [ + { + text: `我住在哪里?`, + context: `我叫沃尔夫冈,我住在柏林。`, + }, + { + text: `我住在哪里?`, + context: `我叫萨拉,我住在伦敦。`, + }, + { + text: `我的名字是什么?`, + context: `我叫克拉拉,我住在伯克利。`, + }, + ], + ], + ["translation", [`我叫沃尔夫冈,我住在柏林。`, `我叫萨拉,我住在伦敦。`]], + [ + "zero-shot-classification", + [ + { + text: "房间干净明亮,非常不错", + candidate_labels: "这是一条差评, 这是一条好评", + }, + ], + ], + [ + "summarization", + [ + `该塔高324米(1063英尺),与一幢81层的建筑物一样高,是巴黎最高的建筑物。 它的底座是方形的,每边长125米(410英尺)。 在建造过程中,艾菲尔铁塔超过了华盛顿纪念碑,成为世界上最高的人造结构,它保持了41年的头衔,直到1930年纽约市的克莱斯勒大楼竣工。这是第一个到达300米高度的结构。 由于1957年在塔顶增加了广播天线,因此它现在比克莱斯勒大厦高5.2米(17英尺)。 除发射器外,艾菲尔铁塔是法国第二高的独立式建筑,仅次于米劳高架桥。`, + ], + ], + [ + "text-generation", + [`我叫朱利安,我喜欢`, `我叫托马斯,我的主要`, `我叫玛丽亚,我最喜欢的`, `我叫克拉拉,我是`, `从前,`], + ], + ["fill-mask", [`巴黎是国的首都。`, `生活的真谛是。`]], + [ + "sentence-similarity", + [ + { + source_sentence: "那是 個快樂的人", + sentences: ["那是 條快樂的狗", "那是 個非常幸福的人", "今天是晴天"], + }, + ], + ], +]); +const MAPPING_FR = new Map([ + ["text-classification", [`Je t'apprécie beaucoup. Je t'aime.`]], + ["token-classification", [`Mon nom est Wolfgang et je vis à Berlin`]], + [ + "question-answering", + [ + { + text: `Où est-ce que je vis?`, + context: `Mon nom est Wolfgang et je vis à Berlin`, + }, + ], + ], + ["translation", [`Mon nom est Wolfgang et je vis à Berlin`]], + [ + "summarization", + [ + `La tour fait 324 mètres (1,063 pieds) de haut, environ la même hauteur qu'un immeuble de 81 étages, et est la plus haute structure de Paris. Sa base est carrée, mesurant 125 mètres (410 pieds) sur chaque côté. Durant sa construction, la tour Eiffel surpassa le Washington Monument pour devenir la plus haute structure construite par l'homme dans le monde, un titre qu'elle conserva pendant 41 ans jusqu'à l'achèvement du Chrysler Building à New-York City en 1930. Ce fut la première structure à atteindre une hauteur de 300 mètres. Avec l'ajout d'une antenne de radiodiffusion au sommet de la tour Eiffel en 1957, celle-ci redevint plus haute que le Chrysler Building de 5,2 mètres (17 pieds). En excluant les transmetteurs, elle est la seconde plus haute structure autoportante de France après le viaduc de Millau.`, + ], + ], + ["text-generation", [`Mon nom est Julien et j'aime`, `Mon nom est Thomas et mon principal`, `Il était une fois`]], + ["fill-mask", [`Paris est la de la France.`]], + [ + "sentence-similarity", + [ + { + source_sentence: "C'est une personne heureuse", + sentences: [ + "C'est un chien heureux", + "C'est une personne très heureuse", + "Aujourd'hui est une journée ensoleillée", + ], + }, + ], + ], +]); +const MAPPING_ES = new Map([ + ["text-classification", [`Te quiero. Te amo.`]], + ["token-classification", [`Me llamo Wolfgang y vivo en Berlin`]], + [ + "question-answering", + [ + { + text: `¿Dónde vivo?`, + context: `Me llamo Wolfgang y vivo en Berlin`, + }, + { + text: `¿Quién inventó el submarino?`, + context: `Isaac Peral fue un murciano que inventó el submarino`, + }, + { + text: `¿Cuántas personas hablan español?`, + context: `El español es el segundo idioma más hablado del mundo con más de 442 millones de hablantes`, + }, + ], + ], + [ + "translation", + [ + `Me llamo Wolfgang y vivo en Berlin`, + `Los ingredientes de una tortilla de patatas son: huevos, patatas y cebolla`, + ], + ], + [ + "summarization", + [ + `La torre tiene 324 metros (1.063 pies) de altura, aproximadamente la misma altura que un edificio de 81 pisos y la estructura más alta de París. Su base es cuadrada, mide 125 metros (410 pies) a cada lado. Durante su construcción, la Torre Eiffel superó al Washington Monument para convertirse en la estructura artificial más alta del mundo, un título que mantuvo durante 41 años hasta que el Chrysler Building en la ciudad de Nueva York se terminó en 1930. Fue la primera estructura en llegar Una altura de 300 metros. Debido a la adición de una antena de transmisión en la parte superior de la torre en 1957, ahora es más alta que el Chrysler Building en 5,2 metros (17 pies). Excluyendo los transmisores, la Torre Eiffel es la segunda estructura independiente más alta de Francia después del Viaducto de Millau.`, + ], + ], + [ + "text-generation", + [ + `Me llamo Julien y me gusta`, + `Me llamo Thomas y mi principal`, + `Me llamo Manuel y trabajo en`, + `Érase una vez,`, + `Si tú me dices ven, `, + ], + ], + ["fill-mask", [`Mi nombre es y vivo en Nueva York.`, `El español es un idioma muy en el mundo.`]], + [ + "sentence-similarity", + [ + { + source_sentence: "Esa es una persona feliz", + sentences: ["Ese es un perro feliz", "Esa es una persona muy feliz", "Hoy es un día soleado"], + }, + ], + ], +]); +const MAPPING_RU = new Map([ + ["text-classification", [`Ты мне нравишься. Я тебя люблю`]], + ["token-classification", [`Меня зовут Вольфганг и я живу в Берлине`]], + [ + "question-answering", + [ + { + text: `Где живу?`, + context: `Меня зовут Вольфганг и я живу в Берлине`, + }, + ], + ], + ["translation", [`Меня зовут Вольфганг и я живу в Берлине`]], + [ + "summarization", + [ + `Высота башни составляет 324 метра (1063 фута), примерно такая же высота, как у 81-этажного здания, и самое высокое сооружение в Париже. Его основание квадратно, размером 125 метров (410 футов) с любой стороны. Во время строительства Эйфелева башня превзошла монумент Вашингтона, став самым высоким искусственным сооружением в мире, и этот титул она удерживала в течение 41 года до завершения строительство здания Крайслер в Нью-Йорке в 1930 году. Это первое сооружение которое достигло высоты 300 метров. Из-за добавления вещательной антенны на вершине башни в 1957 году она сейчас выше здания Крайслер на 5,2 метра (17 футов). За исключением передатчиков, Эйфелева башня является второй самой высокой отдельно стоящей структурой во Франции после виадука Мийо.`, + ], + ], + ["text-generation", [`Меня зовут Жюльен и`, `Меня зовут Томас и мой основной`, `Однажды`]], + ["fill-mask", [`Меня зовут и я инженер живущий в Нью-Йорке.`]], + [ + "sentence-similarity", + [ + { + source_sentence: "Это счастливый человек", + sentences: ["Это счастливая собака", "Это очень счастливый человек", "Сегодня солнечный день"], + }, + ], + ], +]); +const MAPPING_UK = new Map([ + ["translation", [`Мене звати Вольфґанґ і я живу в Берліні.`]], + ["fill-mask", [`Мене звати .`]], +]); +const MAPPING_IT = new Map([ + ["text-classification", [`Mi piaci. Ti amo`]], + [ + "token-classification", + [ + `Mi chiamo Wolfgang e vivo a Berlino`, + `Mi chiamo Sarah e vivo a Londra`, + `Mi chiamo Clara e vivo a Berkeley in California.`, + ], + ], + [ + "question-answering", + [ + { + text: `Dove vivo?`, + context: `Mi chiamo Wolfgang e vivo a Berlino`, + }, + { + text: `Dove vivo?`, + context: `Mi chiamo Sarah e vivo a Londra`, + }, + { + text: `Come mio chiamo?`, + context: `Mi chiamo Clara e vivo a Berkeley.`, + }, + ], + ], + ["translation", [`Mi chiamo Wolfgang e vivo a Berlino`, `Mi chiamo Sarah e vivo a Londra`]], + [ + "summarization", + [ + `La torre degli Asinelli è una delle cosiddette due torri di Bologna, simbolo della città, situate in piazza di porta Ravegnana, all'incrocio tra le antiche strade San Donato (ora via Zamboni), San Vitale, Maggiore e Castiglione. Eretta, secondo la tradizione, fra il 1109 e il 1119 dal nobile Gherardo Asinelli, la torre è alta 97,20 metri, pende verso ovest per 2,23 metri e presenta all'interno una scalinata composta da 498 gradini. Ancora non si può dire con certezza quando e da chi fu costruita la torre degli Asinelli. Si presume che la torre debba il proprio nome a Gherardo Asinelli, il nobile cavaliere di fazione ghibellina al quale se ne attribuisce la costruzione, iniziata secondo una consolidata tradizione l'11 ottobre 1109 e terminata dieci anni dopo, nel 1119.`, + ], + ], + [ + "text-generation", + [ + `Mi chiamo Loreto e mi piace`, + `Mi chiamo Thomas e il mio principale`, + `Mi chiamo Marianna, la mia cosa preferita`, + `Mi chiamo Clara e sono`, + `C'era una volta`, + ], + ], + ["fill-mask", [`Roma è la d'Italia.`, `Lo scopo della vita è .`]], + [ + "sentence-similarity", + [ + { + source_sentence: "Questa è una persona felice", + sentences: ["Questo è un cane felice", "Questa è una persona molto felice", "Oggi è una giornata di sole"], + }, + ], + ], +]); +const MAPPING_FA = new Map([ + [ + "text-classification", + [`پروژه به موقع تحویل شد و همه چیز خوب بود.`, `سیب‌زمینی بی‌کیفیت بود.`, `قیمت و کیفیت عالی`, `خوب نبود اصلا`], + ], + [ + "token-classification", + [ + `این سریال به صورت رسمی در تاریخ دهم می ۲۰۱۱ توسط شبکه فاکس برای پخش رزرو شد.`, + `دفتر مرکزی شرکت پارس‌مینو در شهر اراک در استان مرکزی قرار دارد.`, + `وی در سال ۲۰۱۳ درگذشت و مسئول خاکسپاری و اقوامش برای او مراسم یادبود گرفتند.`, + ], + ], + [ + "question-answering", + [ + { + text: `من کجا زندگی میکنم؟`, + context: `نام من پژمان است و در گرگان زندگی میکنم.`, + }, + { + text: `نامم چیست و کجا زندگی می‌کنم؟`, + context: `اسمم سارا است و در آفریقای جنوبی زندگی میکنم.`, + }, + { + text: `نام من چیست؟`, + context: `من مریم هستم و در تبریز زندگی می‌کنم.`, + }, + { + text: `بیشترین مساحت جنگل آمازون در کدام کشور است؟`, + context: [ + "آمازون نام بزرگ‌ترین جنگل بارانی جهان است که در شمال آمریکای جنوبی قرار گرفته و بیشتر آن در خاک برزیل و پرو", + "جای دارد. بیش از نیمی از همه جنگل‌های بارانی باقی‌مانده در جهان در آمازون قرار دارد.", + "مساحت جنگل‌های آمازون ۵٫۵ میلیون کیلومتر مربع است که بین ۹ کشور تقسیم شده‌است.", + ].join("\n"), + }, + ], + ], + [ + "translation", + [ + "بیشتر مساحت جنگل‌های آمازون در حوضه آبریز رود آمازون و ۱۱۰۰ شاخه آن واقع شده‌است.", + "مردمان نَبَطی از هزاره‌های یکم و دوم پیش از میلاد در این منطقه زندگی می‌کردند.", + ], + ], + [ + "summarization", + [ + [ + "شاهنامه اثر حکیم ابوالقاسم فردوسی توسی، حماسه‌ای منظوم، بر حسب دست نوشته‌های ", + "موجود دربرگیرنده نزدیک به ۵۰٬۰۰۰ بیت تا نزدیک به ۶۱٬۰۰۰ بیت و یکی از ", + "بزرگ‌ترین و برجسته‌ترین سروده‌های حماسی جهان است که سرایش آن دست‌آوردِ ", + "دست‌کم سی سال کارِ پیوستهٔ این سخن‌سرای نامدار ایرانی است. موضوع این شاهکار ادبی،", + " افسانه‌ها و تاریخ ایران از آغاز تا حملهٔ عرب‌ها به ایران در سدهٔ هفتم میلادی است", + " (شاهنامه از سه بخش اسطوره، پهلوانی و تاریخی تشکیل شده‌است) که در چهار", + " دودمان پادشاهیِ پیشدادیان، کیانیان، اشکانیان و ساسانیان گنجانده می‌شود.", + " شاهنامه بر وزن «فَعولُن فعولن فعولن فَعَلْ»، در بحرِ مُتَقارِبِ مثمَّنِ محذوف نگاشته شده‌است.", + "هنگامی که زبان دانش و ادبیات در ایران زبان عربی بود، فردوسی، با سرودن شاهنامه", + " با ویژگی‌های هدف‌مندی که داشت، زبان پارسی را زنده و پایدار کرد. یکی از ", + " بن‌مایه‌های مهمی که فردوسی برای سرودن شاهنامه از آن استفاده کرد،", + " شاهنامهٔ ابومنصوری بود. شاهنامه نفوذ بسیاری در جهت‌گیری ", + " فرهنگ فارسی و نیز بازتاب‌های شکوه‌مندی در ادبیات جهان داشته‌است و شاعران ", + " بزرگی مانند گوته و ویکتور هوگو از آن به نیکی یاد کرده‌اند.", + ].join("\n"), + ], + ], + ["text-generation", ["اسم من نازنین است و من", "روزی روزگاری"]], + [ + "fill-mask", + [ + `زندگی یک سوال است و این که چگونه کنیم پاسخ این سوال!`, + `زندگی از مرگ پرسید: چرا همه من را دارند اما از تو متنفرند؟`, + ], + ], +]); +const MAPPING_AR = new Map([ + ["text-classification", [`أحبك. أهواك`]], + [ + "token-classification", + [`إسمي محمد وأسكن في برلين`, `إسمي ساره وأسكن في لندن`, `إسمي سامي وأسكن في القدس في فلسطين.`], + ], + [ + "question-answering", + [ + { + text: `أين أسكن؟`, + context: `إسمي محمد وأسكن في بيروت`, + }, + { + text: `أين أسكن؟`, + context: `إسمي ساره وأسكن في لندن`, + }, + { + text: `ما اسمي؟`, + context: `اسمي سعيد وأسكن في حيفا.`, + }, + { + text: `ما لقب خالد بن الوليد بالعربية؟`, + context: `خالد بن الوليد من أبطال وقادة الفتح الإسلامي وقد تحدثت عنه اللغات الإنجليزية والفرنسية والإسبانية ولقب بسيف الله المسلول.`, + }, + ], + ], + ["translation", [`إسمي محمد وأسكن في برلين`, `إسمي ساره وأسكن في لندن`]], + [ + "summarization", + [ + `تقع الأهرامات في الجيزة قرب القاهرة في مصر وقد بنيت منذ عدة قرون، وقيل إنها كانت قبورا للفراعنة وتم بناؤها بعملية هندسية رائعة واستقدمت حجارتها من جبل المقطم وتم نقلها بالسفن أو على الرمل، وما تزال شامخة ويقصدها السياح من كافة أرجاء المعمورة.`, + ], + ], + [ + "text-generation", + [ + `إسمي محمد وأحب أن`, + `دع المكارم لا ترحل لبغيتها - واقعد فإنك أنت الطاعم الكاسي.`, + `لماذا نحن هنا؟`, + `القدس مدينة تاريخية، بناها الكنعانيون في`, + `كان يا ما كان في قديم الزمان`, + ], + ], + ["fill-mask", [`باريس فرنسا.`, `فلسفة الحياة هي .`]], + [ + "sentence-similarity", + [ + { + source_sentence: "هذا شخص سعيد", + sentences: ["هذا كلب سعيد", "هذا شخص سعيد جدا", "اليوم هو يوم مشمس"], + }, + ], + ], +]); +const MAPPING_BN = new Map([ + ["text-classification", [`বাঙালির ঘরে ঘরে আজ নবান্ন উৎসব।`]], + [ + "token-classification", + [`আমার নাম জাহিদ এবং আমি ঢাকায় বাস করি।`, `তিনি গুগলে চাকরী করেন।`, `আমার নাম সুস্মিতা এবং আমি কলকাতায় বাস করি।`], + ], + ["translation", [`আমার নাম জাহিদ, আমি রংপুরে বাস করি।`, `আপনি কী আজকে বাসায় আসবেন?`]], + [ + "summarization", + [ + `‘ইকোনমিস্ট’ লিখেছে, অ্যান্টিবডির চার মাস স্থায়ী হওয়ার খবরটি দুই কারণে আনন্দের। অ্যান্টিবডি যত দিন পর্যন্ত শরীরে টিকবে, তত দিন সংক্রমণ থেকে সুরক্ষিত থাকা সম্ভব। অর্থাৎ, এমন এক টিকার প্রয়োজন হবে, যা অ্যান্টিবডির উত্পাদনকে প্ররোচিত করতে পারে এবং দীর্ঘস্থায়ী সুরক্ষা দিতে পারে। এগুলো খুঁজে বের করাও সহজ। এটি আভাস দেয়, ব্যাপক হারে অ্যান্টিবডি শনাক্তকরণ ফলাফল মোটামুটি নির্ভুল হওয়া উচিত। দ্বিতীয় আরেকটি গবেষণার নেতৃত্ব দিয়েছেন যুক্তরাজ্যের মেডিকেল রিসার্চ কাউন্সিলের (এমআরসি) ইমিউনোলজিস্ট তাও দং। তিনি টি-সেল শনাক্তকরণে কাজ করেছেন। টি-সেল শনাক্তকরণের প্রক্রিয়া অবশ্য অ্যান্টিবডির মতো এত আলোচিত নয়। তবে সংক্রমণের বিরুদ্ধে লড়াই এবং দীর্ঘমেয়াদি সুরক্ষায় সমান গুরুত্বপূর্ণ ভূমিকা পালন করে। গবেষণাসংক্রান্ত নিবন্ধ প্রকাশিত হয়েছে ‘নেচার ইমিউনোলজি’ সাময়িকীতে। তাঁরা বলছেন, গবেষণার ক্ষেত্রে কোভিড-১৯ মৃদু সংক্রমণের শিকার ২৮ ব্যক্তির রক্তের নমুনা, ১৪ জন গুরুতর অসুস্থ ও ১৬ জন সুস্থ ব্যক্তির রক্তের নমুনা পরীক্ষা করেছেন। গবেষণা নিবন্ধে বলা হয়, সংক্রমিত ব্যক্তিদের ক্ষেত্রে টি-সেলের তীব্র প্রতিক্রিয়া তাঁরা দেখেছেন। এ ক্ষেত্রে মৃদু ও গুরুতর অসুস্থ ব্যক্তিদের ক্ষেত্রে প্রতিক্রিয়ার ভিন্নতা পাওয়া গেছে।`, + ], + ], + ["text-generation", [`আমি রতন এবং আমি`, `তুমি যদি চাও তবে`, `মিথিলা আজকে বড্ড`]], + ["fill-mask", [`আমি বাংলায় গাই।`, `আমি খুব ভালোবাসি। `]], + [ + "question-answering", + [ + { + text: `প্রথম এশিয়া কাপ ক্রিকেট টুর্নামেন্ট কোথায় অনুষ্ঠিত হয় ?`, + context: `প্রথম টুর্নামেন্ট অনুষ্ঠিত হয় ১৯৮৪ সালে সংযুক্ত আরব আমিরাত এর শারজাহ তে যেখানে কাউন্সিলের মূল অফিস ছিল (১৯৯৫ পর্যন্ত)। ভারত শ্রীলঙ্কার সাথে আন্তরিকতাহীন ক্রিকেট সম্পর্কের কারণে ১৯৮৬ সালের টুর্নামেন্ট বর্জন করে। ১৯৯৩ সালে ভারত ও পাকিস্তান এর মধ্যে রাজনৈতিক অস্থিরতার কারণে এটি বাতিল হয়ে যায়। শ্রীলঙ্কা এশিয়া কাপ শুরু থেকে অংশ গ্রহণ করে আসছে। আন্তর্জাতিক ক্রিকেট কাউন্সিল নিয়ম করে দিয়েছে যে এশিয়া কাপের সকল খেলা অনুষ্ঠিত হবে অফিসিয়াল একদিনের আন্তর্জাতিক ক্রিকেট হিসেবে। এসিসি ঘোষনা অনুযায়ী প্রতি দুই বছর পর পর টুর্নামেন্ট অনুষ্ঠিত হয় ২০০৮ সাল থেকে।`, + }, + { + text: `ভারতীয় বাঙালি কথাসাহিত্যিক মহাশ্বেতা দেবীর মৃত্যু কবে হয় ?`, + context: `২০১৬ সালের ২৩ জুলাই হৃদরোগে আক্রান্ত হয়ে মহাশ্বেতা দেবী কলকাতার বেল ভিউ ক্লিনিকে ভর্তি হন। সেই বছরই ২৮ জুলাই একাধিক অঙ্গ বিকল হয়ে তাঁর মৃত্যু ঘটে। তিনি মধুমেহ, সেপ্টিসেমিয়া ও মূত্র সংক্রমণ রোগেও ভুগছিলেন।`, + }, + { + text: `মাস্টারদা সূর্যকুমার সেনের বাবার নাম কী ছিল ?`, + context: `সূর্য সেন ১৮৯৪ সালের ২২ মার্চ চট্টগ্রামের রাউজান থানার নোয়াপাড়ায় অর্থনৈতিক ভাবে অস্বচ্ছল পরিবারে জন্মগ্রহণ করেন। তাঁর পিতার নাম রাজমনি সেন এবং মাতার নাম শশী বালা সেন। রাজমনি সেনের দুই ছেলে আর চার মেয়ে। সূর্য সেন তাঁদের পরিবারের চতুর্থ সন্তান। দুই ছেলের নাম সূর্য ও কমল। চার মেয়ের নাম বরদাসুন্দরী, সাবিত্রী, ভানুমতী ও প্রমিলা। শৈশবে পিতা মাতাকে হারানো সূর্য সেন কাকা গৌরমনি সেনের কাছে মানুষ হয়েছেন। সূর্য সেন ছেলেবেলা থেকেই খুব মনোযোগী ভাল ছাত্র ছিলেন এবং ধর্মভাবাপন্ন গম্ভীর প্রকৃতির ছিলেন।`, + }, + ], + ], + [ + "sentence-similarity", + [ + { + source_sentence: "সে একজন সুখী ব্যক্তি", + sentences: ["সে হ্যাপি কুকুর", "সে খুব সুখী মানুষ", "আজ একটি রৌদ্রোজ্জ্বল দিন"], + }, + ], + ], +]); +const MAPPING_MN = new Map([ + ["text-classification", [`Би чамд хайртай`]], + [ + "token-classification", + [ + `Намайг Дорж гэдэг. Би Улаанбаатарт амьдардаг.`, + `Намайг Ганбат гэдэг. Би Увс аймагт төрсөн.`, + `Манай улс таван хошуу малтай.`, + ], + ], + [ + "question-answering", + [ + { + text: `Та хаана амьдардаг вэ?`, + context: `Намайг Дорж гэдэг. Би Улаанбаатарт амьдардаг.`, + }, + { + text: `Таныг хэн гэдэг вэ?`, + context: `Намайг Дорж гэдэг. Би Улаанбаатарт амьдардаг.`, + }, + { + text: `Миний нэрийг хэн гэдэг вэ?`, + context: `Намайг Ганбат гэдэг. Би Увс аймагт төрсөн.`, + }, + ], + ], + ["translation", [`Намайг Дорж гэдэг. Би Улаанбаатарт амьдардаг.`, `Намайг Ганбат гэдэг. Би Увс аймагт төрсөн.`]], + [ + "summarization", + [ + `Монгол Улс (1992 оноос хойш) — дорно болон төв Азид оршдог бүрэн эрхт улс. Хойд талаараа Орос, бусад талаараа Хятад улстай хиллэдэг далайд гарцгүй орон. Нийслэл — Улаанбаатар хот. Алтайн нуруунаас Хянган, Соёноос Говь хүрсэн 1 сая 566 мянган км2 уудам нутагтай, дэлхийд нутаг дэвсгэрийн хэмжээгээр 19-рт жагсдаг. 2015 оны эхэнд Монгол Улсын хүн ам 3 сая хүрсэн (135-р олон). Үндсэндээ монгол үндэстэн (95 хувь), мөн хасаг, тува хүн байна. 16-р зуунаас хойш буддын шашин, 20-р зуунаас шашингүй байдал дэлгэрсэн ба албан хэрэгт монгол хэлээр харилцана.`, + ], + ], + [ + "text-generation", + [`Намайг Дорж гэдэг. Би`, `Хамгийн сайн дуучин бол`, `Миний дуртай хамтлаг бол`, `Эрт урьдын цагт`], + ], + ["fill-mask", [`Монгол улсын Улаанбаатар хотоос ярьж байна.`, `Миний амьдралын зорилго бол .`]], + [ + "automatic-speech-recognition", + [ + { + label: `Common Voice Train Example`, + src: `https://cdn-media.huggingface.co/common_voice/train/common_voice_mn_18577472.wav`, + }, + { + label: `Common Voice Test Example`, + src: `https://cdn-media.huggingface.co/common_voice/test/common_voice_mn_18577346.wav`, + }, + ], + ], + [ + "text-to-speech", + [ + `Би Монгол улсын иргэн.`, + `Энэхүү жишээ нь цаанаа ямар ч утга агуулаагүй болно`, + `Сар шинэдээ сайхан шинэлэж байна уу?`, + ], + ], + [ + "sentence-similarity", + [ + { + source_sentence: "Энэ бол аз жаргалтай хүн юм", + sentences: ["Энэ бол аз жаргалтай нохой юм", "Энэ бол маш их аз жаргалтай хүн юм", "Өнөөдөр нарлаг өдөр байна"], + }, + ], + ], +]); +const MAPPING_SI = new Map([ + ["translation", [`සිංහල ඉතා අලංකාර භාෂාවකි.`, `මෙම තාක්ෂණය භාවිතා කරන ඔබට ස්තූතියි.`]], + ["fill-mask", [`මම ගෙදර .`, ` ඉගෙනීමට ගියාය.`]], +]); +const MAPPING_DE = new Map([ + [ + "question-answering", + [ + { + text: `Wo wohne ich?`, + context: `Mein Name ist Wolfgang und ich lebe in Berlin`, + }, + { + text: `Welcher Name wird auch verwendet, um den Amazonas-Regenwald auf Englisch zu beschreiben?`, + context: `Der Amazonas-Regenwald, auf Englisch auch als Amazonien oder Amazonas-Dschungel bekannt, ist ein feuchter Laubwald, der den größten Teil des Amazonas-Beckens Südamerikas bedeckt. Dieses Becken umfasst 7.000.000 Quadratkilometer (2.700.000 Quadratmeilen), von denen 5.500.000 Quadratkilometer (2.100.000 Quadratmeilen) vom Regenwald bedeckt sind. Diese Region umfasst Gebiete von neun Nationen. Der größte Teil des Waldes befindet sich in Brasilien mit 60% des Regenwaldes, gefolgt von Peru mit 13%, Kolumbien mit 10% und geringen Mengen in Venezuela, Ecuador, Bolivien, Guyana, Suriname und Französisch-Guayana. Staaten oder Abteilungen in vier Nationen enthalten "Amazonas" in ihren Namen. Der Amazonas repräsentiert mehr als die Hälfte der verbleibenden Regenwälder des Planeten und umfasst den größten und artenreichsten tropischen Regenwald der Welt mit geschätzten 390 Milliarden Einzelbäumen, die in 16.000 Arten unterteilt sind.`, + }, + ], + ], + [ + "sentence-similarity", + [ + { + source_sentence: "Das ist eine glückliche Person", + sentences: [ + "Das ist ein glücklicher Hund", + "Das ist eine sehr glückliche Person", + "Heute ist ein sonniger Tag", + ], + }, + ], + ], +]); +const MAPPING_DV = new Map([ + ["text-classification", [`އަހަރެން ގަޔާވޭ. އަހަރެން ލޯބިވޭ`]], + [ + "token-classification", + [`އަހަރެންގެ ނަމަކީ އަހުމަދު އަދި އަހަރެން ދިރިއުޅެނީ މާލޭގަ`, `އަހަރެންގެ ނަމަކީ ސާރާ އަދި އަހަރެން ދިރިއުޅެނީ އުތީމުގަ`, `އަހަރެންގެ ނަމަކީ އައިޝާ އަދި އަހަރެން ދިރިއުޅެނީ ފޭދޫ، އައްޑޫގަ`], + ], + [ + "question-answering", + [ + { + text: `އަހަރެން ދިރިއުޅެނީ ކޮންތާކު؟`, + context: `އަހަރެންގެ ނަމަކީ އަހުމަދު އަދި އަހަރެން ދިރިއުޅެނީ މާލޭގަ`, + }, + { + text: `އަހަރެން ދިރިއުޅެނީ ކޮންތާކު؟`, + context: `އަހަރެންގެ ނަމަކީ ސާރާ އަދި އަހަރެން ދިރިއުޅެނީ އުތީމުގަ`, + }, + { + text: `އަހަރެންގެ ނަމަކީ ކޮބާ؟`, + context: `އަހަރެންގެ ނަމަކީ އައިޝާ އަދި އަހަރެން ދިރިއުޅެނީ ފޭދޫގަ`, + }, + { + text: `އެމޭޒަން ރެއިންފޮރެސްޓް ސިފަކޮށްދިނުމަށް އިނގިރޭސި ބަހުން ބޭނުންކުރާނީ ކޮންނަމެއް؟`, + context: `އެމޭޒަން ރެއިންފޮރެސްޓް (ޕޯޗުޖީޒް: ފްލޮރެސްޓާ އެމަސޮނިކާ ނުވަތަ އެމަސޮނިއާ؛ ސްޕެނިޝް: ސެލްވާ އެމަސޮނިކާ, އެމަސޮނިއާ ނޫނީ އާންމުކޮށް އެމަޒޯނިއާ؛ ފްރެންޗް: ފޮރޭ އެމެޒޮނިއެން؛ ޑަޗް: އެމެޒޯންރޭގެވައުޑް)، އިގިރޭސި ބަހުން ބުނާ އެމެޒޯނިއާ ނުވަތަ ދަ އެމޭޒަން ޖަންގަލް އަކީ, ސައުތު އެމެރިކާގެ އެމޭޒަން ބޭސިން ސަރަހައްދުގެ ބޮޑުބައެއްގައި ހިމެނޭ މޮއިސްޓް ބޮރޯޑްލީފް ފޮރެސްޓެއެކެވެ. އެމޭޒަން ބޭސިން ސަރަހައްދުގެ ބޮޑު މިނަކީ 7 މިލިއަން އަކަ ކިލޯމީޓަރ (2.7 މިލިއަން އަކަ މައިލް(. މީގެ ތެރެއިން 5.5 މިލިއަން އަކަ ކިލޯމީޓަރ (2.1 މިލިއަން އަކަ މައިލް) އަކީ މި ފޮރެސްޓެވެ. މި ސަރަހައްދުގައި 9 ގައުމަކަށް ނިސްބަތްވާ ޓެރިޓަރީ ހިމެނެއެވެ. 60% އާއިއެކެ އެންމެ ބޮޑު ބައެއް ނިސްބަތްވަނީ ބްރެޒިލްއަށެވެ. އޭގެ ފަހުތުން 13% އާއެކު ޕެރޫ އާއި 10% އާއެކު ކޮލަމްބިއާ އަދި ކުޑަ ބައެއް ހިމެނޭ ގޮތުން ވެނެޒުއެލާ, އެކްއަޑޯ, ބޮލިވިއާ, ގުޔާނާ, ސުރިނާމް އަދި ފްރެންޗް ގްއާނާ އަށް ވެސް ނިސްބަތްވެއެވެ. މީގެ ތެރެއިން 4 ގައުމެއްގައި "އެމެޒޮނާސް" ހިމަނައިގެން ސްޓޭޓް ނުވަތަ ޑިޕާޓްމަންޓް އަކަށް ނަންދީފައިވެއެވެ. މުޅި ދުނިޔޭގައި ބާކީ ހުރި ރެއިންފޮރެސްޓްގެ ތެރެއިން ދެބައިކުޅަ އެއްބަޔަށްވުރެބޮޑުވަރެއް އެމޭޒޮން ރެއިންފޮރެސްޓް ހިއްސާކުރެއެވެ. މިއީ މުޅި ދުނިޔެއިން އެންމޮ ބޮޑު އަދި އެންމެ ބައޮޑައިވަރސް ރެއިންފޮރެސްޓް ޓްރެކްޓެވެ. ލަފާކުރެވޭ ގޮތުން 16 ހާސް ސްޕީޝީސްއަށް ބެހިގެންވާ 390 މިލިއަން ވައްތަރުގެ ގަސް މިތާގައި ހިމެނެއެވެ`, + }, + ], + ], + ["translation", [`އަހަރެންގެ ނަމަކީ އަހުމަދު އަދި އަހަރެން ދިރިއުޅެނީ މާލޭގަ`, `އަހަރެންގެ ނަމަކީ ސާރާ އަދި އަހަރެން ދިރިއުޅެނީ އުތީމުގަ`]], + [ + "summarization", + [ + `ޓަވަރުގެ އުސްމިނަކީ 324 މީޓަރު، އެއީ ގާތްގަނޑަކަށް 81 ބުރީގެ އިމާރާތަކާއި އެއްވަރެވެ. އެއީ ޕެރިސްގައި ހުރި އެންމެ އުސް އިމާރާތެވެ. އޭގެ ހަތަރެސްކަނަށް ހުރި ބުޑުގެ ދިގުމިނަކީ ކޮންމެ ފަރާތަކުން 125 މީޓަރެވެ. (410 ފޫޓު) އައިފިލް ޓަވަރު ބިނާކުރި އިރު، ވޮޝިންގްޓަން މޮނިއުމެންޓްގެ އުސްމިން ފަހަނައަޅާ ގޮސް، ދުނިޔޭގައި މީހުން އުފެއްދި ތަންތަނުގެ ތެރެއިން އެންމެ އުސް ތަނުގެ ލަގަބު ލިބުނެވެ. އަދި 1930 ގައި ނިއު ޔޯކްގެ ކްރައިސްލަރ ބިލްޑިންގް ބިނާކުރުމާއި ހަމައަށް 41 އަހަރު ވަންދެން މިލަގަބު ހިފެހެއްޓިއެވެ. މިއީ 300 މީޓަރަށް ވުރެ އުސްކޮށް އިމާރާތްކުރެވުނު ފުރަތަމަ ތަނެވެ. 1957 ގައި ޓަވަރުގެ އެންމެ މަތީގައި ހަރުކުރެވުނު ބްރޯޑްކާސްޓިންގ އޭރިއަލްގެ ސަބަބުން މިހާރު މި ޓަވަރު ކްރައިސްލަރ ބިލްޑިންގއަށް ވުރެ 5.2 މީޓަރ (17 ފޫޓު) އުހެވެ. މި ޓްރާންސްމިޓަރު ނުލާ، އައިފިލް ޓަވަރަކީ، މިލާއު ވިއާޑަކްޓަށް ފަހު ފްރާންސްގައި ހުރި 2 ވަނައަށް އެންމެ އުސް ފްރީސްޓޭންޑިންގ އިމާރާތެވެ`, + ], + ], + [ + "text-generation", + [`އަހަރެންގެ ނަމަކީ ޔޫސުފް އަދި އަހަރެންގެ މައިގަނޑު`, `އަހަރެންގެ ނަމަކީ މަރިއަމް، އަހަރެން އެންމެ ގަޔާވާ`, `އަހަރެންގެ ނަމަކީ ފާތުމަތު އަދި އަހަރެން`, `،އެއް ޒަމާނެއްގައި`], + ], + ["fill-mask", [`. މާލެ އަކީ ދިވެހިރާއްޖޭގެ`, `ގަރުދިޔައަކީ ދިވެހިންގެ މެދުގައި ކެއުމެއް.`]], +]); +exports.MAPPING_DEFAULT_WIDGET = new Map([ + ["en", MAPPING_EN], + ["zh", MAPPING_ZH], + ["fr", MAPPING_FR], + ["es", MAPPING_ES], + ["ru", MAPPING_RU], + ["uk", MAPPING_UK], + ["it", MAPPING_IT], + ["fa", MAPPING_FA], + ["ar", MAPPING_AR], + ["bn", MAPPING_BN], + ["mn", MAPPING_MN], + ["si", MAPPING_SI], + ["de", MAPPING_DE], + ["dv", MAPPING_DV], +]); diff --git a/node_modules/@huggingface/tasks/dist/commonjs/gguf.d.ts b/node_modules/@huggingface/tasks/dist/commonjs/gguf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..90e342694ceda830a8652107c75bb5783899d89f --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/gguf.d.ts @@ -0,0 +1,87 @@ +export declare enum GGMLFileQuantizationType { + F32 = 0, + F16 = 1, + Q4_0 = 2, + Q4_1 = 3, + Q4_1_SOME_F16 = 4, + Q4_2 = 5, + Q4_3 = 6, + Q8_0 = 7, + Q5_0 = 8, + Q5_1 = 9, + Q2_K = 10, + Q3_K_S = 11, + Q3_K_M = 12, + Q3_K_L = 13, + Q4_K_S = 14, + Q4_K_M = 15, + Q5_K_S = 16, + Q5_K_M = 17, + Q6_K = 18, + IQ2_XXS = 19, + IQ2_XS = 20, + Q2_K_S = 21, + IQ3_XS = 22, + IQ3_XXS = 23, + IQ1_S = 24, + IQ4_NL = 25, + IQ3_S = 26, + IQ3_M = 27, + IQ2_S = 28, + IQ2_M = 29, + IQ4_XS = 30, + IQ1_M = 31, + BF16 = 32, + Q4_0_4_4 = 33, + Q4_0_4_8 = 34, + Q4_0_8_8 = 35, + TQ1_0 = 36, + TQ2_0 = 37, + MXFP4_MOE = 38, + Q2_K_XL = 1000, + Q3_K_XL = 1001, + Q4_K_XL = 1002, + Q5_K_XL = 1003, + Q6_K_XL = 1004, + Q8_K_XL = 1005 +} +export declare const GGUF_QUANT_RE: RegExp; +export declare const GGUF_QUANT_RE_GLOBAL: RegExp; +export declare function parseGGUFQuantLabel(fname: string): string | undefined; +export declare const GGUF_QUANT_ORDER: GGMLFileQuantizationType[]; +export declare function findNearestQuantType(quant: GGMLFileQuantizationType, availableQuants: GGMLFileQuantizationType[]): GGMLFileQuantizationType | undefined; +export declare enum GGMLQuantizationType { + F32 = 0, + F16 = 1, + Q4_0 = 2, + Q4_1 = 3, + Q5_0 = 6, + Q5_1 = 7, + Q8_0 = 8, + Q8_1 = 9, + Q2_K = 10, + Q3_K = 11, + Q4_K = 12, + Q5_K = 13, + Q6_K = 14, + Q8_K = 15, + IQ2_XXS = 16, + IQ2_XS = 17, + IQ3_XXS = 18, + IQ1_S = 19, + IQ4_NL = 20, + IQ3_S = 21, + IQ2_S = 22, + IQ4_XS = 23, + I8 = 24, + I16 = 25, + I32 = 26, + I64 = 27, + F64 = 28, + IQ1_M = 29, + BF16 = 30, + TQ1_0 = 34, + TQ2_0 = 35, + MXFP4 = 39 +} +//# sourceMappingURL=gguf.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/dist/commonjs/gguf.d.ts.map b/node_modules/@huggingface/tasks/dist/commonjs/gguf.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..1931652bbe61f8cca5ed3cd57b8c7e9303553975 --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/gguf.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"gguf.d.ts","sourceRoot":"","sources":["../../src/gguf.ts"],"names":[],"mappings":"AAGA,oBAAY,wBAAwB;IACnC,GAAG,IAAI;IACP,GAAG,IAAI;IACP,IAAI,IAAI;IACR,IAAI,IAAI;IACR,aAAa,IAAI;IACjB,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,KAAK;IACT,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,IAAI,KAAK;IACT,OAAO,KAAK;IACZ,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,OAAO,KAAK;IACZ,KAAK,KAAK;IACV,MAAM,KAAK;IACX,KAAK,KAAK;IACV,KAAK,KAAK;IACV,KAAK,KAAK;IACV,KAAK,KAAK;IACV,MAAM,KAAK;IACX,KAAK,KAAK;IACV,IAAI,KAAK;IACT,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,KAAK,KAAK;IACV,KAAK,KAAK;IACV,SAAS,KAAK;IAId,OAAO,OAAO;IACd,OAAO,OAAO;IACd,OAAO,OAAO;IACd,OAAO,OAAO;IACd,OAAO,OAAO;IACd,OAAO,OAAO;CACd;AAGD,eAAO,MAAM,aAAa,QAEzB,CAAC;AACF,eAAO,MAAM,oBAAoB,QAAiC,CAAC;AAEnE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGrE;AAKD,eAAO,MAAM,gBAAgB,EAAE,wBAAwB,EA0DtD,CAAC;AAIF,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,wBAAwB,EAC/B,eAAe,EAAE,wBAAwB,EAAE,GACzC,wBAAwB,GAAG,SAAS,CAmCtC;AAGD,oBAAY,oBAAoB;IAC/B,GAAG,IAAI;IACP,GAAG,IAAI;IACP,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,KAAK;IACT,IAAI,KAAK;IACT,IAAI,KAAK;IACT,IAAI,KAAK;IACT,IAAI,KAAK;IACT,IAAI,KAAK;IACT,OAAO,KAAK;IACZ,MAAM,KAAK;IACX,OAAO,KAAK;IACZ,KAAK,KAAK;IACV,MAAM,KAAK;IACX,KAAK,KAAK;IACV,KAAK,KAAK;IACV,MAAM,KAAK;IACX,EAAE,KAAK;IACP,GAAG,KAAK;IACR,GAAG,KAAK;IACR,GAAG,KAAK;IACR,GAAG,KAAK;IACR,KAAK,KAAK;IACV,IAAI,KAAK;IACT,KAAK,KAAK;IACV,KAAK,KAAK;IACV,KAAK,KAAK;CACV"} \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/dist/commonjs/gguf.js b/node_modules/@huggingface/tasks/dist/commonjs/gguf.js new file mode 100644 index 0000000000000000000000000000000000000000..74679ed2f6a57eb83c1f5a5ad48d894b0c87b68f --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/gguf.js @@ -0,0 +1,190 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.GGMLQuantizationType = exports.GGUF_QUANT_ORDER = exports.GGUF_QUANT_RE_GLOBAL = exports.GGUF_QUANT_RE = exports.GGMLFileQuantizationType = void 0; +exports.parseGGUFQuantLabel = parseGGUFQuantLabel; +exports.findNearestQuantType = findNearestQuantType; +// This list is copied from gguf/types.ts, but will all types available (for backward compatibility) +// NOT to be confused with GGMLQuantizationType, a FileQuantization can contain multiple GGMLQuantizationType +// For example, Q4_K_M model can contains Q4_K and Q6_K tensors +var GGMLFileQuantizationType; +(function (GGMLFileQuantizationType) { + GGMLFileQuantizationType[GGMLFileQuantizationType["F32"] = 0] = "F32"; + GGMLFileQuantizationType[GGMLFileQuantizationType["F16"] = 1] = "F16"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q4_0"] = 2] = "Q4_0"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q4_1"] = 3] = "Q4_1"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q4_1_SOME_F16"] = 4] = "Q4_1_SOME_F16"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q4_2"] = 5] = "Q4_2"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q4_3"] = 6] = "Q4_3"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q8_0"] = 7] = "Q8_0"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q5_0"] = 8] = "Q5_0"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q5_1"] = 9] = "Q5_1"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q2_K"] = 10] = "Q2_K"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q3_K_S"] = 11] = "Q3_K_S"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q3_K_M"] = 12] = "Q3_K_M"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q3_K_L"] = 13] = "Q3_K_L"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q4_K_S"] = 14] = "Q4_K_S"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q4_K_M"] = 15] = "Q4_K_M"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q5_K_S"] = 16] = "Q5_K_S"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q5_K_M"] = 17] = "Q5_K_M"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q6_K"] = 18] = "Q6_K"; + GGMLFileQuantizationType[GGMLFileQuantizationType["IQ2_XXS"] = 19] = "IQ2_XXS"; + GGMLFileQuantizationType[GGMLFileQuantizationType["IQ2_XS"] = 20] = "IQ2_XS"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q2_K_S"] = 21] = "Q2_K_S"; + GGMLFileQuantizationType[GGMLFileQuantizationType["IQ3_XS"] = 22] = "IQ3_XS"; + GGMLFileQuantizationType[GGMLFileQuantizationType["IQ3_XXS"] = 23] = "IQ3_XXS"; + GGMLFileQuantizationType[GGMLFileQuantizationType["IQ1_S"] = 24] = "IQ1_S"; + GGMLFileQuantizationType[GGMLFileQuantizationType["IQ4_NL"] = 25] = "IQ4_NL"; + GGMLFileQuantizationType[GGMLFileQuantizationType["IQ3_S"] = 26] = "IQ3_S"; + GGMLFileQuantizationType[GGMLFileQuantizationType["IQ3_M"] = 27] = "IQ3_M"; + GGMLFileQuantizationType[GGMLFileQuantizationType["IQ2_S"] = 28] = "IQ2_S"; + GGMLFileQuantizationType[GGMLFileQuantizationType["IQ2_M"] = 29] = "IQ2_M"; + GGMLFileQuantizationType[GGMLFileQuantizationType["IQ4_XS"] = 30] = "IQ4_XS"; + GGMLFileQuantizationType[GGMLFileQuantizationType["IQ1_M"] = 31] = "IQ1_M"; + GGMLFileQuantizationType[GGMLFileQuantizationType["BF16"] = 32] = "BF16"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q4_0_4_4"] = 33] = "Q4_0_4_4"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q4_0_4_8"] = 34] = "Q4_0_4_8"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q4_0_8_8"] = 35] = "Q4_0_8_8"; + GGMLFileQuantizationType[GGMLFileQuantizationType["TQ1_0"] = 36] = "TQ1_0"; + GGMLFileQuantizationType[GGMLFileQuantizationType["TQ2_0"] = 37] = "TQ2_0"; + GGMLFileQuantizationType[GGMLFileQuantizationType["MXFP4_MOE"] = 38] = "MXFP4_MOE"; + // custom quants used by unsloth + // they are not officially a scheme enum value in GGUF, but only here for naming + GGMLFileQuantizationType[GGMLFileQuantizationType["Q2_K_XL"] = 1000] = "Q2_K_XL"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q3_K_XL"] = 1001] = "Q3_K_XL"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q4_K_XL"] = 1002] = "Q4_K_XL"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q5_K_XL"] = 1003] = "Q5_K_XL"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q6_K_XL"] = 1004] = "Q6_K_XL"; + GGMLFileQuantizationType[GGMLFileQuantizationType["Q8_K_XL"] = 1005] = "Q8_K_XL"; +})(GGMLFileQuantizationType || (exports.GGMLFileQuantizationType = GGMLFileQuantizationType = {})); +const ggufQuants = Object.values(GGMLFileQuantizationType).filter((v) => typeof v === "string"); +exports.GGUF_QUANT_RE = new RegExp("(?UD-)?" + `(?${ggufQuants.join("|")})` + "(_(?[A-Z]+))?"); +exports.GGUF_QUANT_RE_GLOBAL = new RegExp(exports.GGUF_QUANT_RE, "g"); +function parseGGUFQuantLabel(fname) { + const quantLabel = fname.toUpperCase().match(exports.GGUF_QUANT_RE_GLOBAL)?.at(-1); // if there is multiple quant substrings in a name, we prefer the last one + return quantLabel; +} +// order of quantization, from biggest to smallest +// this list must be in sync with the order in GGMLFileQuantizationType +// the gguf.spec.ts tests are using verify if the order is correct +exports.GGUF_QUANT_ORDER = [ + GGMLFileQuantizationType.F32, + GGMLFileQuantizationType.BF16, + GGMLFileQuantizationType.F16, + GGMLFileQuantizationType.Q8_K_XL, + GGMLFileQuantizationType.Q8_0, + // 6-bit quantizations + GGMLFileQuantizationType.Q6_K_XL, + GGMLFileQuantizationType.Q6_K, + // 5-bit quantizations + GGMLFileQuantizationType.Q5_K_XL, + GGMLFileQuantizationType.Q5_K_M, + GGMLFileQuantizationType.Q5_K_S, + GGMLFileQuantizationType.Q5_0, + GGMLFileQuantizationType.Q5_1, + // 4-bit quantizations + GGMLFileQuantizationType.Q4_K_XL, + GGMLFileQuantizationType.Q4_K_M, + GGMLFileQuantizationType.Q4_K_S, + GGMLFileQuantizationType.IQ4_NL, + GGMLFileQuantizationType.IQ4_XS, + GGMLFileQuantizationType.Q4_0_4_4, + GGMLFileQuantizationType.Q4_0_4_8, + GGMLFileQuantizationType.Q4_0_8_8, + GGMLFileQuantizationType.Q4_1_SOME_F16, + GGMLFileQuantizationType.Q4_0, + GGMLFileQuantizationType.Q4_1, + GGMLFileQuantizationType.Q4_2, + GGMLFileQuantizationType.Q4_3, + GGMLFileQuantizationType.MXFP4_MOE, + // 3-bit quantizations + GGMLFileQuantizationType.Q3_K_XL, + GGMLFileQuantizationType.Q3_K_L, + GGMLFileQuantizationType.Q3_K_M, + GGMLFileQuantizationType.Q3_K_S, + GGMLFileQuantizationType.IQ3_M, + GGMLFileQuantizationType.IQ3_S, + GGMLFileQuantizationType.IQ3_XS, + GGMLFileQuantizationType.IQ3_XXS, + // 2-bit quantizations + GGMLFileQuantizationType.Q2_K_XL, + GGMLFileQuantizationType.Q2_K, + GGMLFileQuantizationType.Q2_K_S, + GGMLFileQuantizationType.IQ2_M, + GGMLFileQuantizationType.IQ2_S, + GGMLFileQuantizationType.IQ2_XS, + GGMLFileQuantizationType.IQ2_XXS, + // 1-bit quantizations + GGMLFileQuantizationType.IQ1_S, + GGMLFileQuantizationType.IQ1_M, + GGMLFileQuantizationType.TQ1_0, + GGMLFileQuantizationType.TQ2_0, +]; +// This function finds the nearest quantization type that is less than or equal to the given quantization type. +// It returns undefined if no such quantization type is found. +function findNearestQuantType(quant, availableQuants) { + // Create a map for quick index lookup from the defined order + const orderMap = new Map(); + exports.GGUF_QUANT_ORDER.forEach((q, index) => { + orderMap.set(q, index); + }); + const targetIndex = orderMap.get(quant) ?? 0; // the 0 case should never happen + // Filter the available quantizations to include only those defined in the order map, + // then sort them according to the GGUF_QUANT_ORDER (from largest/index 0 to smallest/highest index). + const sortedAvailable = availableQuants + .filter((q) => orderMap.has(q)) + .sort((a, b) => (orderMap.get(a) ?? Infinity) - (orderMap.get(b) ?? Infinity)); + // If no valid quantizations are available after filtering + if (sortedAvailable.length === 0) { + return undefined; + } + // Iterate through the sorted available quantizations (largest to smallest). + // Find the first one whose order index is >= the target index. + // This means finding the largest quantization that is smaller than or equal to the target. + for (const availableQuant of sortedAvailable) { + // We know the key exists due to the filter above. + const availableIndex = orderMap.get(availableQuant) ?? 0; + if (availableIndex >= targetIndex) { + return availableQuant; + } + } + // If the loop completes, it means all available quantizations are larger (have a smaller index) + // than the target quantization. In this case, return the "smallest" available quantization, + // which is the last element in the sorted list (highest index among available). + return sortedAvailable[sortedAvailable.length - 1]; +} +// This list is only used to calculate the size of the model, NOT to be confused with the quantization FILE type +var GGMLQuantizationType; +(function (GGMLQuantizationType) { + GGMLQuantizationType[GGMLQuantizationType["F32"] = 0] = "F32"; + GGMLQuantizationType[GGMLQuantizationType["F16"] = 1] = "F16"; + GGMLQuantizationType[GGMLQuantizationType["Q4_0"] = 2] = "Q4_0"; + GGMLQuantizationType[GGMLQuantizationType["Q4_1"] = 3] = "Q4_1"; + GGMLQuantizationType[GGMLQuantizationType["Q5_0"] = 6] = "Q5_0"; + GGMLQuantizationType[GGMLQuantizationType["Q5_1"] = 7] = "Q5_1"; + GGMLQuantizationType[GGMLQuantizationType["Q8_0"] = 8] = "Q8_0"; + GGMLQuantizationType[GGMLQuantizationType["Q8_1"] = 9] = "Q8_1"; + GGMLQuantizationType[GGMLQuantizationType["Q2_K"] = 10] = "Q2_K"; + GGMLQuantizationType[GGMLQuantizationType["Q3_K"] = 11] = "Q3_K"; + GGMLQuantizationType[GGMLQuantizationType["Q4_K"] = 12] = "Q4_K"; + GGMLQuantizationType[GGMLQuantizationType["Q5_K"] = 13] = "Q5_K"; + GGMLQuantizationType[GGMLQuantizationType["Q6_K"] = 14] = "Q6_K"; + GGMLQuantizationType[GGMLQuantizationType["Q8_K"] = 15] = "Q8_K"; + GGMLQuantizationType[GGMLQuantizationType["IQ2_XXS"] = 16] = "IQ2_XXS"; + GGMLQuantizationType[GGMLQuantizationType["IQ2_XS"] = 17] = "IQ2_XS"; + GGMLQuantizationType[GGMLQuantizationType["IQ3_XXS"] = 18] = "IQ3_XXS"; + GGMLQuantizationType[GGMLQuantizationType["IQ1_S"] = 19] = "IQ1_S"; + GGMLQuantizationType[GGMLQuantizationType["IQ4_NL"] = 20] = "IQ4_NL"; + GGMLQuantizationType[GGMLQuantizationType["IQ3_S"] = 21] = "IQ3_S"; + GGMLQuantizationType[GGMLQuantizationType["IQ2_S"] = 22] = "IQ2_S"; + GGMLQuantizationType[GGMLQuantizationType["IQ4_XS"] = 23] = "IQ4_XS"; + GGMLQuantizationType[GGMLQuantizationType["I8"] = 24] = "I8"; + GGMLQuantizationType[GGMLQuantizationType["I16"] = 25] = "I16"; + GGMLQuantizationType[GGMLQuantizationType["I32"] = 26] = "I32"; + GGMLQuantizationType[GGMLQuantizationType["I64"] = 27] = "I64"; + GGMLQuantizationType[GGMLQuantizationType["F64"] = 28] = "F64"; + GGMLQuantizationType[GGMLQuantizationType["IQ1_M"] = 29] = "IQ1_M"; + GGMLQuantizationType[GGMLQuantizationType["BF16"] = 30] = "BF16"; + GGMLQuantizationType[GGMLQuantizationType["TQ1_0"] = 34] = "TQ1_0"; + GGMLQuantizationType[GGMLQuantizationType["TQ2_0"] = 35] = "TQ2_0"; + GGMLQuantizationType[GGMLQuantizationType["MXFP4"] = 39] = "MXFP4"; +})(GGMLQuantizationType || (exports.GGMLQuantizationType = GGMLQuantizationType = {})); diff --git a/node_modules/@huggingface/tasks/dist/commonjs/hardware.d.ts b/node_modules/@huggingface/tasks/dist/commonjs/hardware.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9c1419ca46c648d52da1655bdff3f9b8f1fa92aa --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/hardware.d.ts @@ -0,0 +1,807 @@ +/** + * Biden AI Executive Order (since revoked by President Trump): + * https://web.archive.org/web/20250105222429/https://www.whitehouse.gov/briefing-room/presidential-actions/2023/10/30/executive-order-on-the-safe-secure-and-trustworthy-development-and-use-of-artificial-intelligence/ + */ +export declare const TFLOPS_THRESHOLD_WHITE_HOUSE_MODEL_TRAINING_TOTAL: number; +export declare const TFLOPS_THRESHOLD_WHITE_HOUSE_MODEL_TRAINING_TOTAL_BIOLOGY: number; +export declare const TFLOPS_THRESHOLD_WHITE_HOUSE_CLUSTER: number; +/** + * EU AI Act + * https://ec.europa.eu/commission/presscorner/detail/en/qanda_21_1683 + */ +export declare const TFLOPS_THRESHOLD_EU_AI_ACT_MODEL_TRAINING_TOTAL: number; +export interface HardwareSpec { + /** + * Approximate value, in FP16 whenever possible for GPUs and FP32 for CPUs. + * This is only approximate/theoretical and shouldn't be taken too seriously. + * Currently the CPU values are from cpu-monkey.com + * while the GPU values are from techpowerup.com + * + * Note to reviewers: I got fed up with data entry, + * and HuggingChat running Llama3 with Web search was failing a bit, + * so some of those values might be slightly inaccurate. Forgive me and please feel free to improve. + */ + tflops: number; + /** + * If an array is specified, options of memory size (can be VRAM, unified RAM) + * e.g. an A100 exists in 40 or 80 GB. + */ + memory?: number[]; +} +export declare const DEFAULT_MEMORY_OPTIONS: number[]; +export declare const SKUS: { + GPU: { + NVIDIA: { + B200: { + tflops: number; + memory: number[]; + }; + H200: { + tflops: number; + memory: number[]; + }; + H100: { + tflops: number; + memory: number[]; + }; + L40s: { + tflops: number; + memory: number[]; + }; + L40: { + tflops: number; + memory: number[]; + }; + L20: { + tflops: number; + memory: number[]; + }; + L4: { + tflops: number; + memory: number[]; + }; + GB10: { + tflops: number; + memory: number[]; + }; + "RTX PRO 6000 WS": { + tflops: number; + memory: number[]; + }; + "RTX PRO 6000 Max-Q": { + tflops: number; + memory: number[]; + }; + "RTX 6000 Ada": { + tflops: number; + memory: number[]; + }; + "RTX 5880 Ada": { + tflops: number; + memory: number[]; + }; + "RTX 5000 Ada": { + tflops: number; + memory: number[]; + }; + "RTX 4500 Ada": { + tflops: number; + memory: number[]; + }; + "RTX 4000 Ada": { + tflops: number; + memory: number[]; + }; + "RTX 4000 SFF Ada": { + tflops: number; + memory: number[]; + }; + "RTX 2000 Ada": { + tflops: number; + memory: number[]; + }; + "RTX A6000": { + tflops: number; + memory: number[]; + }; + "RTX A5000": { + tflops: number; + memory: number[]; + }; + "RTX A5000 Max-Q": { + tflops: number; + memory: number[]; + }; + "RTX A5000 Mobile": { + tflops: number; + memory: number[]; + }; + "RTX A4000": { + tflops: number; + memory: number[]; + }; + "RTX A4000 Max-Q": { + tflops: number; + memory: number[]; + }; + "RTX A4000 Mobile": { + tflops: number; + memory: number[]; + }; + "RTX A3000 Mobile": { + tflops: number; + memory: number[]; + }; + "RTX A2000": { + tflops: number; + memory: number[]; + }; + "RTX A2000 Embedded": { + tflops: number; + memory: number[]; + }; + "RTX A2000 Max-Q": { + tflops: number; + memory: number[]; + }; + "RTX A2000 Mobile": { + tflops: number; + memory: number[]; + }; + A100: { + tflops: number; + memory: number[]; + }; + A40: { + tflops: number; + memory: number[]; + }; + A30: { + tflops: number; + memory: number[]; + }; + A10: { + tflops: number; + memory: number[]; + }; + A2: { + tflops: number; + memory: number[]; + }; + "RTX 5090": { + tflops: number; + memory: number[]; + }; + "RTX 5090 D": { + tflops: number; + memory: number[]; + }; + "RTX 5080": { + tflops: number; + memory: number[]; + }; + "RTX 5080 Mobile": { + tflops: number; + memory: number[]; + }; + "RTX 5070": { + tflops: number; + memory: number[]; + }; + "RTX 5070 Mobile": { + tflops: number; + memory: number[]; + }; + "RTX 5070 Ti": { + tflops: number; + memory: number[]; + }; + "RTX 5060 Ti": { + tflops: number; + memory: number[]; + }; + "RTX 5060": { + tflops: number; + memory: number[]; + }; + "RTX 4090": { + tflops: number; + memory: number[]; + }; + "RTX 4090D": { + tflops: number; + memory: number[]; + }; + "RTX 4090 Mobile": { + tflops: number; + memory: number[]; + }; + "RTX 4080 SUPER": { + tflops: number; + memory: number[]; + }; + "RTX 4080": { + tflops: number; + memory: number[]; + }; + "RTX 4080 Mobile": { + tflops: number; + memory: number[]; + }; + "RTX 4070": { + tflops: number; + memory: number[]; + }; + "RTX 4070 Mobile": { + tflops: number; + memory: number[]; + }; + "RTX 4070 Ti": { + tflops: number; + memory: number[]; + }; + "RTX 4070 Super": { + tflops: number; + memory: number[]; + }; + "RTX 4070 Ti Super": { + tflops: number; + memory: number[]; + }; + "RTX 4060": { + tflops: number; + memory: number[]; + }; + "RTX 4060 Ti": { + tflops: number; + memory: number[]; + }; + "RTX 4090 Laptop": { + tflops: number; + memory: number[]; + }; + "RTX 4080 Laptop": { + tflops: number; + memory: number[]; + }; + "RTX 4070 Laptop": { + tflops: number; + memory: number[]; + }; + "RTX 4060 Laptop": { + tflops: number; + memory: number[]; + }; + "RTX 4050 Laptop": { + tflops: number; + memory: number[]; + }; + "RTX 3090": { + tflops: number; + memory: number[]; + }; + "RTX 3090 Ti": { + tflops: number; + memory: number[]; + }; + "RTX 3080": { + tflops: number; + memory: number[]; + }; + "RTX 3080 Ti": { + tflops: number; + memory: number[]; + }; + "RTX 3080 Mobile": { + tflops: number; + memory: number[]; + }; + "RTX 3070": { + tflops: number; + memory: number[]; + }; + "RTX 3070 Ti": { + tflops: number; + memory: number[]; + }; + "RTX 3070 Ti Mobile": { + tflops: number; + memory: number[]; + }; + "RTX 3060 Ti": { + tflops: number; + memory: number[]; + }; + "RTX 3060": { + tflops: number; + memory: number[]; + }; + "RTX 2080 Ti": { + tflops: number; + memory: number[]; + }; + "RTX 2080": { + tflops: number; + memory: number[]; + }; + "RTX 2070": { + tflops: number; + memory: number[]; + }; + "RTX 2070 SUPER Mobile": { + tflops: number; + memory: number[]; + }; + "RTX 2070 SUPER": { + tflops: number; + memory: number[]; + }; + "RTX 3060 Mobile": { + tflops: number; + memory: number[]; + }; + "RTX 3050 Mobile": { + tflops: number; + memory: number[]; + }; + "RTX 2060": { + tflops: number; + memory: number[]; + }; + "RTX 2060 12GB": { + tflops: number; + memory: number[]; + }; + "RTX 2060 Mobile": { + tflops: number; + memory: number[]; + }; + "GTX 1080 Ti": { + tflops: number; + memory: number[]; + }; + "GTX 1070 Ti": { + tflops: number; + memory: number[]; + }; + "GTX 1060": { + tflops: number; + memory: number[]; + }; + "GTX 1050 Ti": { + tflops: number; + memory: number[]; + }; + "RTX Titan": { + tflops: number; + memory: number[]; + }; + "GTX 1660": { + tflops: number; + memory: number[]; + }; + "GTX 1650 Mobile": { + tflops: number; + memory: number[]; + }; + T4: { + tflops: number; + memory: number[]; + }; + T10: { + tflops: number; + memory: number[]; + }; + V100: { + tflops: number; + memory: number[]; + }; + "Quadro P6000": { + tflops: number; + memory: number[]; + }; + P40: { + tflops: number; + memory: number[]; + }; + P100: { + tflops: number; + memory: number[]; + }; + "Jetson AGX Orin 64GB": { + tflops: number; + memory: number[]; + }; + "Jetson AGX Orin 32GB": { + tflops: number; + memory: number[]; + }; + "Jetson Orin NX 16GB": { + tflops: number; + memory: number[]; + }; + "Jetson Orin NX 8GB": { + tflops: number; + memory: number[]; + }; + "Jetson Orin Nano 8GB": { + tflops: number; + memory: number[]; + }; + "Jetson Orin Nano 4GB": { + tflops: number; + memory: number[]; + }; + "Jetson AGX Xavier": { + tflops: number; + memory: number[]; + }; + "Jetson Xavier NX": { + tflops: number; + memory: number[]; + }; + "Jetson TX2": { + tflops: number; + memory: number[]; + }; + "Jetson Nano": { + tflops: number; + memory: number[]; + }; + }; + AMD: { + MI300: { + tflops: number; + memory: number[]; + }; + MI250: { + tflops: number; + memory: number[]; + }; + MI210: { + tflops: number; + memory: number[]; + }; + MI100: { + tflops: number; + memory: number[]; + }; + MI60: { + tflops: number; + memory: number[]; + }; + MI50: { + tflops: number; + memory: number[]; + }; + "R9700 PRO": { + tflops: number; + memory: number[]; + }; + "RX 9070 XT": { + tflops: number; + memory: number[]; + }; + "RX 9070": { + tflops: number; + memory: number[]; + }; + "RX 7900 XTX": { + tflops: number; + memory: number[]; + }; + "RX 7900 XT": { + tflops: number; + memory: number[]; + }; + "RX 7900 GRE": { + tflops: number; + memory: number[]; + }; + "RX 7800 XT": { + tflops: number; + memory: number[]; + }; + "RX 7700 XT": { + tflops: number; + memory: number[]; + }; + "RX 7600 XT": { + tflops: number; + memory: number[]; + }; + "RX 6950 XT": { + tflops: number; + memory: number[]; + }; + "RX 6800": { + tflops: number; + memory: number[]; + }; + "RX 6700 XT": { + tflops: number; + memory: number[]; + }; + "RX 6700": { + tflops: number; + memory: number[]; + }; + "RX 6650 XT": { + tflops: number; + memory: number[]; + }; + "RX 6600 XT": { + tflops: number; + memory: number[]; + }; + "RX 6600": { + tflops: number; + memory: number[]; + }; + "Radeon Pro VII": { + tflops: number; + memory: number[]; + }; + }; + INTEL: { + "Arc A750": { + tflops: number; + memory: number[]; + }; + "Arc A770": { + tflops: number; + memory: number[]; + }; + "Arc B570": { + tflops: number; + memory: number[]; + }; + "Arc B580": { + tflops: number; + memory: number[]; + }; + "Arc B50": { + tflops: number; + memory: number[]; + }; + "Arc B60": { + tflops: number; + memory: number[]; + }; + }; + QUALCOMM: { + "Snapdragon X Elite X1E-00-1DE": { + tflops: number; + }; + "Snapdragon X Elite X1E-84-100": { + tflops: number; + }; + "Snapdragon X Elite X1E-80-100": { + tflops: number; + }; + "Snapdragon X Elite X1E-78-100": { + tflops: number; + }; + "Snapdragon X Plus X1P-64-100": { + tflops: number; + }; + }; + }; + CPU: { + Intel: { + "Xeon 4th Generation (Sapphire Rapids)": { + tflops: number; + }; + "Xeon 3th Generation (Ice Lake)": { + tflops: number; + }; + "Xeon 2th Generation (Cascade Lake)": { + tflops: number; + }; + "Xeon E5v4 (Broadwell)": { + tflops: number; + }; + "Xeon E5v3 (Haswell)": { + tflops: number; + }; + "Xeon E5v2 (Ivy Bridge)": { + tflops: number; + }; + "Intel Core Ultra 7 265KF": { + tflops: number; + }; + "Intel Core 14th Generation (i7)": { + tflops: number; + }; + "Intel Core 13th Generation (i9)": { + tflops: number; + }; + "Intel Core 13th Generation (i7)": { + tflops: number; + }; + "Intel Core 13th Generation (i5)": { + tflops: number; + }; + "Intel Core 13th Generation (i3)": { + tflops: number; + }; + "Intel Core 12th Generation (i9)": { + tflops: number; + }; + "Intel Core 12th Generation (i7)": { + tflops: number; + }; + "Intel Core 12th Generation (i5)": { + tflops: number; + }; + "Intel Core 12th Generation (i3)": { + tflops: number; + }; + "Intel Core 11th Generation (i9)": { + tflops: number; + }; + "Intel Core 11th Generation (i7)": { + tflops: number; + }; + "Intel Core 11th Generation (i5)": { + tflops: number; + }; + "Intel Core 11th Generation (i3)": { + tflops: number; + }; + "Intel Core 10th Generation (i9)": { + tflops: number; + }; + "Intel Core 10th Generation (i7)": { + tflops: number; + }; + "Intel Core 10th Generation (i5)": { + tflops: number; + }; + "Intel Core 10th Generation (i3)": { + tflops: number; + }; + }; + AMD: { + "EPYC 5th Generation Zen 5 (Turin)": { + tflops: number; + }; + "EPYC 4th Generation Zen 4 (Genoa)": { + tflops: number; + }; + "EPYC 3th Generation Zen 3 (Milan)": { + tflops: number; + }; + "EPYC 2th Generation Zen 2 (Rome)": { + tflops: number; + }; + "EPYC 1st Generation Zen (Naples)": { + tflops: number; + }; + "Ryzen Threadripper Zen 5 9000 (Shimada Peak)": { + tflops: number; + }; + "Ryzen Threadripper Zen 4 7000 (Storm Peak)": { + tflops: number; + }; + "Ryzen Threadripper Zen 3 5000 (Chagall)": { + tflops: number; + }; + "Ryzen Threadripper Zen 2 3000 (Castle Peak)": { + tflops: number; + }; + "Ryzen Threadripper Zen 1000 (Whitehaven)": { + tflops: number; + }; + "Ryzen Zen 5 9000 (Ryzen 9)": { + tflops: number; + }; + "Ryzen Zen 5 9000 (Ryzen 7)": { + tflops: number; + }; + "Ryzen Zen 5 9000 (Ryzen 5)": { + tflops: number; + }; + "Ryzen Zen 4 7000 (Ryzen 9)": { + tflops: number; + }; + "Ryzen Zen 4 7000 (Ryzen 7)": { + tflops: number; + }; + "Ryzen Zen 4 7000 (Ryzen 5)": { + tflops: number; + }; + "Ryzen Zen 3 5000 (Ryzen 9)": { + tflops: number; + }; + "Ryzen Zen 3 5000 (Ryzen 7)": { + tflops: number; + }; + "Ryzen Zen 3 5000 (Ryzen 5)": { + tflops: number; + }; + "Ryzen Zen 2 3000 (Ryzen 9)": { + tflops: number; + }; + "Ryzen Zen 2 3000 (Ryzen 7)": { + tflops: number; + }; + "Ryzen Zen 2 3000 (Ryzen 5)": { + tflops: number; + }; + "Ryzen Zen 2 3000 (Ryzen 3)": { + tflops: number; + }; + }; + }; + "Apple Silicon": { + "-": { + "Apple M1": { + tflops: number; + memory: number[]; + }; + "Apple M1 Pro": { + tflops: number; + memory: number[]; + }; + "Apple M1 Max": { + tflops: number; + memory: number[]; + }; + "Apple M1 Ultra": { + tflops: number; + memory: number[]; + }; + "Apple M2": { + tflops: number; + memory: number[]; + }; + "Apple M2 Pro": { + tflops: number; + memory: number[]; + }; + "Apple M2 Max": { + tflops: number; + memory: number[]; + }; + "Apple M2 Ultra": { + tflops: number; + memory: number[]; + }; + "Apple M3": { + tflops: number; + memory: number[]; + }; + "Apple M3 Pro": { + tflops: number; + memory: number[]; + }; + "Apple M3 Max": { + tflops: number; + memory: number[]; + }; + "Apple M3 Ultra": { + tflops: number; + memory: number[]; + }; + "Apple M4": { + tflops: number; + memory: number[]; + }; + "Apple M4 Pro": { + tflops: number; + memory: number[]; + }; + "Apple M4 Max": { + tflops: number; + memory: number[]; + }; + "Apple M5": { + tflops: number; + memory: number[]; + }; + }; + }; +}; +export type SkuType = keyof typeof SKUS; +//# sourceMappingURL=hardware.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/dist/commonjs/hardware.d.ts.map b/node_modules/@huggingface/tasks/dist/commonjs/hardware.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..712802baac234d70812debd66c9dc7d0643422c5 --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/hardware.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hardware.d.ts","sourceRoot":"","sources":["../../src/hardware.ts"],"names":[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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqwBuD,CAAC;AAEzE,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,IAAI,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/dist/commonjs/hardware.js b/node_modules/@huggingface/tasks/dist/commonjs/hardware.js new file mode 100644 index 0000000000000000000000000000000000000000..784bce014378bb12a1c54c69ed6bef2e3cd9f871 --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/hardware.js @@ -0,0 +1,792 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SKUS = exports.DEFAULT_MEMORY_OPTIONS = exports.TFLOPS_THRESHOLD_EU_AI_ACT_MODEL_TRAINING_TOTAL = exports.TFLOPS_THRESHOLD_WHITE_HOUSE_CLUSTER = exports.TFLOPS_THRESHOLD_WHITE_HOUSE_MODEL_TRAINING_TOTAL_BIOLOGY = exports.TFLOPS_THRESHOLD_WHITE_HOUSE_MODEL_TRAINING_TOTAL = void 0; +/** + * Biden AI Executive Order (since revoked by President Trump): + * https://web.archive.org/web/20250105222429/https://www.whitehouse.gov/briefing-room/presidential-actions/2023/10/30/executive-order-on-the-safe-secure-and-trustworthy-development-and-use-of-artificial-intelligence/ + */ +exports.TFLOPS_THRESHOLD_WHITE_HOUSE_MODEL_TRAINING_TOTAL = 10 ** 14; +exports.TFLOPS_THRESHOLD_WHITE_HOUSE_MODEL_TRAINING_TOTAL_BIOLOGY = 10 ** 11; +exports.TFLOPS_THRESHOLD_WHITE_HOUSE_CLUSTER = 10 ** 8; +/** + * EU AI Act + * https://ec.europa.eu/commission/presscorner/detail/en/qanda_21_1683 + */ +exports.TFLOPS_THRESHOLD_EU_AI_ACT_MODEL_TRAINING_TOTAL = 10 ** 13; +exports.DEFAULT_MEMORY_OPTIONS = [ + 8, 16, 24, 32, 40, 48, 64, 80, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, +]; +exports.SKUS = { + GPU: { + NVIDIA: { + B200: { + tflops: 496.6, + memory: [192], + }, + H200: { + tflops: 241.3, + memory: [141], + }, + H100: { + tflops: 267.6, + memory: [80], + }, + L40s: { + tflops: 91.61, + memory: [48], + }, + L40: { + tflops: 90.52, + memory: [48], + }, + L20: { + tflops: 59.35, + memory: [48], + }, + L4: { + tflops: 30.29, + memory: [24], + }, + GB10: { + tflops: 29.71, + memory: [128], + }, + "RTX PRO 6000 WS": { + tflops: 126, + memory: [96], + }, + "RTX PRO 6000 Max-Q": { + tflops: 116, + memory: [96], + }, + "RTX 6000 Ada": { + tflops: 91.1, + memory: [48], + }, + "RTX 5880 Ada": { + tflops: 69.3, + memory: [48], + }, + "RTX 5000 Ada": { + tflops: 65.3, + memory: [32], + }, + "RTX 4500 Ada": { + tflops: 39.6, + memory: [24], + }, + "RTX 4000 Ada": { + tflops: 26.7, + memory: [20], + }, + "RTX 4000 SFF Ada": { + tflops: 19.2, + memory: [20], + }, + "RTX 2000 Ada": { + tflops: 12.0, + memory: [16], + }, + "RTX A6000": { + tflops: 38.7, + memory: [48], + }, + "RTX A5000": { + tflops: 27.77, + memory: [8, 12, 24], + }, + "RTX A5000 Max-Q": { + tflops: 16.59, + memory: [16], + }, + "RTX A5000 Mobile": { + tflops: 19.35, + memory: [16], + }, + "RTX A4000": { + tflops: 19.17, + memory: [16], + }, + "RTX A4000 Max-Q": { + tflops: 14.28, + memory: [8], + }, + "RTX A4000 Mobile": { + tflops: 17.2, + memory: [8], + }, + "RTX A3000 Mobile": { + tflops: 10.9, + memory: [6, 12], + }, + "RTX A2000": { + tflops: 7.987, + memory: [6, 12], + }, + "RTX A2000 Embedded": { + tflops: 6.026, + memory: [4], + }, + "RTX A2000 Max-Q": { + tflops: 6.1, + memory: [4, 8], + }, + "RTX A2000 Mobile": { + tflops: 8.4, + memory: [4, 8], + }, + A100: { + tflops: 77.97, + memory: [80, 40], + }, + A40: { + tflops: 37.42, + memory: [48], + }, + A30: { + tflops: 10.32, + memory: [24], + }, + A10: { + tflops: 31.24, + memory: [24], + }, + A2: { + tflops: 4.531, // source: https://www.techpowerup.com/gpu-specs/a2.c3848 + memory: [16], + }, + "RTX 5090": { + tflops: 104.8, + memory: [32], + }, + "RTX 5090 D": { + tflops: 104.8, + memory: [32], + }, + "RTX 5080": { + tflops: 56.28, + memory: [16], + }, + "RTX 5080 Mobile": { + tflops: 24.58, + memory: [16], + }, + "RTX 5070": { + tflops: 30.84, + memory: [12], + }, + "RTX 5070 Mobile": { + tflops: 23.22, + memory: [8], + }, + "RTX 5070 Ti": { + tflops: 43.94, + memory: [16], + }, + "RTX 5060 Ti": { + tflops: 23.7, // source https://www.techpowerup.com/gpu-specs/geforce-rtx-5060-ti.c4246 + memory: [16, 8], + }, + "RTX 5060": { + tflops: 19.18, // source https://www.techpowerup.com/gpu-specs/geforce-rtx-5060.c4219 + memory: [8], + }, + "RTX 4090": { + tflops: 82.58, + memory: [24], + }, + "RTX 4090D": { + tflops: 79.49, + memory: [24, 48], + }, + "RTX 4090 Mobile": { + tflops: 32.98, + memory: [16], + }, + "RTX 4080 SUPER": { + tflops: 52.2, + memory: [16], + }, + "RTX 4080": { + tflops: 48.7, + memory: [16], + }, + "RTX 4080 Mobile": { + tflops: 24.72, + memory: [12], + }, + "RTX 4070": { + tflops: 29.15, + memory: [12], + }, + "RTX 4070 Mobile": { + tflops: 15.62, + memory: [8], + }, + "RTX 4070 Ti": { + tflops: 40.09, + memory: [12], + }, + "RTX 4070 Super": { + tflops: 35.48, + memory: [12], + }, + "RTX 4070 Ti Super": { + tflops: 44.1, + memory: [16], + }, + "RTX 4060": { + tflops: 15.11, + memory: [8], + }, + "RTX 4060 Ti": { + tflops: 22.06, + memory: [8, 16], + }, + "RTX 4090 Laptop": { + tflops: 32.98, + memory: [16], + }, + "RTX 4080 Laptop": { + tflops: 24.72, + memory: [12], + }, + "RTX 4070 Laptop": { + tflops: 15.62, + memory: [8], + }, + "RTX 4060 Laptop": { + tflops: 11.61, + memory: [8], + }, + "RTX 4050 Laptop": { + tflops: 8.9, + memory: [6], + }, + "RTX 3090": { + tflops: 35.58, + memory: [24], + }, + "RTX 3090 Ti": { + tflops: 40, + memory: [24], + }, + "RTX 3080": { + tflops: 30.6, + memory: [12, 10], + }, + "RTX 3080 Ti": { + tflops: 34.1, + memory: [12], + }, + "RTX 3080 Mobile": { + tflops: 18.98, + memory: [8], + }, + "RTX 3070": { + tflops: 20.31, + memory: [8], + }, + "RTX 3070 Ti": { + tflops: 21.75, + memory: [8], + }, + "RTX 3070 Ti Mobile": { + tflops: 16.6, + memory: [8], + }, + "RTX 3060 Ti": { + tflops: 16.2, + memory: [8], + }, + "RTX 3060": { + tflops: 12.74, + memory: [12, 8], + }, + "RTX 2080 Ti": { + tflops: 26.9, + memory: [11, 22], // 22GB: modded 2080ti + }, + "RTX 2080": { + tflops: 20.14, + memory: [8], + }, + "RTX 2070": { + tflops: 14.93, + memory: [8], + }, + "RTX 2070 SUPER Mobile": { + tflops: 14.13, + memory: [8], + }, + "RTX 2070 SUPER": { + tflops: 18.12, + memory: [8], + }, + "RTX 3060 Mobile": { + tflops: 10.94, + memory: [6], + }, + "RTX 3050 Mobile": { + tflops: 7.639, + memory: [4, 6], + }, + "RTX 2060": { + tflops: 12.9, + memory: [6], + }, + "RTX 2060 12GB": { + tflops: 14.36, + memory: [12], + }, + "RTX 2060 Mobile": { + tflops: 9.22, + memory: [6], + }, + "GTX 1080 Ti": { + tflops: 11.34, // float32 (GPU does not support native float16) + memory: [11], + }, + "GTX 1070 Ti": { + tflops: 8.2, // float32 (GPU does not support native float16) + memory: [8], + }, + "GTX 1060": { + tflops: 3.9, // float32 (GPU does not support native float16) + memory: [3, 6], + }, + "GTX 1050 Ti": { + tflops: 2.1, // float32 (GPU does not support native float16) + memory: [4], + }, + "RTX Titan": { + tflops: 32.62, + memory: [24], + }, + "GTX 1660": { + tflops: 10.05, + memory: [6], + }, + "GTX 1650 Mobile": { + tflops: 6.39, + memory: [4], + }, + T4: { + tflops: 65.13, + memory: [16], + }, + T10: { + tflops: 20.0, + memory: [16], + }, + V100: { + tflops: 28.26, + memory: [32, 16], + }, + "Quadro P6000": { + tflops: 12.63, // float32 (GPU does not support native float16) + memory: [24], + }, + P40: { + tflops: 11.76, // float32 (GPU does not support native float16) + memory: [24], + }, + P100: { + tflops: 19.05, + memory: [16], + }, + "Jetson AGX Orin 64GB": { + tflops: 10.65, + memory: [64], + }, + "Jetson AGX Orin 32GB": { + tflops: 6.66, + memory: [32], + }, + "Jetson Orin NX 16GB": { + tflops: 3.76, + memory: [16], + }, + "Jetson Orin NX 8GB": { + tflops: 3.13, + memory: [8], + }, + "Jetson Orin Nano 8GB": { + tflops: 2.56, + memory: [8], + }, + "Jetson Orin Nano 4GB": { + tflops: 1.28, + memory: [4], + }, + "Jetson AGX Xavier": { + tflops: 2.82, + memory: [32, 64], + }, + "Jetson Xavier NX": { + tflops: 1.69, + memory: [8, 16], + }, + "Jetson TX2": { + tflops: 1.33, + memory: [4, 8], + }, + "Jetson Nano": { + tflops: 0.47, + memory: [4], + }, + }, + AMD: { + MI300: { + tflops: 383.0, + memory: [192], + }, + MI250: { + tflops: 362.1, + memory: [128], + }, + MI210: { + tflops: 181.0, + memory: [64], + }, + MI100: { + tflops: 184.6, + memory: [32], + }, + MI60: { + tflops: 29.5, + memory: [32], + }, + MI50: { + tflops: 26.5, + memory: [16, 32], + }, + "R9700 PRO": { + tflops: 95.7, + memory: [32], + }, + "RX 9070 XT": { + tflops: 97.32, + memory: [16], + }, + "RX 9070": { + tflops: 72.25, + memory: [16], + }, + "RX 7900 XTX": { + tflops: 122.8, + memory: [24], + }, + "RX 7900 XT": { + tflops: 103.0, + memory: [20], + }, + "RX 7900 GRE": { + tflops: 91.96, + memory: [16], + }, + "RX 7800 XT": { + tflops: 74.65, + memory: [16], + }, + "RX 7700 XT": { + tflops: 70.34, + memory: [12], + }, + "RX 7600 XT": { + tflops: 45.14, + memory: [16, 8], + }, + "RX 6950 XT": { + tflops: 47.31, + memory: [16], + }, + "RX 6800": { + tflops: 32.33, + memory: [16], + }, + "RX 6700 XT": { + tflops: 26.43, + memory: [12], + }, + "RX 6700": { + tflops: 22.58, + memory: [10], + }, + "RX 6650 XT": { + tflops: 21.59, + memory: [8], + }, + "RX 6600 XT": { + tflops: 21.21, + memory: [8], + }, + "RX 6600": { + tflops: 17.86, + memory: [8], + }, + "Radeon Pro VII": { + tflops: 26.11, + memory: [16, 32], + }, + }, + INTEL: { + "Arc A750": { + tflops: 34.41, + memory: [8], + }, + "Arc A770": { + tflops: 39.32, + memory: [8, 16], + }, + "Arc B570": { + tflops: 23.04, + memory: [10], + }, + "Arc B580": { + tflops: 27.34, + memory: [12], + }, + "Arc B50": { + tflops: 21.3, + memory: [16], + }, + "Arc B60": { + tflops: 24.58, + memory: [24, 48], + }, + }, + QUALCOMM: { + "Snapdragon X Elite X1E-00-1DE": { + tflops: 4.6, + }, + "Snapdragon X Elite X1E-84-100": { + tflops: 4.6, + }, + "Snapdragon X Elite X1E-80-100": { + tflops: 3.8, + }, + "Snapdragon X Elite X1E-78-100": { + tflops: 3.8, + }, + "Snapdragon X Plus X1P-64-100": { + tflops: 3.8, + }, + }, + }, + CPU: { + Intel: { + "Xeon 4th Generation (Sapphire Rapids)": { + tflops: 1.3, + }, + "Xeon 3th Generation (Ice Lake)": { + tflops: 0.8, + }, + "Xeon 2th Generation (Cascade Lake)": { + tflops: 0.55, + }, + "Xeon E5v4 (Broadwell)": { + tflops: 0.25, + }, + "Xeon E5v3 (Haswell)": { + tflops: 0.2, + }, + "Xeon E5v2 (Ivy Bridge)": { + tflops: 0.15, + }, + "Intel Core Ultra 7 265KF": { + tflops: 1.53, + }, + "Intel Core 14th Generation (i7)": { + tflops: 0.8, + }, + "Intel Core 13th Generation (i9)": { + tflops: 0.85, + }, + "Intel Core 13th Generation (i7)": { + tflops: 0.82, + }, + "Intel Core 13th Generation (i5)": { + tflops: 0.68, + }, + "Intel Core 13th Generation (i3)": { + tflops: 0.57, + }, + "Intel Core 12th Generation (i9)": { + tflops: 0.79, + }, + "Intel Core 12th Generation (i7)": { + tflops: 0.77, + }, + "Intel Core 12th Generation (i5)": { + tflops: 0.65, + }, + "Intel Core 12th Generation (i3)": { + tflops: 0.53, + }, + "Intel Core 11th Generation (i9)": { + tflops: 0.7, + }, + "Intel Core 11th Generation (i7)": { + tflops: 0.6, + }, + "Intel Core 11th Generation (i5)": { + tflops: 0.5, + }, + "Intel Core 11th Generation (i3)": { + tflops: 0.35, + }, + "Intel Core 10th Generation (i9)": { + tflops: 0.46, + }, + "Intel Core 10th Generation (i7)": { + tflops: 0.46, + }, + "Intel Core 10th Generation (i5)": { + tflops: 0.46, + }, + "Intel Core 10th Generation (i3)": { + tflops: 0.44, + }, + }, + AMD: { + "EPYC 5th Generation Zen 5 (Turin)": { + tflops: 13.8, + }, + "EPYC 4th Generation Zen 4 (Genoa)": { + tflops: 5, + }, + "EPYC 3th Generation Zen 3 (Milan)": { + tflops: 2.4, + }, + "EPYC 2th Generation Zen 2 (Rome)": { + tflops: 0.6, + }, + "EPYC 1st Generation Zen (Naples)": { + tflops: 0.6, + }, + "Ryzen Threadripper Zen 5 9000 (Shimada Peak)": { + tflops: 14.0, + }, + "Ryzen Threadripper Zen 4 7000 (Storm Peak)": { + tflops: 10.0, + }, + "Ryzen Threadripper Zen 3 5000 (Chagall)": { + tflops: 4.6, + }, + "Ryzen Threadripper Zen 2 3000 (Castle Peak)": { + tflops: 3.2, + }, + "Ryzen Threadripper Zen 1000 (Whitehaven)": { + tflops: 0.6, + }, + "Ryzen Zen 5 9000 (Ryzen 9)": { + tflops: 0.56, + }, + "Ryzen Zen 5 9000 (Ryzen 7)": { + tflops: 0.56, + }, + "Ryzen Zen 5 9000 (Ryzen 5)": { + tflops: 0.56, + }, + "Ryzen Zen 4 7000 (Ryzen 9)": { + tflops: 0.56, + }, + "Ryzen Zen 4 7000 (Ryzen 7)": { + tflops: 0.56, + }, + "Ryzen Zen 4 7000 (Ryzen 5)": { + tflops: 0.56, + }, + "Ryzen Zen 3 5000 (Ryzen 9)": { + tflops: 1.33, + }, + "Ryzen Zen 3 5000 (Ryzen 7)": { + tflops: 1.33, + }, + "Ryzen Zen 3 5000 (Ryzen 5)": { + tflops: 0.72, + }, + "Ryzen Zen 2 3000 (Ryzen 9)": { + tflops: 0.72, + }, + "Ryzen Zen 2 3000 (Ryzen 7)": { + tflops: 0.72, + }, + "Ryzen Zen 2 3000 (Ryzen 5)": { + tflops: 0.72, + }, + "Ryzen Zen 2 3000 (Ryzen 3)": { + tflops: 0.72, + }, + }, + }, + "Apple Silicon": { + "-": { + "Apple M1": { + tflops: 2.6, + memory: [8, 16], + }, + "Apple M1 Pro": { + tflops: 5.2, + memory: [16, 24, 32], + }, + "Apple M1 Max": { + tflops: 10.4, + memory: [16, 24, 32, 64], + }, + "Apple M1 Ultra": { + tflops: 21, + memory: [16, 24, 32, 64, 96, 128], + }, + "Apple M2": { + tflops: 3.6, + memory: [8, 16, 24], + }, + "Apple M2 Pro": { + tflops: 6.8, + memory: [16, 24, 32], + }, + "Apple M2 Max": { + tflops: 13.49, + memory: [32, 64, 96], + }, + "Apple M2 Ultra": { + tflops: 27.2, + memory: [64, 96, 128, 192], + }, + "Apple M3": { + tflops: 4.1, + memory: [8, 16, 24], + }, + "Apple M3 Pro": { + tflops: 7.4, + memory: [18, 36], + }, + "Apple M3 Max": { + tflops: 14.2, + memory: [36, 48, 64, 96, 128], + }, + "Apple M3 Ultra": { + tflops: 28.4, + memory: [96, 256, 512], + }, + "Apple M4": { + tflops: 4.6, + memory: [16, 24, 32], + }, + "Apple M4 Pro": { + tflops: 9.2, + memory: [24, 48, 64], + }, + "Apple M4 Max": { + tflops: 18.4, + memory: [36, 48, 64, 96, 128, 256, 512], + }, + "Apple M5": { + tflops: 5.7, + memory: [16, 24, 32], + }, + }, + }, +}; diff --git a/node_modules/@huggingface/tasks/dist/commonjs/index.d.ts b/node_modules/@huggingface/tasks/dist/commonjs/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6a1ea3ff735b220e671819ffb534060242f880c8 --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/index.d.ts @@ -0,0 +1,21 @@ +export { LIBRARY_TASK_MAPPING } from "./library-to-tasks.js"; +export { MAPPING_DEFAULT_WIDGET } from "./default-widget-inputs.js"; +export type { TaskData, TaskDemo, TaskDemoEntry, ExampleRepo } from "./tasks/index.js"; +export * from "./tasks/index.js"; +export { PIPELINE_DATA, PIPELINE_TYPES, type WidgetType, type PipelineType, type PipelineData, type Modality, MODALITIES, MODALITY_LABELS, SUBTASK_TYPES, PIPELINE_TYPES_SET, } from "./pipelines.js"; +export { ALL_DISPLAY_MODEL_LIBRARY_KEYS, ALL_MODEL_LIBRARY_KEYS, MODEL_LIBRARIES_UI_ELEMENTS, } from "./model-libraries.js"; +export type { LibraryUiElement, ModelLibraryKey } from "./model-libraries.js"; +export type { ModelData, TransformersInfo } from "./model-data.js"; +export type { AddedToken, SpecialTokensMap, TokenizerConfig } from "./tokenizer-data.js"; +export type { WidgetExample, WidgetExampleAttribute, WidgetExampleAssetAndPromptInput, WidgetExampleAssetAndTextInput, WidgetExampleAssetAndZeroShotInput, WidgetExampleAssetInput, WidgetExampleChatInput, WidgetExampleSentenceSimilarityInput, WidgetExampleStructuredDataInput, WidgetExampleTableDataInput, WidgetExampleTextAndContextInput, WidgetExampleTextAndTableInput, WidgetExampleTextInput, WidgetExampleZeroShotTextInput, WidgetExampleOutput, WidgetExampleOutputUrl, WidgetExampleOutputLabels, WidgetExampleOutputAnswerScore, WidgetExampleOutputText, } from "./widget-example.js"; +export { SPECIAL_TOKENS_ATTRIBUTES } from "./tokenizer-data.js"; +export * from "./gguf.js"; +export { type InferenceSnippet, type InferenceSnippetLanguage, type ModelDataMinimal, inferenceSnippetLanguages, stringifyGenerationConfig, stringifyMessages, getModelInputSnippet, } from "./snippets/index.js"; +export { SKUS, DEFAULT_MEMORY_OPTIONS } from "./hardware.js"; +export type { HardwareSpec, SkuType } from "./hardware.js"; +export { LOCAL_APPS } from "./local-apps.js"; +export type { LocalApp, LocalAppKey, LocalAppSnippet } from "./local-apps.js"; +export { DATASET_LIBRARIES_UI_ELEMENTS } from "./dataset-libraries.js"; +export type { DatasetLibraryUiElement, DatasetLibraryKey } from "./dataset-libraries.js"; +export * from "./inference-providers.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/dist/commonjs/index.d.ts.map b/node_modules/@huggingface/tasks/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..af56501b974888c5c157cacae63063d3f76e67cb --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACvF,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACN,aAAa,EACb,cAAc,EACd,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,UAAU,EACV,eAAe,EACf,aAAa,EACb,kBAAkB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,8BAA8B,EAC9B,sBAAsB,EACtB,2BAA2B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC9E,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzF,YAAY,EACX,aAAa,EACb,sBAAsB,EACtB,gCAAgC,EAChC,8BAA8B,EAC9B,kCAAkC,EAClC,uBAAuB,EACvB,sBAAsB,EACtB,oCAAoC,EACpC,gCAAgC,EAChC,2BAA2B,EAC3B,gCAAgC,EAChC,8BAA8B,EAC9B,sBAAsB,EACtB,8BAA8B,EAC9B,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,EACzB,8BAA8B,EAC9B,uBAAuB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,cAAc,WAAW,CAAC;AAE1B,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,yBAAyB,EACzB,yBAAyB,EACzB,iBAAiB,EACjB,oBAAoB,GACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,YAAY,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEzF,cAAc,0BAA0B,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/dist/commonjs/index.js b/node_modules/@huggingface/tasks/dist/commonjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6624140e511d714175462c923ca16b42eb58a93a --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/index.js @@ -0,0 +1,49 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DATASET_LIBRARIES_UI_ELEMENTS = exports.LOCAL_APPS = exports.DEFAULT_MEMORY_OPTIONS = exports.SKUS = exports.getModelInputSnippet = exports.stringifyMessages = exports.stringifyGenerationConfig = exports.inferenceSnippetLanguages = exports.SPECIAL_TOKENS_ATTRIBUTES = exports.MODEL_LIBRARIES_UI_ELEMENTS = exports.ALL_MODEL_LIBRARY_KEYS = exports.ALL_DISPLAY_MODEL_LIBRARY_KEYS = exports.PIPELINE_TYPES_SET = exports.SUBTASK_TYPES = exports.MODALITY_LABELS = exports.MODALITIES = exports.PIPELINE_TYPES = exports.PIPELINE_DATA = exports.MAPPING_DEFAULT_WIDGET = exports.LIBRARY_TASK_MAPPING = void 0; +var library_to_tasks_js_1 = require("./library-to-tasks.js"); +Object.defineProperty(exports, "LIBRARY_TASK_MAPPING", { enumerable: true, get: function () { return library_to_tasks_js_1.LIBRARY_TASK_MAPPING; } }); +var default_widget_inputs_js_1 = require("./default-widget-inputs.js"); +Object.defineProperty(exports, "MAPPING_DEFAULT_WIDGET", { enumerable: true, get: function () { return default_widget_inputs_js_1.MAPPING_DEFAULT_WIDGET; } }); +__exportStar(require("./tasks/index.js"), exports); +var pipelines_js_1 = require("./pipelines.js"); +Object.defineProperty(exports, "PIPELINE_DATA", { enumerable: true, get: function () { return pipelines_js_1.PIPELINE_DATA; } }); +Object.defineProperty(exports, "PIPELINE_TYPES", { enumerable: true, get: function () { return pipelines_js_1.PIPELINE_TYPES; } }); +Object.defineProperty(exports, "MODALITIES", { enumerable: true, get: function () { return pipelines_js_1.MODALITIES; } }); +Object.defineProperty(exports, "MODALITY_LABELS", { enumerable: true, get: function () { return pipelines_js_1.MODALITY_LABELS; } }); +Object.defineProperty(exports, "SUBTASK_TYPES", { enumerable: true, get: function () { return pipelines_js_1.SUBTASK_TYPES; } }); +Object.defineProperty(exports, "PIPELINE_TYPES_SET", { enumerable: true, get: function () { return pipelines_js_1.PIPELINE_TYPES_SET; } }); +var model_libraries_js_1 = require("./model-libraries.js"); +Object.defineProperty(exports, "ALL_DISPLAY_MODEL_LIBRARY_KEYS", { enumerable: true, get: function () { return model_libraries_js_1.ALL_DISPLAY_MODEL_LIBRARY_KEYS; } }); +Object.defineProperty(exports, "ALL_MODEL_LIBRARY_KEYS", { enumerable: true, get: function () { return model_libraries_js_1.ALL_MODEL_LIBRARY_KEYS; } }); +Object.defineProperty(exports, "MODEL_LIBRARIES_UI_ELEMENTS", { enumerable: true, get: function () { return model_libraries_js_1.MODEL_LIBRARIES_UI_ELEMENTS; } }); +var tokenizer_data_js_1 = require("./tokenizer-data.js"); +Object.defineProperty(exports, "SPECIAL_TOKENS_ATTRIBUTES", { enumerable: true, get: function () { return tokenizer_data_js_1.SPECIAL_TOKENS_ATTRIBUTES; } }); +__exportStar(require("./gguf.js"), exports); +var index_js_1 = require("./snippets/index.js"); +Object.defineProperty(exports, "inferenceSnippetLanguages", { enumerable: true, get: function () { return index_js_1.inferenceSnippetLanguages; } }); +Object.defineProperty(exports, "stringifyGenerationConfig", { enumerable: true, get: function () { return index_js_1.stringifyGenerationConfig; } }); +Object.defineProperty(exports, "stringifyMessages", { enumerable: true, get: function () { return index_js_1.stringifyMessages; } }); +Object.defineProperty(exports, "getModelInputSnippet", { enumerable: true, get: function () { return index_js_1.getModelInputSnippet; } }); +var hardware_js_1 = require("./hardware.js"); +Object.defineProperty(exports, "SKUS", { enumerable: true, get: function () { return hardware_js_1.SKUS; } }); +Object.defineProperty(exports, "DEFAULT_MEMORY_OPTIONS", { enumerable: true, get: function () { return hardware_js_1.DEFAULT_MEMORY_OPTIONS; } }); +var local_apps_js_1 = require("./local-apps.js"); +Object.defineProperty(exports, "LOCAL_APPS", { enumerable: true, get: function () { return local_apps_js_1.LOCAL_APPS; } }); +var dataset_libraries_js_1 = require("./dataset-libraries.js"); +Object.defineProperty(exports, "DATASET_LIBRARIES_UI_ELEMENTS", { enumerable: true, get: function () { return dataset_libraries_js_1.DATASET_LIBRARIES_UI_ELEMENTS; } }); +__exportStar(require("./inference-providers.js"), exports); diff --git a/node_modules/@huggingface/tasks/dist/commonjs/inference-providers.d.ts b/node_modules/@huggingface/tasks/dist/commonjs/inference-providers.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..29f4bb45c802aec12d780f4cd3bf823ac8b1aa89 --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/inference-providers.d.ts @@ -0,0 +1,11 @@ +declare const INFERENCE_PROVIDERS: readonly ["cerebras", "cohere", "fal-ai", "fireworks-ai", "hf-inference", "hyperbolic", "ovhcloud", "replicate", "sambanova", "together"]; +export type SnippetInferenceProvider = (typeof INFERENCE_PROVIDERS)[number] | string; +export declare const HF_HUB_INFERENCE_PROXY_TEMPLATE = "https://router.huggingface.co/{{PROVIDER}}"; +/** + * URL to set as baseUrl in the OpenAI SDK. + * + * TODO(Expose this from InferenceClient in the future?) + */ +export declare function openAIbaseUrl(provider: SnippetInferenceProvider): string; +export {}; +//# sourceMappingURL=inference-providers.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/dist/commonjs/inference-providers.d.ts.map b/node_modules/@huggingface/tasks/dist/commonjs/inference-providers.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..45c66ab5b1890751d025c7847da9c744299bf5e0 --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/inference-providers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"inference-providers.d.ts","sourceRoot":"","sources":["../../src/inference-providers.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,mBAAmB,2IAWf,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAErF,eAAO,MAAM,+BAA+B,+CAA+C,CAAC;AAE5F;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,wBAAwB,GAAG,MAAM,CAGxE"} \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/dist/commonjs/inference-providers.js b/node_modules/@huggingface/tasks/dist/commonjs/inference-providers.js new file mode 100644 index 0000000000000000000000000000000000000000..0a716b661bd9a999207342707622f65abd59dcd6 --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/inference-providers.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.HF_HUB_INFERENCE_PROXY_TEMPLATE = void 0; +exports.openAIbaseUrl = openAIbaseUrl; +/// This list is for illustration purposes only. +/// in the `tasks` sub-package, we do not need actual strong typing of the inference providers. +const INFERENCE_PROVIDERS = [ + "cerebras", + "cohere", + "fal-ai", + "fireworks-ai", + "hf-inference", + "hyperbolic", + "ovhcloud", + "replicate", + "sambanova", + "together", +]; +exports.HF_HUB_INFERENCE_PROXY_TEMPLATE = `https://router.huggingface.co/{{PROVIDER}}`; +/** + * URL to set as baseUrl in the OpenAI SDK. + * + * TODO(Expose this from InferenceClient in the future?) + */ +function openAIbaseUrl(provider) { + const url = exports.HF_HUB_INFERENCE_PROXY_TEMPLATE.replace("{{PROVIDER}}", provider); + return provider === "hf-inference" ? `${url}/v1` : url; +} diff --git a/node_modules/@huggingface/tasks/dist/commonjs/library-to-tasks.d.ts b/node_modules/@huggingface/tasks/dist/commonjs/library-to-tasks.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..61ffd282076871d1b86f92570b95e9a44cded208 --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/library-to-tasks.d.ts @@ -0,0 +1,12 @@ +import type { ModelLibraryKey } from "./model-libraries.js"; +import type { PipelineType } from "./pipelines.js"; +/** + * Mapping from library name to its supported tasks. + * HF-Inference API (serverless) should be disabled for all other (library, task) pairs beyond this mapping. + * This mapping is partially generated automatically by "python-api-export-tasks" action in + * huggingface/api-inference-community repo upon merge. For transformers, the mapping is manually + * based on api-inference (hf_types.rs). + */ +export declare const LIBRARY_TASK_MAPPING: Partial>; +export declare const REMOVED_IN_V5_TRANSFORMERS_PIPELINES: PipelineType[]; +//# sourceMappingURL=library-to-tasks.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/dist/commonjs/library-to-tasks.d.ts.map b/node_modules/@huggingface/tasks/dist/commonjs/library-to-tasks.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..8b35f76b24f02a9f3c534de64d33fe47930cb7ae --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/library-to-tasks.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"library-to-tasks.d.ts","sourceRoot":"","sources":["../../src/library-to-tasks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,YAAY,EAAE,CAAC,CA6DjF,CAAC;AAGF,eAAO,MAAM,oCAAoC,EAAE,YAAY,EAAsD,CAAC"} \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/dist/commonjs/library-to-tasks.js b/node_modules/@huggingface/tasks/dist/commonjs/library-to-tasks.js new file mode 100644 index 0000000000000000000000000000000000000000..6d6ac94d7f1082c4b2216f1f722ec0808c551204 --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/library-to-tasks.js @@ -0,0 +1,74 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.REMOVED_IN_V5_TRANSFORMERS_PIPELINES = exports.LIBRARY_TASK_MAPPING = void 0; +/** + * Mapping from library name to its supported tasks. + * HF-Inference API (serverless) should be disabled for all other (library, task) pairs beyond this mapping. + * This mapping is partially generated automatically by "python-api-export-tasks" action in + * huggingface/api-inference-community repo upon merge. For transformers, the mapping is manually + * based on api-inference (hf_types.rs). + */ +exports.LIBRARY_TASK_MAPPING = { + "adapter-transformers": ["question-answering", "text-classification", "token-classification"], + allennlp: ["question-answering"], + asteroid: [ + // "audio-source-separation", + "audio-to-audio", + ], + bertopic: ["text-classification"], + diffusers: ["image-to-image", "text-to-image"], + doctr: ["object-detection"], + espnet: ["text-to-speech", "automatic-speech-recognition"], + fairseq: ["text-to-speech", "audio-to-audio"], + fastai: ["image-classification"], + fasttext: ["feature-extraction", "text-classification"], + flair: ["token-classification"], + k2: ["automatic-speech-recognition"], + keras: ["image-classification"], + nemo: ["automatic-speech-recognition"], + open_clip: ["zero-shot-classification", "zero-shot-image-classification"], + paddlenlp: ["fill-mask", "summarization", "zero-shot-classification"], + peft: ["text-generation"], + "pyannote-audio": ["automatic-speech-recognition"], + "sentence-transformers": ["feature-extraction", "sentence-similarity"], + setfit: ["text-classification"], + sklearn: ["tabular-classification", "tabular-regression", "text-classification"], + spacy: ["token-classification", "text-classification", "sentence-similarity"], + "span-marker": ["token-classification"], + speechbrain: ["audio-classification", "audio-to-audio", "automatic-speech-recognition", "text-to-speech"], + stanza: ["token-classification"], + timm: ["image-classification", "image-feature-extraction"], + transformers: [ + "audio-classification", + "automatic-speech-recognition", + "depth-estimation", + "document-question-answering", + "feature-extraction", + "fill-mask", + "image-classification", + "image-feature-extraction", + "image-segmentation", + "image-to-image", + "image-to-text", + "image-text-to-text", + "mask-generation", + "object-detection", + "question-answering", + "summarization", + "table-question-answering", + "text-classification", + "text-generation", + "text-to-audio", + "text-to-speech", + "token-classification", + "translation", + "video-classification", + "visual-question-answering", + "zero-shot-classification", + "zero-shot-image-classification", + "zero-shot-object-detection", + ], + mindspore: ["image-classification"], +}; +// Pipeline types that were supported in legacy transformers versions (<5.0.0) +exports.REMOVED_IN_V5_TRANSFORMERS_PIPELINES = ["image-to-text", "summarization", "translation"]; diff --git a/node_modules/@huggingface/tasks/dist/commonjs/local-apps.d.ts b/node_modules/@huggingface/tasks/dist/commonjs/local-apps.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..03410adca8cb77bb0d1c9b6328d1276d98ac5309 --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/local-apps.d.ts @@ -0,0 +1,218 @@ +import type { ModelData } from "./model-data.js"; +import type { PipelineType } from "./pipelines.js"; +export interface LocalAppSnippet { + /** + * Title of the snippet + */ + title: string; + /** + * Optional setup guide + */ + setup?: string; + /** + * Content (or command) to be run + */ + content: string | string[]; +} +/** + * Elements configurable by a local app. + */ +export type LocalApp = { + /** + * Name that appears in buttons + */ + prettyLabel: string; + /** + * Link to get more info about a local app (website etc) + */ + docsUrl: string; + /** + * main category of app + */ + mainTask: PipelineType; + /** + * Whether to display a pill "macOS-only" + */ + macOSOnly?: boolean; + comingSoon?: boolean; + /** + * IMPORTANT: function to figure out whether to display the button on a model page's main "Use this model" dropdown. + */ + displayOnModelPage: (model: ModelData) => boolean; +} & ({ + /** + * If the app supports deeplink, URL to open. + */ + deeplink: (model: ModelData, filepath?: string) => URL; +} | { + /** + * And if not (mostly llama.cpp), snippet to copy/paste in your terminal + * Support the placeholder {{GGUF_FILE}} that will be replaced by the gguf file path or the list of available files. + * Support the placeholder {{QUANT_TAG}} that will be replaced by the list of available quant tags or will be removed if there are no multiple quant files in a same repo. + */ + snippet: (model: ModelData, filepath?: string) => string | string[] | LocalAppSnippet | LocalAppSnippet[]; +}); +declare function isTgiModel(model: ModelData): boolean; +declare function isLlamaCppGgufModel(model: ModelData): boolean; +declare function isVllmModel(model: ModelData): boolean; +declare function isDockerModelRunnerModel(model: ModelData): boolean; +/** + * Add your new local app here. + * + * This is open to new suggestions and awesome upcoming apps. + * + * /!\ IMPORTANT + * + * If possible, you need to support deeplinks and be as cross-platform as possible. + * + * Ping the HF team if we can help with anything! + */ +export declare const LOCAL_APPS: { + "llama.cpp": { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: typeof isLlamaCppGgufModel; + snippet: (model: ModelData, filepath?: string) => LocalAppSnippet[]; + }; + "node-llama-cpp": { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: typeof isLlamaCppGgufModel; + snippet: (model: ModelData, filepath?: string) => LocalAppSnippet[]; + }; + vllm: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: typeof isVllmModel; + snippet: (model: ModelData) => LocalAppSnippet[]; + }; + sglang: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: (model: ModelData) => boolean; + snippet: (model: ModelData) => LocalAppSnippet[]; + }; + "mlx-lm": { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: (model: ModelData) => boolean; + snippet: (model: ModelData) => LocalAppSnippet[]; + }; + tgi: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: typeof isTgiModel; + snippet: (model: ModelData) => LocalAppSnippet[]; + }; + lmstudio: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: (model: ModelData) => boolean; + deeplink: (model: ModelData, filepath: string | undefined) => URL; + }; + localai: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: typeof isLlamaCppGgufModel; + snippet: (model: ModelData, filepath?: string) => LocalAppSnippet[]; + }; + jan: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: typeof isLlamaCppGgufModel; + deeplink: (model: ModelData) => URL; + }; + backyard: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: typeof isLlamaCppGgufModel; + deeplink: (model: ModelData) => URL; + }; + sanctum: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: typeof isLlamaCppGgufModel; + deeplink: (model: ModelData) => URL; + }; + jellybox: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: (model: ModelData) => boolean; + deeplink: (model: ModelData) => URL; + }; + msty: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: typeof isLlamaCppGgufModel; + deeplink: (model: ModelData) => URL; + }; + recursechat: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + macOSOnly: true; + displayOnModelPage: typeof isLlamaCppGgufModel; + deeplink: (model: ModelData) => URL; + }; + drawthings: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-to-image"; + macOSOnly: true; + displayOnModelPage: (model: ModelData) => boolean; + deeplink: (model: ModelData) => URL; + }; + diffusionbee: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-to-image"; + macOSOnly: true; + displayOnModelPage: (model: ModelData) => boolean; + deeplink: (model: ModelData) => URL; + }; + joyfusion: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-to-image"; + macOSOnly: true; + displayOnModelPage: (model: ModelData) => boolean; + deeplink: (model: ModelData) => URL; + }; + ollama: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: typeof isLlamaCppGgufModel; + snippet: (model: ModelData, filepath?: string) => string; + }; + "docker-model-runner": { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: typeof isDockerModelRunnerModel; + snippet: (model: ModelData, filepath?: string) => string; + }; + lemonade: { + prettyLabel: string; + docsUrl: string; + mainTask: "text-generation"; + displayOnModelPage: (model: ModelData) => boolean; + snippet: (model: ModelData, filepath?: string) => LocalAppSnippet[]; + }; +}; +export type LocalAppKey = keyof typeof LOCAL_APPS; +export {}; +//# sourceMappingURL=local-apps.d.ts.map \ No newline at end of file diff --git a/node_modules/@huggingface/tasks/dist/commonjs/local-apps.d.ts.map b/node_modules/@huggingface/tasks/dist/commonjs/local-apps.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..63aabe7d48b4022235d4c32a812f773b37b9f53d --- /dev/null +++ b/node_modules/@huggingface/tasks/dist/commonjs/local-apps.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"local-apps.d.ts","sourceRoot":"","sources":["../../src/local-apps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAKnD,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACtB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,kBAAkB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC;CAClD,GAAG,CACD;IACA;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,GAAG,CAAC;CACtD,GACD;IACA;;;;OAIG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,EAAE,GAAG,eAAe,GAAG,eAAe,EAAE,CAAC;CACzG,CACH,CAAC;AAsBF,iBAAS,UAAU,CAAC,KAAK,EAAE,SAAS,GA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