timesfm-ts - v1.0.0
    Preparing search index...
    • Suggest a perCoreBatchSize based on available system memory.

      TimesFM 2.5 200M loads ~1.5 GB into RAM (model weights + activations). Each additional batch element adds ~200 MB for intermediate tensors. This function computes a safe batch size that fits within a configurable fraction of free memory (default: 50 %).

      The result is clamped to [1, 16] — the model processes elements concurrently via Promise.all, so diminishing returns apply beyond 8.

      import { suggestBatchSize, createForecastConfig } from '@agentix-e/timesfm-core';

      const bs = suggestBatchSize();
      // or with explicit options:
      const bs = suggestBatchSize({ freeMemoryGB: 8, memoryFraction: 0.5 });
      const fc = createForecastConfig({ perCoreBatchSize: bs });

      Parameters

      • OptionalfreeMemoryGBOrOptions: number | SuggestBatchSizeOptions

        Available RAM in GB, or an options object.

      • memoryFractionArg: number = 0.5

        Fraction of free RAM to use (0–1, default 0.5). Only used when the first argument is a number.

      Returns number

      Suggested batch size (1–16).