loadState method

Future<int> loadState(
  1. String path, {
  2. int sequenceId = 0,
})

Restores KV-cache state previously written by saveState into sequenceId, replacing that sequence's current cache.

Resolves to the number of tokens restored. Throws LlamaException when the file is missing, corrupt, or from an incompatible model; the sequence is left with an empty cache in that case, so the next generation prefills from scratch.

Implementation

Future<int> loadState(String path, {int sequenceId = 0}) =>
    _isolate.sessionState(id, path, save: false, sequenceId: sequenceId);