sampleFrame method

List<int> sampleFrame(
  1. Float32List hidden,
  2. Random random, {
  3. double? temperature,
  4. int? topK,
  5. double? repetitionPenalty,
  6. int? repetitionWindow,
  7. List<List<int>> history = const [],
})

Three passes reveal four randomly ordered codebooks each. The penalty covers the codes of the last repetitionWindow frames of history. Omitted options use sampling; a null top-k there samples every code. Random seeds are Dart-specific.

Implementation

List<int> sampleFrame(
  Float32List hidden,
  math.Random random, {
  double? temperature,
  int? topK,
  double? repetitionPenalty,
  int? repetitionWindow,
  List<List<int>> history = const [],
}) {
  return _sampleFrame(
    hidden,
    random,
    temperature ?? sampling.temperature,
    topK ?? sampling.topK ?? vocabSize,
    repetitionPenalty ?? sampling.repetitionPenalty,
    repetitionWindow ?? sampling.repetitionWindow,
    history,
  );
}