Interface: TransformersJsCaptionAdapterOptions
Defined in: src/batteries/specialists/caption/transformers_js/types.ts:89
Constructor options for the transformers.js Caption (image-to-text) adapter.
Remarks
model is required — there is no default. The documented reference model is Xenova/vit-gpt2-image-captioning.
Extends
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
createPipeline? | CreateTransformersJsCaptionPipeline | Override the pipeline factory. Default: pipeline('image-to-text', …) via dynamic import. | - | src/batteries/specialists/caption/transformers_js/types.ts:95 |
device? | | "auto" | "gpu" | "cpu" | "wasm" | "webgpu" | "cuda" | "dml" | "coreml" | "webnn" | "webnn-npu" | "webnn-gpu" | "webnn-cpu" | Inference device forwarded to pipeline(). Default: transformers.js environment default. | - | src/batteries/specialists/caption/transformers_js/types.ts:97 |
dtype? | | "auto" | "fp32" | "fp16" | "q8" | "int8" | "uint8" | "q4" | "bnb4" | "q4f16" | "q2" | "q2f16" | "q1" | "q1f16" | Quantization/precision dtype forwarded to pipeline(). | - | src/batteries/specialists/caption/transformers_js/types.ts:99 |
isAvailable? | () => boolean | Override the availability probe. Default: true whenever the peer is importable (env-neutral). | - | src/batteries/specialists/caption/transformers_js/types.ts:109 |
model | string | The image-to-text model id, e.g. Xenova/vit-gpt2-image-captioning. Required — no default. | - | src/batteries/specialists/caption/transformers_js/types.ts:91 |
modelSource? | TransformersJsCaptionModelSource | Custom model-source resolver (OPFS / separate source / bundled bytes). When set, model files load through it behind the global-env mutex; otherwise straight from HF (unchanged). See TransformersJsCaptionModelSource. | - | src/batteries/specialists/caption/transformers_js/types.ts:105 |
onCompiling? | BatteryLifecycleCallback | Engine/graph/shader compilation after download, before the first token. A COARSE marker: the on-device runtimes (LiteRT Engine.create, transformers.js from_pretrained) expose the boundary — download done, opaque WebGPU/WASM graph build about to run — but NOT a progress stream, so progress is usually absent. Often the slowest part of a cold start; without this it was invisible. | BatteryLifecycleHooks.onCompiling | src/batteries/llm/chat_common/lifecycle.ts:95 |
onComplete? | BatteryLifecycleCallback | After the turn's output is parsed + persisted, before ack (fires per turn). | BatteryLifecycleHooks.onComplete | src/batteries/llm/chat_common/lifecycle.ts:105 |
onError? | BatteryLifecycleCallback | A load or generation failure (paired with nack). | BatteryLifecycleHooks.onError | src/batteries/llm/chat_common/lifecycle.ts:107 |
onGenerating? | BatteryLifecycleCallback | The generate call is in progress (fires per turn). Fires once immediately before the provider call for most engines; engines that stream per-step generation progress (e.g. a diffusion denoise loop) fire it REPEATEDLY during generation, each carrying a progress in 0..1. | BatteryLifecycleHooks.onGenerating | src/batteries/llm/chat_common/lifecycle.ts:103 |
onInitProgress? | ProgressCallback | Called with model-load progress reports while weights download/compile. | - | src/batteries/specialists/caption/transformers_js/types.ts:107 |
onLifecycle? | BatteryLifecycleCallback | Fires on EVERY phase transition (the firehose). | BatteryLifecycleHooks.onLifecycle | src/batteries/llm/chat_common/lifecycle.ts:86 |
onLoading? | BatteryLifecycleCallback | Weights/runtime loading — may fire repeatedly with progress as the provider reports it. | BatteryLifecycleHooks.onLoading | src/batteries/llm/chat_common/lifecycle.ts:88 |
onReady? | BatteryLifecycleCallback | Engine/pipeline resolved and cached, before the first generation. | BatteryLifecycleHooks.onReady | src/batteries/llm/chat_common/lifecycle.ts:97 |
pipeline? | TransformersJsCaptionPipeline | A pre-built pipeline. When provided, the battery uses it directly and skips lazy creation. | - | src/batteries/specialists/caption/transformers_js/types.ts:93 |