webslm 0.11.1 → 0.12.1

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # webslm
2
2
 
3
- Run small language models in the browser and in Node, straight from their original Hugging Face checkpoints. A Rust engine compiled to WebAssembly reads `config.json`, `tokenizer.json`, the chat template and the `*.safetensors` weights as published, with no conversion step.
3
+ Run small language and vision-language models (and small embedding, speech recognition and text-to-image models) in the browser and in Node, straight from their original Hugging Face checkpoints. A Rust engine compiled to WebAssembly reads `config.json`, `tokenizer.json`, the chat template and the `*.safetensors` weights as published, with no conversion step.
4
4
 
5
5
  ```sh
6
6
  npm install webslm
@@ -18,8 +18,9 @@ The first call downloads the default model ([LFM2.5 350M](https://huggingface.co
18
18
  - Downloads a checkpoint once into the Origin Private File System (a directory in Node), resumes interrupted downloads, checks the Hub's SHA-256 and loads offline afterwards.
19
19
  - Streams answers, keeps conversations, and exposes a low-level session API (teacher-forced scoring, step-wise decoding, logits and hidden states as `Float32Array`s).
20
20
  - Searches the Hub for models it can run.
21
+ - Answers about [images and video](#images-and-video), [embeds](#embeddings) texts, [transcribes](#speech-recognition) speech, [generates images](#image-generation) and [trains](#training) LoRA adapters on the device.
21
22
 
22
- Supported architectures: Llama-style (SmolLM2, Mistral), Qwen2, Qwen3, Qwen3.5 (language model; Gated DeltaNet hybrid), LFM2 / LFM2.5 and LFM3. Models run on WebGPU or on the CPU through WebAssembly (SIMD, and Web Worker threads where the page allows): with `device: "auto"` (the default), WebGPU for models above ~100M parameters when the browser has an adapter, the CPU otherwise; `ModelInfo.backend` says which one runs. In Node and Bun, the [native engine](#native-engine-in-node) runs instead (downloaded once from the release, checked, and cached): native SIMD kernels on every core, and the GPU through Metal, Vulkan or DX12. ESM only; browsers with WebAssembly SIMD (every current browser). Demo: <https://maxgfr.github.io/webslm/>.
23
+ Supported architectures: Llama-style (SmolLM2, Mistral), Qwen2, Qwen3, Qwen3.5 (Gated DeltaNet hybrid, with its vision encoder), LFM2 / LFM2.5 and LFM3; the vision-language models SmolVLM / SmolVLM2 and LFM2-VL / LFM2.5-VL; the encoders BERT / MiniLM, ModernBERT and model2vec; Whisper; and Stable Diffusion style UNets (SDXS) and Sana-Sprint for image generation. Models run on WebGPU or on the CPU through WebAssembly (SIMD, and Web Worker threads where the page allows): with `device: "auto"` (the default), WebGPU for models above ~100M parameters when the browser has an adapter, the CPU otherwise; `ModelInfo.backend` says which one runs. In Node and Bun, the [native engine](#native-engine-in-node) runs instead (downloaded once from the release, checked, and cached): native SIMD kernels on every core, and the GPU through Metal, Vulkan or DX12. ESM only; browsers with WebAssembly SIMD (every current browser). Demo: <https://maxgfr.github.io/webslm/>.
23
24
 
24
25
  ## Ask
25
26
 
@@ -160,7 +161,13 @@ await fox.toPng(); // Uint8Array, also toBlob()
160
161
  await model.unload();
161
162
  ```
162
163
 
