samplerFor function

Sampler samplerFor(
  1. SamplerConfig? config,
  2. BundleSampler bundle
)

The sampler native gets for config, or for the model file's bundle sampler completed with 0.8 / 40 / 0.95 / seed 1 when config is null.

Implementation

Sampler samplerFor(SamplerConfig? config, BundleSampler bundle) =>
    config != null
    ? Sampler(
        temperature: config.temperature,
        topK: config.topK,
        topP: config.topP,
        randomSeed: config.seed,
      )
    : Sampler(
        temperature: bundle.temperature ?? 0.8,
        topK: bundle.topK ?? 40,
        topP: bundle.topP ?? 0.95,
        randomSeed: bundle.randomSeed ?? 1,
      );