Skip to main content

Signature

Description

Preload models before processing images. This method serves two purposes:
  1. Download models: Ensures all required model files are downloaded and available locally before processing begins
  2. Daemon mode: For upscayl models, spawns daemon processes that keep models loaded in memory, significantly improving processing speed for multiple images
Daemons are only used with compatible models (upscayl-based models) when OpenComicAI.setConcurrentDaemons() is set to a value greater than 0.

Parameters

OpenComicAIOptions[]
required
Array of processing steps to preload. Each step specifies a model and its parameters.See OpenComicAIOptions for available options.
Downloading | false
Optional callbacks for monitoring model download progress. Pass false to disable download callbacks.See Downloading for callback options.

Returns

void
Returns a promise that resolves when all models are downloaded and daemons are started (if enabled).

Daemon mode

When daemon mode is enabled (upscayl models only):
  • Models are loaded into memory once and kept running
  • Subsequent image processing is 3-7x faster
  • Multiple daemons can run concurrently for parallel processing
  • Daemons automatically shut down after the configured idle timeout
See the README performance comparison for benchmarks.

Examples

Basic preload

Preload with daemon mode

Preload with download tracking

Preload multiple models