You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

llama.sampling.isamplingpipeline.md 1.7 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # ISamplingPipeline
  2. Namespace: LLama.Sampling
  3. Convert a span of logits into a single sampled token. This interface can be implemented to completely customise the sampling process.
  4. ```csharp
  5. public interface ISamplingPipeline : System.IDisposable
  6. ```
  7. Implements [IDisposable](https://docs.microsoft.com/en-us/dotnet/api/system.idisposable)
  8. ## Methods
  9. ### **Sample(SafeLLamaContextHandle, Span<Single>, ReadOnlySpan<LLamaToken>)**
  10. Sample a single token from the given logits
  11. ```csharp
  12. LLamaToken Sample(SafeLLamaContextHandle ctx, Span<float> logits, ReadOnlySpan<LLamaToken> lastTokens)
  13. ```
  14. #### Parameters
  15. `ctx` [SafeLLamaContextHandle](./llama.native.safellamacontexthandle.md)<br>
  16. The context being sampled from
  17. `logits` [Span&lt;Single&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.span-1)<br>
  18. The logits produced by the model
  19. `lastTokens` [ReadOnlySpan&lt;LLamaToken&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.readonlyspan-1)<br>
  20. A span of tokens recently returned by the model
  21. #### Returns
  22. [LLamaToken](./llama.native.llamatoken.md)<br>
  23. ### **Accept(SafeLLamaContextHandle, LLamaToken)**
  24. Update the pipeline, with knowledge that a particular token was just accepted
  25. ```csharp
  26. void Accept(SafeLLamaContextHandle ctx, LLamaToken token)
  27. ```
  28. #### Parameters
  29. `ctx` [SafeLLamaContextHandle](./llama.native.safellamacontexthandle.md)<br>
  30. `token` [LLamaToken](./llama.native.llamatoken.md)<br>
  31. ### **Reset()**
  32. Reset all internal state of the sampling pipeline
  33. ```csharp
  34. void Reset()
  35. ```
  36. ### **Clone()**
  37. Create a copy of this sampling pipeline
  38. ```csharp
  39. ISamplingPipeline Clone()
  40. ```
  41. #### Returns
  42. [ISamplingPipeline](./llama.sampling.isamplingpipeline.md)<br>