163
- `loadImageModel(source, options)` takes a Hub id or a `files` / `fetch` [source](#sources), `device`, `backend`, `quant`, `decoder` (a standalone autoencoder replacing the pipeline's own, e.g. `"madebyollin/taesd"`), `revision`, `token`, `cacheDir`, `worker`, `engine`, `signal` and `onProgress`. `generate(prompt, options)` takes `width` / `height` / `size`, `steps` (default 1), `guidance` (classifier-free guidance, default 0; above 1 the model also runs on `negativePrompt`), `seed`, `onProgress` and `signal`; a model runs its generations one after the other. `info()` reports the pipeline and scheduler classes, the decoder (`"tiny"` or `"kl"`), `sizeMultiple`, the device and backend, and the weight format. `generateImage(prompt, { model, ...options })` loads `model` (a repository id, default `DEFAULT_IMAGE_MODEL`, or a loaded `ImageModel`) on first use and keeps it; `unloadAll()` (or `unloadImageModels()`) frees it. `encodePng(width, height, rgba)` encodes pixels as PNG.
164
+ `loadImageModel(source, options)` takes a Hub id or a `files` / `fetch` [source](#sources), `device`, `backend`, `quant`, `textQuant` (the text encoder's format when it differs: `"q8"` or `"q4"` for Sana-Sprint's 2.6B-parameter Gemma 2 encoder), `decoder` (a standalone autoencoder replacing the pipeline's own, e.g. `"madebyollin/taesd"`), `revision`, `token`, `cacheDir`, `worker`, `engine`, `signal` and `onProgress`. `generate(prompt, options)` takes `width` / `height` / `size`, `steps`, `guidance`, `seed`, `onProgress` and `signal`; size, steps and guidance default to the model's (`info().defaultSize`, `defaultSteps`, `defaultGuidance`: 512, 1 and 0 for SDXS, 1024, 2 and 4.5 for Sana-Sprint). For Stable Diffusion UNets `guidance` is classifier-free guidance (above 1 the model also runs on `negativePrompt`); Sana-Sprint reads it as an input of its transformer. A model runs its generations one after the other. `info()` reports the pipeline and scheduler classes, the decoder (`"tiny"`, `"kl"` or `"dc"`), `sizeMultiple`, the defaults, the device and backend, and the weight formats (`quant`, `textQuant`).
165
+
166
+ ```ts
167
+ // Sana-Sprint (Apache-2.0): 2 steps at 1024 x 1024 by default; Gemma 2 in 4 bits fits a browser tab.
168
+ const sana = await loadImageModel("Efficient-Large-Model/Sana_Sprint_0.6B_1024px_diffusers", { textQuant: "q4" });
169
+ const image = await sana.generate("a red fox in a snowy forest", { size: 512, seed: 42 });
170
+ ``` `generateImage(prompt, { model, ...options })` loads `model` (a repository id, default `DEFAULT_IMAGE_MODEL`, or a loaded `ImageModel`) on first use and keeps it; `unloadAll()` (or `unloadImageModels()`) frees it. `encodePng(width, height, rgba)` encodes pixels as PNG.
164
171
 
165
172
  The AI SDK provider has `webslm.imageModel(id)` for `generateImage` from `ai` (see [AI SDK](#ai-sdk)).
166
173
 
@@ -603,7 +610,7 @@ export default defineConfig({
603
610
  });
604
611
  ```
605
612
 
606
- Server code that imports webslm must not be bundled: webslm runs from its own files in `node_modules` (Next.js: `serverExternalPackages: ["webslm"]`). Without a bundler, a page can import it from jsDelivr (`https://cdn.jsdelivr.net/npm/webslm@0.11.1/dist/index.js`); webslm starts its workers through same-origin `blob:` workers when its files come from another origin. Guides for Next.js, Vite, webpack, Node servers, Bun, Deno and CDNs, each with a tested example: <https://github.com/maxgfr/webslm#frameworks-bundlers-and-runtimes>.
613
+ Server code that imports webslm must not be bundled: webslm runs from its own files in `node_modules` (Next.js: `serverExternalPackages: ["webslm"]`). Without a bundler, a page can import it from jsDelivr (`https://cdn.jsdelivr.net/npm/webslm@0.12.1/dist/index.js`); webslm starts its workers through same-origin `blob:` workers when its files come from another origin. Guides for Next.js, Vite, webpack, Node servers, Bun, Deno and CDNs, each with a tested example: <https://github.com/maxgfr/webslm#frameworks-bundlers-and-runtimes>.
607
614
 
608
615
  ## Errors
609
616
 
@@ -68,8 +68,6 @@ export function sizeOfAspectRatio(aspectRatio, base, multiple) {
68
68
  ? { width: roundTo(base, multiple), height: roundTo((base * h) / w, multiple) }
69
69
  : { width: roundTo((base * w) / h, multiple), height: roundTo(base, multiple) };
70
70
  }
71
- /** Default side of the images, in pixels. */
72
- const DEFAULT_SIDE = 512;
73
71
  /**
74
72
  * A webslm text-to-image model for the AI SDK's `generateImage`. Images are
75
73
  * PNG files; `n` images get seeds `seed`, `seed + 1`... (a random `seed`
@@ -100,7 +98,7 @@ export class WebslmImageModel {
100
98
  }
101
99
  try {
102
100
  const model = await this.#slot.get(options.abortSignal);
103
- const multiple = model.info().sizeMultiple;
101
+ const { sizeMultiple: multiple, defaultSize } = model.info();
104
102
  let size;
105
103
  if (options.size !== undefined) {
106
104
  const [w, h] = options.size.split("x").map(Number);
@@ -110,7 +108,7 @@ export class WebslmImageModel {
110
108
  }
111
109
  }
112
110
  else if (options.aspectRatio !== undefined) {
113
- size = sizeOfAspectRatio(options.aspectRatio, DEFAULT_SIDE, multiple);
111
+ size = sizeOfAspectRatio(options.aspectRatio, defaultSize, multiple);
114
112
  if (size === undefined) {
115
113
  warnings.push({ type: "unsupported", feature: "aspectRatio", details: `invalid ${options.aspectRatio}` });
116
114
  }
package/dist/engine.js CHANGED
@@ -916,7 +916,11 @@ export class Engine {
916
916
  let handle;
917
917
  let raw;
918
918
  let opened;
919
- const loadOptions = JSON.stringify({ format: options.quant, device: options.device ?? "auto" });
919
+ const loadOptions = JSON.stringify({
920
+ format: options.quant,
921
+ ...(options.textQuant === undefined ? {} : { textFormat: options.textQuant }),
922
+ device: options.device ?? "auto",
923
+ });
920
924
  if (native.addon?.NativeImageModel !== undefined) {
921
925
  const createHasher = await nodeSha256();
922
926
  opened = await this.#openSource(active, request.source, options.cacheDir, progress, createHasher);
@@ -1046,15 +1050,22 @@ function imageModelInfo(raw, runtime, opened, runtimeNote, loadTimeMs) {
1046
1050
  : device === "cpu"
1047
1051
  ? "WebAssembly CPU"
1048
1052
  : `WebGPU${adapter === undefined ? "" : ` (${adapter})`}`;
1053
+ const num = (key, fallback) => (typeof raw[key] === "number" ? raw[key] : fallback);
1054
+ const decoder = str("decoder");
1055
+ const quant = str("weightFormat") ?? "f16";
1049
1056
  return {
1050
1057
  pipeline: str("pipeline") ?? "",
1051
- decoder: str("decoder") === "kl" ? "kl" : "tiny",
1058
+ decoder: decoder === "kl" || decoder === "dc" ? decoder : "tiny",
1052
1059
  scheduler: str("scheduler") ?? "",
1053
- sizeMultiple: typeof raw["sizeMultiple"] === "number" ? raw["sizeMultiple"] : 8,
1060
+ sizeMultiple: num("sizeMultiple", 8),
1061
+ defaultSize: num("defaultSize", 512),
1062
+ defaultSteps: num("defaultSteps", 1),
1063
+ defaultGuidance: num("defaultGuidance", 0),
1054
1064
  device,
1055
1065
  backend,
1056
1066
  runtime,
1057
- quant: str("weightFormat") ?? "f16",
1067
+ quant,
1068
+ textQuant: str("textFormat") ?? quant,
1058
1069
  ...(opened.repo === undefined ? {} : { repo: opened.repo }),
1059
1070
  ...(opened.revision === undefined ? {} : { revision: opened.revision }),
1060
1071
  ...(deviceNote === undefined ? {} : { deviceNote }),
package/dist/hub.d.ts CHANGED
@@ -52,7 +52,8 @@ export declare function isImagePipelineListing(names: readonly string[]): boolea
52
52
  /**
53
53
  * The files of a `diffusers` pipeline or standalone component to download
54
54
  * (`diffusion::needed_files` in Rust): a pipeline needs its metadata and
55
- * one weight file per component, preferring half precision; a standalone
55
+ * the weights of its text encoder, its denoiser (`unet/` or `transformer/`)
56
+ * and its autoencoder, preferring half precision; a standalone
56
57
  * autoencoder (`madebyollin/taesd`: a `config.json`, no tokenizer, and
57
58
  * `diffusion_pytorch_model.safetensors`) its config and weights. `undefined`
58
59
  * for other repositories; `weights` is empty when a component has none.
package/dist/hub.js CHANGED
@@ -100,18 +100,21 @@ export function isAdapterListing(names) {
100
100
  }
101
101
  /** The pipeline description at the root of a `diffusers` repository. */
102
102
  export const MODEL_INDEX = "model_index.json";
103
- /** Components a text-to-image pipeline reads (one weight file each). */
104
- const PIPELINE_COMPONENTS = ["text_encoder", "unet", "vae"];
103
+ /** Folders of a pipeline's denoising network: a UNet or a transformer (Sana). */
104
+ const PIPELINE_DENOISERS = ["unet", "transformer"];
105
105
  /** Small files of a text-to-image pipeline (`diffusion::PIPELINE_METADATA_FILES` in Rust). */
106
106
  const PIPELINE_METADATA_FILES = [
107
107
  MODEL_INDEX,
108
108
  "scheduler/scheduler_config.json",
109
109
  "tokenizer/vocab.json",
110
110
  "tokenizer/merges.txt",
111
+ "tokenizer/tokenizer.json",
111
112
  "tokenizer/tokenizer_config.json",
112
113
  "tokenizer/special_tokens_map.json",
113
114
  "text_encoder/config.json",
115
+ "text_encoder/model.safetensors.index.json",
114
116
  "unet/config.json",
117
+ "transformer/config.json",
115
118
  "vae/config.json",
116
119
  ];
117
120
  /**
@@ -123,6 +126,24 @@ function componentWeightCandidates(component) {
123
126
  const prefix = component === "" ? "" : `${component}/`;
124
127
  return [`${prefix}${stem}.fp16.safetensors`, `${prefix}${stem}.safetensors`];
125
128
  }
129
+ /**
130
+ * The weight files of a pipeline component among `present`
131
+ * (`diffusion::component_weight_files` in Rust): its single file, half
132
+ * precision first, else every shard next to its index
133
+ * (`text_encoder/model.safetensors.index.json` and
134
+ * `text_encoder/model-00001-of-00002.safetensors`...).
135
+ */
136
+ function componentWeightFiles(component, present) {
137
+ const single = componentWeightCandidates(component).find((f) => present.has(f));
138
+ if (single !== undefined)
139
+ return [single];
140
+ const stem = component === "text_encoder" ? "model" : "diffusion_pytorch_model";
141
+ if (!present.has(`${component}/${stem}.safetensors.index.json`))
142
+ return undefined;
143
+ const shard = new RegExp(`^${component}/${stem}-\\d+-of-\\d+\\.safetensors$`);
144
+ const shards = [...present].filter((f) => shard.test(f)).sort();
145
+ return shards.length > 0 ? shards : undefined;
146
+ }
126
147
  /** Whether a repository file list is a `diffusers` text-to-image pipeline. */
127
148
  export function isImagePipelineListing(names) {
128
149
  return names.includes(MODEL_INDEX);
@@ -130,7 +151,8 @@ export function isImagePipelineListing(names) {
130
151
  /**
131
152
  * The files of a `diffusers` pipeline or standalone component to download
132
153
  * (`diffusion::needed_files` in Rust): a pipeline needs its metadata and
133
- * one weight file per component, preferring half precision; a standalone
154
+ * the weights of its text encoder, its denoiser (`unet/` or `transformer/`)
155
+ * and its autoencoder, preferring half precision; a standalone
134
156
  * autoencoder (`madebyollin/taesd`: a `config.json`, no tokenizer, and
135
157
  * `diffusion_pytorch_model.safetensors`) its config and weights. `undefined`
136
158
  * for other repositories; `weights` is empty when a component has none.
@@ -140,8 +162,12 @@ export function selectDiffusionFiles(names) {
140
162
  const pick = (component) => componentWeightCandidates(component).find((f) => present.has(f));
141
163
  if (present.has(MODEL_INDEX)) {
142
164
  const side = PIPELINE_METADATA_FILES.filter((f) => present.has(f));
143
- const weights = PIPELINE_COMPONENTS.map(pick);
144
- return { side, weights: weights.every((w) => w !== undefined) ? weights : [] };
165
+ const text = componentWeightFiles("text_encoder", present);
166
+ const denoiser = PIPELINE_DENOISERS.map((d) => componentWeightFiles(d, present)).find((w) => w !== undefined);
167
+ const vae = componentWeightFiles("vae", present);
168
+ if (text === undefined || denoiser === undefined || vae === undefined)
169
+ return { side, weights: [] };
170
+ return { side, weights: [...text, ...denoiser, ...vae] };
145
171
  }
146
172
  if (present.has("config.json") && !present.has("tokenizer.json")) {
147
173
  const weights = pick("");
package/dist/image.d.ts CHANGED
@@ -23,6 +23,12 @@ export declare const DEFAULT_IMAGE_MODEL = "IDKiro/sdxs-512-dreamshaper";
23
23
  * the image.
24
24
  */
25
25
  export type ImageQuant = "f16" | "f32" | "q8";
26
+ /**
27
+ * How the text encoder's weights are stored, when they differ from the
28
+ * others: Sana-Sprint's Gemma 2 encoder takes 5.2 GB in f16, 2.8 GB in q8
29
+ * and 1.5 GB in q4.
30
+ */
31
+ export type ImageTextQuant = ImageQuant | "q4";
26
32
  /** Where a generation is. */
27
33
  export type ImagePhase = "encoding" | "denoising" | "decoding";
28
34
  /** Progress of {@link ImageModel.generate}. */
@@ -36,12 +42,18 @@ export interface ImageProgress {
36
42
  export interface ImageModelInfo {
37
43
  /** The pipeline class, e.g. `"StableDiffusionPipeline"`. */
38
44
  readonly pipeline: string;
39
- /** `"tiny"` (TAESD) or `"kl"` (the full VAE). */
40
- readonly decoder: "tiny" | "kl";
45
+ /** `"tiny"` (TAESD), `"kl"` (the full VAE) or `"dc"` (DC-AE, Sana's). */
46
+ readonly decoder: "tiny" | "kl" | "dc";
41
47
  /** The scheduler class, e.g. `"EulerDiscreteScheduler"`. */
42
48
  readonly scheduler: string;
43
49
  /** Width and height must be multiples of it. */
44
50
  readonly sizeMultiple: number;
51
+ /** Default width and height (512 for SDXS, 1024 for Sana-Sprint). */
52
+ readonly defaultSize: number;
53
+ /** Default denoising steps (1 for SDXS, 2 for Sana-Sprint). */
54
+ readonly defaultSteps: number;
55
+ /** Default guidance scale (0 for SDXS: none; 4.5 for Sana-Sprint). */
56
+ readonly defaultGuidance: number;
45
57
  /** `"webgpu"` (WebAssembly engine), `"gpu"` (native engine) or `"cpu"`. */
46
58
  readonly device: "webgpu" | "gpu" | "cpu";
47
59
  /** What runs it, e.g. `"WebGPU (apple)"`. */
@@ -50,6 +62,8 @@ export interface ImageModelInfo {
50
62
  readonly runtime: "wasm" | "native";
51
63
  /** The storage format of the weights. */
52
64
  readonly quant: string;
65
+ /** The storage format of the text encoder's weights. */
66
+ readonly textQuant: string;
53
67
  readonly repo?: string;
54
68
  readonly revision?: string;
55
69
  /** Why the requested device was not used, when it was not. */
@@ -63,6 +77,11 @@ export interface ImageModelInfo {
63
77
  export interface LoadImageModelOptions {
64
78
  /** Defaults to `"f16"`. */
65
79
  readonly quant?: ImageQuant;
80
+ /**
81
+ * The text encoder's format (defaults to `quant`). `"q4"` or `"q8"` fits
82
+ * Sana-Sprint's 2.6B-parameter Gemma 2 encoder in a browser tab.
83
+ */
84
+ readonly textQuant?: ImageTextQuant;
66
85
  /**
67
86
  * Defaults to `"auto"`: the GPU whenever one is available (image models are
68
87
  * compute-bound), the CPU otherwise.
@@ -92,17 +111,22 @@ export interface LoadImageModelOptions {
92
111
  }
93
112
  /** Options of {@link ImageModel.generate}. */
94
113
  export interface ImageGenerationOptions {
95
- /** Width in pixels (default 512), a multiple of {@link ImageModelInfo.sizeMultiple}. */
114
+ /**
115
+ * Width in pixels (default {@link ImageModelInfo.defaultSize}), a multiple
116
+ * of {@link ImageModelInfo.sizeMultiple}.
117
+ */
96
118
  readonly width?: number;
97
- /** Height in pixels (default 512). */
119
+ /** Height in pixels (default {@link ImageModelInfo.defaultSize}). */
98
120
  readonly height?: number;
99
121
  /** Both sides: `512`, or `"768x512"` (width × height). */
100
122
  readonly size?: number | `${number}x${number}`;
101
- /** Denoising steps (default 1: one-step models such as SDXS). */
123
+ /** Denoising steps (default {@link ImageModelInfo.defaultSteps}: 1 for SDXS, 2 for Sana-Sprint). */
102
124
  readonly steps?: number;
103
125
  /**
104
- * Classifier-free guidance scale (default 0: none, as distilled models
105
- * expect). Above 1, the model also runs on `negativePrompt`.
126
+ * Guidance scale (default {@link ImageModelInfo.defaultGuidance}). For
127
+ * Stable Diffusion UNets, classifier-free guidance: 0 (none) for
128
+ * distilled models; above 1, the model also runs on `negativePrompt`.
129
+ * Sana-Sprint reads it as an input of its transformer (4.5 by default).
106
130
  */
107
131
  readonly guidance?: number;
108
132
  /** Seed of the initial noise: the same seed gives the same image. Random when omitted. */
package/dist/image.js CHANGED
@@ -16,6 +16,7 @@ import { EngineHandle, normalizeSource, resolveBackend, resolveDevice, toWire }
16
16
  */
17
17
  export const DEFAULT_IMAGE_MODEL = "IDKiro/sdxs-512-dreamshaper";
18
18
  const IMAGE_QUANTS = ["f16", "f32", "q8"];
19
+ const IMAGE_TEXT_QUANTS = [...IMAGE_QUANTS, "q4"];
19
20
  /** A generated image: 8-bit RGBA pixels, row-major. */
20
21
  export class GeneratedImage {
21
22
  width;
@@ -200,6 +201,10 @@ export async function loadImageModel(source = DEFAULT_IMAGE_MODEL, options = {})
200
201
  if (!IMAGE_QUANTS.includes(quant)) {
201
202
  throw new WebslmError("INVALID_ARGUMENT", `quant must be one of ${IMAGE_QUANTS.join(", ")}`);
202
203
  }
204
+ const { textQuant } = options;
205
+ if (textQuant !== undefined && !IMAGE_TEXT_QUANTS.includes(textQuant)) {
206
+ throw new WebslmError("INVALID_ARGUMENT", `textQuant must be one of ${IMAGE_TEXT_QUANTS.join(", ")}`);
207
+ }
203
208
  const normalized = normalizeSource(source, options.revision);
204
209
  if (normalized.kind === "hub" && normalized.file !== undefined) {
205
210
  throw new WebslmError("INVALID_ARGUMENT", "image models load from diffusers pipelines, not single files");
@@ -219,6 +224,7 @@ export async function loadImageModel(source = DEFAULT_IMAGE_MODEL, options = {})
219
224
  ...(decoder === undefined ? {} : { decoder: toWire(decoder, options.token) }),
220
225
  options: {
221
226
  quant,
227
+ ...(textQuant === undefined ? {} : { textQuant }),
222
228
  device,
223
229
  ...(backend === "auto" ? {} : { backend }),
224
230
  ...(options.cacheDir === undefined ? {} : { cacheDir: options.cacheDir }),
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  */
18
18
  import type { SafetensorsHeader } from "./safetensors.js";
19
19
  export { ask, DEFAULT_MAX_TOKENS, DEFAULT_MODEL, DEFAULT_TEMPERATURE, load, splitReasoning, stream, unloadAll, type Answer, type AskOptions, type Chat, type ChatOptions, type ChatTurnOptions, type LLM, type PromptOptions, type SharedAskOptions, type SharedStreamOptions, type TextStream, } from "./simple.js";
20
- export { DEFAULT_IMAGE_MODEL, encodePng, GeneratedImage, generateImage, ImageModel, loadImageModel, unloadImageModels, type GenerateImageOptions, type ImageGenerationOptions, type ImageModelInfo, type ImagePhase, type ImageProgress, type ImageQuant, type LoadImageModelOptions, } from "./image.js";
20
+ export { DEFAULT_IMAGE_MODEL, encodePng, GeneratedImage, generateImage, ImageModel, loadImageModel, unloadImageModels, type GenerateImageOptions, type ImageGenerationOptions, type ImageModelInfo, type ImagePhase, type ImageProgress, type ImageQuant, type ImageTextQuant, type LoadImageModelOptions, } from "./image.js";
21
21
  export { detectCapabilities, getWebGpuAdapterSummary, type Capabilities, type CapabilityEnvironment, type GpuAdapterLike, type GpuLike, type WebGpuAdapterSummary, } from "./capabilities.js";
22
22
  export { createEngine, EngineHandle, loadModel, Model, MODEL_FAMILIES, Session, type ModelFamily, } from "./models.js";
23
23
  export type { Activations, AdapterMode, AdapterSource, AudioInput, ApplyAdapterOptions, Backend, ChatInputMessage, ChatMessage, ChatStream, ContentPart, GeneratedToken, CpuInfo, CompletionOptions, Device, EmbedOptions, Embeddings, EmbeddingInfo, FetchFile, FileData, FinishReason, GenerateOptions, GenerationConfig, GenerationResult, ImageInput, MediaOptions, MediaPart, MultimodalMessage, RawImage, VideoFrames, VideoInput, WeightCacheInfo, LoadedFile, LoadModelOptions, LoadProgress, LoraInfo, ModelInfo, ModelMemory, ModelSource, Pooling, Quant, ScoreOptions, ScoreOutput, SpeechInfo, StepOptions, TranscribeOptions, Transcription, TranscriptionSegment, } from "./types.js";
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import type { SerializedError } from "./errors.js";
9
9
  import type { Activations, AdapterMode, Backend, FileData, LoadProgress, LoraInfo, ModelInfo } from "./types.js";
10
- import type { ImageModelInfo, ImagePhase, ImageQuant } from "./image.js";
10
+ import type { ImageModelInfo, ImagePhase, ImageQuant, ImageTextQuant } from "./image.js";
11
11
  import type { KvCacheType } from "./memory.js";
12
12
  import type { TrainStep, WireTrainGroup } from "./train.js";
13
13
  import type { WasmFlavour } from "./wasm-flavour.js";
@@ -66,6 +66,7 @@ export interface WireLoadOptions {
66
66
  /** Load options of a text-to-image pipeline. */
67
67
  export interface WireImageLoadOptions {
68
68
  readonly quant: ImageQuant;
69
+ readonly textQuant?: ImageTextQuant;
69
70
  /** `"auto"`, `"cpu"`, `"gpu"` or `"webgpu"`. */
70
71
  readonly device?: string;
71
72
  readonly backend?: Backend;
@@ -1,47 +1,47 @@
1
1
  {
2
- "version": "0.11.1",
2
+ "version": "0.12.1",
3
3
  "assets": {
4
4
  "darwin-arm64": {
5
- "file": "webslm-node-0.11.1-darwin-arm64.node.gz",
6
- "size": 5974024,
7
- "sha256": "be110acdeca648992ef9f619e8f49d66dfbbf8e608c8e27b5e9775705082e1e4",
8
- "nodeSha256": "799411614fcb29b23413de0ea814968191130b9b33d52717796238619ce53384"
5
+ "file": "webslm-node-0.12.1-darwin-arm64.node.gz",
6
+ "size": 6140577,
7
+ "sha256": "e212dda69d9716a8b5deb600fa815c1964ae40b81f3f9cf46dee794846a69ce7",
8
+ "nodeSha256": "61498f18a76d281103d9d0a342a9d16db7f8633a3ac7f6cb241b1ffc10a66522"
9
9
  },
10
10
  "darwin-x64": {
11
- "file": "webslm-node-0.11.1-darwin-x64.node.gz",
12
- "size": 6317549,
13
- "sha256": "4545679efe50a75babb140646d3e7b584309fbec22e5f021f6cfc90302c010db",
14
- "nodeSha256": "18f871f9fbe3846dac672231bb36faab8c964dee8ee85e72bb2c6c90e3e6c0c5"
11
+ "file": "webslm-node-0.12.1-darwin-x64.node.gz",
12
+ "size": 6504035,
13
+ "sha256": "36732dc97df6925b0e3596ad017c1cc568e18122b81b1f5ac71ffda8bff15a3d",
14
+ "nodeSha256": "7157b4e4ce4b66b804b55a7f6663f64b92c811c929bc7abf197494f4e0a4d76d"
15
15
  },
16
16
  "linux-x64-gnu": {
17
- "file": "webslm-node-0.11.1-linux-x64-gnu.node.gz",
18
- "size": 6337218,
19
- "sha256": "0fb8f6b7f38817fc7a0d371502f37393de4ded8767a8063a49911cf04752ba1b",
20
- "nodeSha256": "a13ebaf7a5abd97f69f38e20e0019d4a75aede2a4cc021186a105a9a3169c5a7"
17
+ "file": "webslm-node-0.12.1-linux-x64-gnu.node.gz",
18
+ "size": 6515391,
19
+ "sha256": "6d6c5b96e400cedb9fe02dbb779c8e915d149eeef11a55923d22521d0e1248e2",
20
+ "nodeSha256": "9d1005c41b6fda6237431b45931dbc247fbbdcdc7ace3006e4e3fca71208996f"
21
21
  },
22
22
  "linux-arm64-gnu": {
23
- "file": "webslm-node-0.11.1-linux-arm64-gnu.node.gz",
24
- "size": 5932767,
25
- "sha256": "0dbe839027e7614259d30a581cf40890668f5c77f1db49b71a531e1c318bf7ea",
26
- "nodeSha256": "ead5e3c3a3eea1c74d2460d41aeb95fc4fde213c1d623bb11206dfafb0254446"
23
+ "file": "webslm-node-0.12.1-linux-arm64-gnu.node.gz",
24
+ "size": 6109195,
25
+ "sha256": "c14f81210a07d9ee5fff168c8bf8146315e06dc47eaee3df0b5b2dde175b7ae3",
26
+ "nodeSha256": "4d49e2963081191390873a00ebf07f91f07c1e2747655e05b27c196d543f708f"
27
27
  },
28
28
  "linux-x64-musl": {
29
- "file": "webslm-node-0.11.1-linux-x64-musl.node.gz",
30
- "size": 6759040,
31
- "sha256": "a6679d6054aba9e52b0f847923514be98a9037e5f7c3e4d89a33c052f73b3e4a",
32
- "nodeSha256": "3121ee460b78009d7de1a969435bce929beb37dc625c744d8f05518f28270f39"
29
+ "file": "webslm-node-0.12.1-linux-x64-musl.node.gz",
30
+ "size": 6943802,
31
+ "sha256": "cdf670f8ca63d67142c7e5dd4494b49b62412f743349f3d7f99b2c4f04b704c2",
32
+ "nodeSha256": "502f6a136da1d64d84f180b05144273db3300e0d480af3bff2b579fd0096ea18"
33
33
  },
34
34
  "linux-arm64-musl": {
35
- "file": "webslm-node-0.11.1-linux-arm64-musl.node.gz",
36
- "size": 6482175,
37
- "sha256": "c35950fb3708f38bc3af6383581746b8931fd41a97148b8289298bb75d0d93c3",
38
- "nodeSha256": "abd4b4b0e1cfc66f83508b7021c0058b3d43782550d877632c6406531becf3b1"
35
+ "file": "webslm-node-0.12.1-linux-arm64-musl.node.gz",
36
+ "size": 6666573,
37
+ "sha256": "73b1f2db25fb97f87c4dd83307686354c812afaf43f0bb1065a94f2c1e800115",
38
+ "nodeSha256": "0f81a35c9911aab2618df4422c357efbe7f9fa276d6a3ef4443981b5e70d5835"
39
39
  },
40
40
  "win32-x64-msvc": {
41
- "file": "webslm-node-0.11.1-win32-x64-msvc.node.gz",
42
- "size": 6869088,
43
- "sha256": "e3c76ee82eecadee299a4b6b8296fadb83e16b8c2defd9ccfa0fa785baf2b1e9",
44
- "nodeSha256": "89fda38db2823595019984f0321eb724d350caa6b1395b8439a3f023d514f60c"
41
+ "file": "webslm-node-0.12.1-win32-x64-msvc.node.gz",
42
+ "size": 7073349,
43
+ "sha256": "64fb0ba03c1d065db61754acd23d117e11610a308146b8f5d5e08c8d8c0dd668",
44
+ "nodeSha256": "4e848546a1de84ecaf98d9cee866ef65a89fff99b37e363c42a54943a879c1e9"
45
45
  }
46
46
  }
47
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webslm",
3
- "version": "0.11.1",
3
+ "version": "0.12.1",
4
4
  "description": "Run small language models in the browser and in Node, straight from their original Hugging Face checkpoints: a Rust engine compiled to WebAssembly, in a worker, with an offline cache.",
5
5
  "license": "MIT",
6
6
  "author": "Maxime Golfier",
@@ -72,8 +72,9 @@ export class WasmImageModel {
72
72
  info(): any;
73
73
  /**
74
74
  * Loads a pipeline from `source`. `options_json`:
75
- * `{ format?: "f16" | "f32" | "bf16" | "q8" | ..., device?: "cpu" |
76
- * "webgpu" | "auto" }` (defaults: f16 weights, `auto`). `decoder`,
75
+ * `{ format?: "f16" | "f32" | "bf16" | "q8" | ..., textFormat?,
76
+ * device?: "cpu" | "webgpu" | "auto" }` (defaults: f16 weights, the
77
+ * text encoder's as the others, `auto`). `decoder`,
77
78
  * when given, serves a standalone autoencoder (`config.json` and
78
79
  * `diffusion_pytorch_model.safetensors`, e.g. `madebyollin/taesd`)
79
80
  * that replaces the pipeline's decoder.
@@ -171,8 +171,9 @@ export class WasmImageModel {
171
171
  }
172
172
  /**
173
173
  * Loads a pipeline from `source`. `options_json`:
174
- * `{ format?: "f16" | "f32" | "bf16" | "q8" | ..., device?: "cpu" |
175
- * "webgpu" | "auto" }` (defaults: f16 weights, `auto`). `decoder`,
174
+ * `{ format?: "f16" | "f32" | "bf16" | "q8" | ..., textFormat?,
175
+ * device?: "cpu" | "webgpu" | "auto" }` (defaults: f16 weights, the
176
+ * text encoder's as the others, `auto`). `decoder`,
176
177
  * when given, serves a standalone autoencoder (`config.json` and
177
178
  * `diffusion_pytorch_model.safetensors`, e.g. `madebyollin/taesd`)
178
179
  * that replaces the pipeline's decoder.
@@ -1823,32 +1824,32 @@ function __wbg_get_imports() {
1823
1824
  arg0.writeBuffer(arg1, arg2, getArrayU8FromWasm0(arg3, arg4), arg5, arg6);
1824
1825
  }, arguments); },
1825
1826
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
1826
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 392, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1827
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 393, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1827
1828
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true_);
1828
1829
  return ret;
1829
1830
  },
1830
1831
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
1831
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 318, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1832
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 319, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1832
1833
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___sys__JsNullable_wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true_);
1833
1834
  return ret;
1834
1835
  },
1835
1836
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
1836
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 322, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1837
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 323, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1837
1838
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_);
1838
1839
  return ret;
1839
1840
  },
1840
1841
  __wbindgen_generic_0000000000000004: function(arg0, arg1) {
1841
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 322, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1842
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 323, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1842
1843
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__55);
1843
1844
  return ret;
1844
1845
  },
1845
1846
  __wbindgen_generic_0000000000000005: function(arg0, arg1) {
1846
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 318, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1847
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 319, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1847
1848
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___sys__JsNullable_wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true__56);
1848
1849
  return ret;
1849
1850
  },
1850
1851
  __wbindgen_generic_0000000000000006: function(arg0, arg1) {
1851
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 318, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1852
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 319, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1852
1853
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___sys__JsNullable_wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true__57);
1853
1854
  return ret;
1854
1855
  },
Binary file
@@ -72,8 +72,9 @@ export class WasmImageModel {
72
72
  info(): any;
73
73
  /**
74
74
  * Loads a pipeline from `source`. `options_json`:
75
- * `{ format?: "f16" | "f32" | "bf16" | "q8" | ..., device?: "cpu" |
76
- * "webgpu" | "auto" }` (defaults: f16 weights, `auto`). `decoder`,
75
+ * `{ format?: "f16" | "f32" | "bf16" | "q8" | ..., textFormat?,
76
+ * device?: "cpu" | "webgpu" | "auto" }` (defaults: f16 weights, the
77
+ * text encoder's as the others, `auto`). `decoder`,
77
78
  * when given, serves a standalone autoencoder (`config.json` and
78
79
  * `diffusion_pytorch_model.safetensors`, e.g. `madebyollin/taesd`)
79
80
  * that replaces the pipeline's decoder.
@@ -171,8 +171,9 @@ export class WasmImageModel {
171
171
  }
172
172
  /**
173
173
  * Loads a pipeline from `source`. `options_json`:
174
- * `{ format?: "f16" | "f32" | "bf16" | "q8" | ..., device?: "cpu" |
175
- * "webgpu" | "auto" }` (defaults: f16 weights, `auto`). `decoder`,
174
+ * `{ format?: "f16" | "f32" | "bf16" | "q8" | ..., textFormat?,
175
+ * device?: "cpu" | "webgpu" | "auto" }` (defaults: f16 weights, the
176
+ * text encoder's as the others, `auto`). `decoder`,
176
177
  * when given, serves a standalone autoencoder (`config.json` and
177
178
  * `diffusion_pytorch_model.safetensors`, e.g. `madebyollin/taesd`)
178
179
  * that replaces the pipeline's decoder.
@@ -1823,32 +1824,32 @@ function __wbg_get_imports() {
1823
1824
  arg0.writeBuffer(arg1, arg2, getArrayU8FromWasm0(arg3, arg4), arg5, arg6);
1824
1825
  }, arguments); },
1825
1826
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
1826
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 382, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1827
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 383, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1827
1828
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true_);
1828
1829
  return ret;
1829
1830
  },
1830
1831
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
1831
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 308, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1832
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 309, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1832
1833
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___sys__JsNullable_wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true_);
1833
1834
  return ret;
1834
1835
  },
1835
1836
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
1836
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 312, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1837
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 313, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1837
1838
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_);
1838
1839
  return ret;
1839
1840
  },
1840
1841
  __wbindgen_generic_0000000000000004: function(arg0, arg1) {
1841
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 312, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1842
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 313, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1842
1843
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__55);
1843
1844
  return ret;
1844
1845
  },
1845
1846
  __wbindgen_generic_0000000000000005: function(arg0, arg1) {
1846
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 308, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1847
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 309, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1847
1848
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___sys__JsNullable_wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true__56);
1848
1849
  return ret;
1849
1850
  },
1850
1851
  __wbindgen_generic_0000000000000006: function(arg0, arg1) {
1851
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 308, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1852
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 309, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1852
1853
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___sys__JsNullable_wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true__57);
1853
1854
  return ret;
1854
1855
  },
Binary file
@@ -72,8 +72,9 @@ export class WasmImageModel {
72
72
  info(): any;
73
73
  /**
74
74
  * Loads a pipeline from `source`. `options_json`:
75
- * `{ format?: "f16" | "f32" | "bf16" | "q8" | ..., device?: "cpu" |
76
- * "webgpu" | "auto" }` (defaults: f16 weights, `auto`). `decoder`,
75
+ * `{ format?: "f16" | "f32" | "bf16" | "q8" | ..., textFormat?,
76
+ * device?: "cpu" | "webgpu" | "auto" }` (defaults: f16 weights, the
77
+ * text encoder's as the others, `auto`). `decoder`,
77
78
  * when given, serves a standalone autoencoder (`config.json` and
78
79
  * `diffusion_pytorch_model.safetensors`, e.g. `madebyollin/taesd`)
79
80
  * that replaces the pipeline's decoder.
@@ -173,8 +173,9 @@ export class WasmImageModel {
173
173
  }
174
174
  /**
175
175
  * Loads a pipeline from `source`. `options_json`:
176
- * `{ format?: "f16" | "f32" | "bf16" | "q8" | ..., device?: "cpu" |
177
- * "webgpu" | "auto" }` (defaults: f16 weights, `auto`). `decoder`,
176
+ * `{ format?: "f16" | "f32" | "bf16" | "q8" | ..., textFormat?,
177
+ * device?: "cpu" | "webgpu" | "auto" }` (defaults: f16 weights, the
178
+ * text encoder's as the others, `auto`). `decoder`,
178
179
  * when given, serves a standalone autoencoder (`config.json` and
179
180
  * `diffusion_pytorch_model.safetensors`, e.g. `madebyollin/taesd`)
180
181
  * that replaces the pipeline's decoder.
@@ -1983,42 +1984,42 @@ function __wbg_get_imports(memory) {
1983
1984
  arg0.writeBuffer(arg1, arg2, getArrayU8FromWasm0(arg3, arg4), arg5, arg6);
1984
1985
  }, arguments); },
1985
1986
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
1986
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1042, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1987
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1055, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1987
1988
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue__core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true_);
1988
1989
  return ret;
1989
1990
  },
1990
1991
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
1991
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1044, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1992
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1057, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1992
1993
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___js_sys_b608be85a12bc1d0___futures__task__wait_async_polyfill__MessageEvent______true_);
1993
1994
  return ret;
1994
1995
  },
1995
1996
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
1996
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 490, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1997
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 503, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1997
1998
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true_);
1998
1999
  return ret;
1999
2000
  },
2000
2001
  __wbindgen_generic_0000000000000004: function(arg0, arg1) {
2001
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 488, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2002
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 501, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2002
2003
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true_);
2003
2004
  return ret;
2004
2005
  },
2005
2006
  __wbindgen_generic_0000000000000005: function(arg0, arg1) {
2006
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 490, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2007
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 503, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2007
2008
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__62);
2008
2009
  return ret;
2009
2010
  },
2010
2011
  __wbindgen_generic_0000000000000006: function(arg0, arg1) {
2011
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 490, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2012
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 503, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2012
2013
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__63);
2013
2014
  return ret;
2014
2015
  },
2015
2016
  __wbindgen_generic_0000000000000007: function(arg0, arg1) {
2016
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 488, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2017
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 501, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2017
2018
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__64);
2018
2019
  return ret;
2019
2020
  },
2020
2021
  __wbindgen_generic_0000000000000008: function(arg0, arg1) {
2021
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 488, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2022
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 501, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2022
2023
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__65);
2023
2024
  return ret;
2024
2025
  },
@@ -2065,7 +2066,7 @@ function __wbg_get_imports(memory) {
2065
2066
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2066
2067
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2067
2068
  },
2068
- memory: memory || new WebAssembly.Memory({initial:30,maximum:65536,shared:true}),
2069
+ memory: memory || new WebAssembly.Memory({initial:31,maximum:65536,shared:true}),
2069
2070
  };
2070
2071
  return {
2071
2072
  __proto__: null,
Binary file