bitgpu 0.19.0 → 0.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/gguf.d.ts CHANGED
@@ -1,13 +1,11 @@
1
- import { u as Manifest } from "./types-CBW7T_3s.js";
2
-
3
- //#region src/gguf.d.ts
4
- interface GgufModel {
1
+ import { u as Manifest } from "./types-_ie0s0iY.js";
2
+ export interface GgufModel {
5
3
  manifest: Manifest;
6
4
  aux: Uint8Array;
7
5
  /** The GGUF URL itself - the weights stream from it byte-for-byte unchanged. */
8
6
  dataUrl: string;
9
7
  }
10
- interface FromGgufOptions {
8
+ export interface FromGgufOptions {
11
9
  /** Fetch `len` bytes at `off`. Override for caching or non-HTTP sources. Default: `fetch`
12
10
  * with a `Range` header (and a stream-and-cancel fallback for servers that ignore ranges). */
13
11
  fetchRange?: (url: string, off: number, len: number) => Promise<ArrayBuffer>;
@@ -17,17 +15,14 @@ interface FromGgufOptions {
17
15
  /** The two expansion tables the kernels use, generated from their defining property:
18
16
  * LSB-first sign bits -> per-weight codes around the recipe midpoints (2-bit: {1,3},
19
17
  * 4-bit: {7,9}). Byte-identical to the tables the ONNX exports carry. */
20
- declare function ggufLuts(): Uint8Array;
18
+ export declare function ggufLuts(): Uint8Array;
21
19
  /** Parse a GGUF header already in memory (e.g. from a File). Grows nothing - the buffer must
22
20
  * contain the full header (weights past it are not needed). */
23
- declare function fromGgufBytes(buf: ArrayBuffer, dataFile: string): {
21
+ export declare function fromGgufBytes(buf: ArrayBuffer, dataFile: string): {
24
22
  manifest: Manifest;
25
23
  aux: Uint8Array;
26
24
  };
27
25
  /** Fetch and parse a GGUF header; returns `{ manifest, aux, dataUrl }` for createEngine.
28
26
  * Only the header is transferred, progressively: 1 MiB first, then EXTENSION ranges (2x
29
27
  * growth) appended to the kept prefix - total transfer stays under 2x the header size. */
30
- declare function fromGguf(url: string, options?: FromGgufOptions): Promise<GgufModel>;
31
- //#endregion
32
- export { FromGgufOptions, GgufModel, fromGguf, fromGgufBytes, ggufLuts };
33
- //# sourceMappingURL=gguf.d.ts.map
28
+ export declare function fromGguf(url: string, options?: FromGgufOptions): Promise<GgufModel>;
package/dist/gguf.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/gguf.ts
1
+ // src/gguf.ts
2
2
  const F32 = 0;
3
3
  const Q1_0 = 41;
4
4
  const BLK = 18;
@@ -562,7 +562,6 @@ async function fromGguf(url, options = {}) {
562
562
  size = next;
563
563
  }
564
564
  }
565
- //#endregion
566
565
  export { fromGguf, fromGgufBytes, ggufLuts };
567
566
 
568
567
  //# sourceMappingURL=gguf.js.map
package/dist/index.d.ts CHANGED
@@ -1,24 +1,18 @@
1
- import { a as ForwardResult, c as KvSnapshot, d as ManifestArch, f as ManifestRef, i as EngineOptions, l as LoadProgress, m as TokenLogprobs, n as Engine, o as GenerateOptions, p as ManifestTensor, r as EngineCapabilities, s as GenerateResult, t as DeviceLostInfo, u as Manifest } from "./types-CBW7T_3s.js";
2
-
3
- //#region src/engine.d.ts
1
+ import { a as ForwardResult, c as KvSnapshot, d as ManifestArch, f as ManifestRef, i as EngineOptions, l as LoadProgress, m as TokenLogprobs, n as Engine, o as GenerateOptions, p as ManifestTensor, r as EngineCapabilities, s as GenerateResult, t as DeviceLostInfo, u as Manifest } from "./types-_ie0s0iY.js";
4
2
  /** Load a 1-bit model and return an {@link Engine}. Pass a model URL string for defaults. */
5
- declare function createEngine(options: EngineOptions | string): Promise<Engine>;
6
- //#endregion
7
- //#region src/errors.d.ts
3
+ export declare function createEngine(options: EngineOptions | string): Promise<Engine>;
8
4
  /** Thrown when WebGPU is unavailable: no `navigator.gpu` (unsupported browser, or a
9
5
  * non-secure context) or no adapter could be acquired. Catch this to render a
10
6
  * "your browser doesn't support WebGPU yet" fallback instead of crashing. */
11
- declare class WebGPUUnavailableError extends Error {
7
+ export declare class WebGPUUnavailableError extends Error {
12
8
  readonly name = "WebGPUUnavailableError";
13
9
  constructor(message: string);
14
10
  }
15
11
  /** Thrown when the GPU reports out-of-memory while the engine allocates weights or grows the
16
12
  * KV cache. Without this check the allocation "succeeds" with invalid buffers and every later
17
13
  * generate() returns garbage. Catch it to fall back (smaller maxSeqLen, or a no-LLM mode). */
18
- declare class GpuOutOfMemoryError extends Error {
14
+ export declare class GpuOutOfMemoryError extends Error {
19
15
  readonly name = "GpuOutOfMemoryError";
20
16
  constructor(message: string);
21
17
  }
22
- //#endregion
23
- export { type DeviceLostInfo, type Engine, type EngineCapabilities, type EngineOptions, type ForwardResult, type GenerateOptions, type GenerateResult, GpuOutOfMemoryError, type KvSnapshot, type LoadProgress, type Manifest, type ManifestArch, type ManifestRef, type ManifestTensor, type TokenLogprobs, WebGPUUnavailableError, createEngine };
24
- //# sourceMappingURL=index.d.ts.map
18
+ export type { DeviceLostInfo, Engine, EngineCapabilities, EngineOptions, ForwardResult, GenerateOptions, GenerateResult, KvSnapshot, LoadProgress, Manifest, ManifestArch, ManifestRef, ManifestTensor, TokenLogprobs };