llama_sample_apply_guidance method

void llama_sample_apply_guidance(
  1. Pointer<llama_context> ctx,
  2. Pointer<Float> logits,
  3. Pointer<Float> logits_guidance,
  4. double scale,
)

@details Apply classifier-free guidance to the logits as described in academic paper "Stay on topic with Classifier-Free Guidance" https://arxiv.org/abs/2306.17806 @param logits Logits extracted from the original generation context. @param logits_guidance Logits extracted from a separate context from the same model. Other than a negative prompt at the beginning, it should have all generated and user input tokens copied from the main context. @param scale Guidance strength. 1.0f means no guidance. Higher values mean stronger guidance.

Implementation

void llama_sample_apply_guidance(
  ffi.Pointer<llama_context> ctx,
  ffi.Pointer<ffi.Float> logits,
  ffi.Pointer<ffi.Float> logits_guidance,
  double scale,
) {
  return _llama_sample_apply_guidance(
    ctx,
    logits,
    logits_guidance,
    scale,
  );
}