Method AlignContextWindow
- Namespace
- LMKit.Finetuning
- Assembly
- LM-Kit.NET.dll
AlignContextWindow(int)
The training window an explicit ContextSize resolves to. The runtime pads every context to a 256-token block while the training batch keeps the requested length, and the trainer requires the two to divide evenly: a window below the block would run the block in two batches and lose its step accounting, and one that does not divide it would fail the run outright. The window therefore rounds up to the block, with a floor of one block.
public static int AlignContextWindow(int contextSize)
Parameters
contextSizeintThe requested window, in tokens. Values of 0 or less resolve to one block.
Returns
- int
The window the run uses, a positive multiple of 256.