webslm 0.11.0 → 0.12.0
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 +8 -2
- package/dist/ai-sdk/image-model.js +2 -4
- package/dist/engine.js +15 -4
- package/dist/hub.d.ts +2 -1
- package/dist/hub.js +31 -5
- package/dist/image.d.ts +31 -7
- package/dist/image.js +6 -0
- package/dist/index.d.ts +1 -1
- package/dist/protocol.d.ts +2 -1
- package/native-manifest.json +29 -29
- package/package.json +1 -1
- package/wasm/relaxed/webslm_wasm.d.ts +3 -2
- package/wasm/relaxed/webslm_wasm.js +9 -8
- package/wasm/relaxed/webslm_wasm_bg.wasm +0 -0
- package/wasm/simd/webslm_wasm.d.ts +3 -2
- package/wasm/simd/webslm_wasm.js +9 -8
- package/wasm/simd/webslm_wasm_bg.wasm +0 -0
- package/wasm/threads/webslm_wasm.d.ts +3 -2
- package/wasm/threads/webslm_wasm.js +12 -11
- package/wasm/threads/webslm_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -160,7 +160,13 @@ await fox.toPng(); // Uint8Array, also toBlob()
|
|
|
160
160
|
await model.unload();
|
|
161
161
|
```
|
|
162
162
|
|
|
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`
|
|
163
|
+
`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`).
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
// Sana-Sprint (Apache-2.0): 2 steps at 1024 x 1024 by default; Gemma 2 in 4 bits fits a browser tab.
|
|
167
|
+
const sana = await loadImageModel("Efficient-Large-Model/Sana_Sprint_0.6B_1024px_diffusers", { textQuant: "q4" });
|
|
168
|
+
const image = await sana.generate("a red fox in a snowy forest", { size: 512, seed: 42 });
|
|
169
|
+
``` `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
170
|
|
|
165
171
|
The AI SDK provider has `webslm.imageModel(id)` for `generateImage` from `ai` (see [AI SDK](#ai-sdk)).
|
|
166
172
|
|
|
@@ -603,7 +609,7 @@ export default defineConfig({
|
|
|
603
609
|
});
|
|
604
610
|
```
|
|
605
611
|
|
|
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.
|
|
612
|
+
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.0/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
613
|
|
|
608
614
|
## Errors
|
|
609
615
|
|
|
@@ -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()
|
|
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,
|
|
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({
|
|
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:
|
|
1058
|
+
decoder: decoder === "kl" || decoder === "dc" ? decoder : "tiny",
|
|
1052
1059
|
scheduler: str("scheduler") ?? "",
|
|
1053
|
-
sizeMultiple:
|
|
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
|
|
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
|
-
*
|
|
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
|
-
/**
|
|
104
|
-
const
|
|
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
|
-
*
|
|
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
|
|
144
|
-
|
|
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)
|
|
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
|
-
/**
|
|
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
|
|
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
|
|
123
|
+
/** Denoising steps (default {@link ImageModelInfo.defaultSteps}: 1 for SDXS, 2 for Sana-Sprint). */
|
|
102
124
|
readonly steps?: number;
|
|
103
125
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
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";
|
package/dist/protocol.d.ts
CHANGED
|
@@ -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;
|
package/native-manifest.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.12.0",
|
|
3
3
|
"assets": {
|
|
4
4
|
"darwin-arm64": {
|
|
5
|
-
"file": "webslm-node-0.
|
|
6
|
-
"size":
|
|
7
|
-
"sha256": "
|
|
8
|
-
"nodeSha256": "
|
|
5
|
+
"file": "webslm-node-0.12.0-darwin-arm64.node.gz",
|
|
6
|
+
"size": 6140716,
|
|
7
|
+
"sha256": "82fabc24d852f30164262e4464ccaf66d7fbb9d8f15036741f0a329e809eeac6",
|
|
8
|
+
"nodeSha256": "214c12103f111e26b6d9e723d05b94f2e9a921fad40b0acccbbaa361488aedc7"
|
|
9
9
|
},
|
|
10
10
|
"darwin-x64": {
|
|
11
|
-
"file": "webslm-node-0.
|
|
12
|
-
"size":
|
|
13
|
-
"sha256": "
|
|
14
|
-
"nodeSha256": "
|
|
11
|
+
"file": "webslm-node-0.12.0-darwin-x64.node.gz",
|
|
12
|
+
"size": 6499071,
|
|
13
|
+
"sha256": "2c83db8c7305481ca92aa1652ae9bd5023a812beed0017cf2ddc8c97fb4d7820",
|
|
14
|
+
"nodeSha256": "b34c7d90d43a2eed6cd5626b0359c3fa6f0b9141ec5a4df3cff80012bdaf1e38"
|
|
15
15
|
},
|
|
16
16
|
"linux-x64-gnu": {
|
|
17
|
-
"file": "webslm-node-0.
|
|
18
|
-
"size":
|
|
19
|
-
"sha256": "
|
|
20
|
-
"nodeSha256": "
|
|
17
|
+
"file": "webslm-node-0.12.0-linux-x64-gnu.node.gz",
|
|
18
|
+
"size": 6512134,
|
|
19
|
+
"sha256": "210abd09d68e933b7323a0319ba51558006dab011d935a5d6e20db5312f1835c",
|
|
20
|
+
"nodeSha256": "bf31ad28980cf3890af93c706f262cf16208b704114869236ce5219b0cd4e588"
|
|
21
21
|
},
|
|
22
22
|
"linux-arm64-gnu": {
|
|
23
|
-
"file": "webslm-node-0.
|
|
24
|
-
"size":
|
|
25
|
-
"sha256": "
|
|
26
|
-
"nodeSha256": "
|
|
23
|
+
"file": "webslm-node-0.12.0-linux-arm64-gnu.node.gz",
|
|
24
|
+
"size": 6106673,
|
|
25
|
+
"sha256": "6904daf73a001100becd269f7d34c7d04db995194d2f2e66ebbbcb731cee8a7f",
|
|
26
|
+
"nodeSha256": "86beb6444acb5a413f14d782deccea94b9ae8cb4c1a31ff1aa0ede856a89b0c8"
|
|
27
27
|
},
|
|
28
28
|
"linux-x64-musl": {
|
|
29
|
-
"file": "webslm-node-0.
|
|
30
|
-
"size":
|
|
31
|
-
"sha256": "
|
|
32
|
-
"nodeSha256": "
|
|
29
|
+
"file": "webslm-node-0.12.0-linux-x64-musl.node.gz",
|
|
30
|
+
"size": 6939402,
|
|
31
|
+
"sha256": "25fdbec04d3bfd53a1134975c6d71a422515a4326c5dfc4cd7fd63bd9e11736a",
|
|
32
|
+
"nodeSha256": "97b7acd9fd0e0c65ec39f694faa44e3d7f4ba59bfa34dc1552e16e6f3eb52bbf"
|
|
33
33
|
},
|
|
34
34
|
"linux-arm64-musl": {
|
|
35
|
-
"file": "webslm-node-0.
|
|
36
|
-
"size":
|
|
37
|
-
"sha256": "
|
|
38
|
-
"nodeSha256": "
|
|
35
|
+
"file": "webslm-node-0.12.0-linux-arm64-musl.node.gz",
|
|
36
|
+
"size": 6661808,
|
|
37
|
+
"sha256": "a71f54029461a8d4b4bdff84f4e17318061314ba5c46e6b2a3468e2b8831ae83",
|
|
38
|
+
"nodeSha256": "cfc9475765b25e0a033d52286347054bb74c19d8c30fd306462b600012ab837d"
|
|
39
39
|
},
|
|
40
40
|
"win32-x64-msvc": {
|
|
41
|
-
"file": "webslm-node-0.
|
|
42
|
-
"size":
|
|
43
|
-
"sha256": "
|
|
44
|
-
"nodeSha256": "
|
|
41
|
+
"file": "webslm-node-0.12.0-win32-x64-msvc.node.gz",
|
|
42
|
+
"size": 7073063,
|
|
43
|
+
"sha256": "b8184caa26f7c249e02bc9266177bf1366a2230c4c5d0a0f16cfbd8914a64bb5",
|
|
44
|
+
"nodeSha256": "d611a4dde4770ef7df4df92424b09a1b704ea42cef8fbcbe39bddb3c972845e5"
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webslm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
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" | ...,
|
|
76
|
-
* "webgpu" | "auto" }` (defaults: f16 weights,
|
|
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" | ...,
|
|
175
|
-
* "webgpu" | "auto" }` (defaults: f16 weights,
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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" | ...,
|
|
76
|
-
* "webgpu" | "auto" }` (defaults: f16 weights,
|
|
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.
|
package/wasm/simd/webslm_wasm.js
CHANGED
|
@@ -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" | ...,
|
|
175
|
-
* "webgpu" | "auto" }` (defaults: f16 weights,
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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" | ...,
|
|
76
|
-
* "webgpu" | "auto" }` (defaults: f16 weights,
|
|
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" | ...,
|
|
177
|
-
* "webgpu" | "auto" }` (defaults: f16 weights,
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
2069
|
+
memory: memory || new WebAssembly.Memory({initial:31,maximum:65536,shared:true}),
|
|
2069
2070
|
};
|
|
2070
2071
|
return {
|
|
2071
2072
|
__proto__: null,
|
|
Binary file
|