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.greedysamplingpipeline.md 2.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # GreedySamplingPipeline
  2. Namespace: LLama.Sampling
  3. A sampling pipeline which always selects the most likely token
  4. ```csharp
  5. public class GreedySamplingPipeline : BaseSamplingPipeline, ISamplingPipeline, System.IDisposable
  6. ```
  7. Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [BaseSamplingPipeline](./llama.sampling.basesamplingpipeline.md) → [GreedySamplingPipeline](./llama.sampling.greedysamplingpipeline.md)<br>
  8. Implements [ISamplingPipeline](./llama.sampling.isamplingpipeline.md), [IDisposable](https://docs.microsoft.com/en-us/dotnet/api/system.idisposable)
  9. ## Properties
  10. ### **Grammar**
  11. Grammar to constrain valid tokens
  12. ```csharp
  13. public SafeLLamaGrammarHandle Grammar { get; set; }
  14. ```
  15. #### Property Value
  16. [SafeLLamaGrammarHandle](./llama.native.safellamagrammarhandle.md)<br>
  17. ## Constructors
  18. ### **GreedySamplingPipeline()**
  19. ```csharp
  20. public GreedySamplingPipeline()
  21. ```
  22. ## Methods
  23. ### **ProcessLogits(SafeLLamaContextHandle, Span&lt;Single&gt;, ReadOnlySpan&lt;LLamaToken&gt;)**
  24. ```csharp
  25. protected void ProcessLogits(SafeLLamaContextHandle ctx, Span<float> logits, ReadOnlySpan<LLamaToken> lastTokens)
  26. ```
  27. #### Parameters
  28. `ctx` [SafeLLamaContextHandle](./llama.native.safellamacontexthandle.md)<br>
  29. `logits` [Span&lt;Single&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.span-1)<br>
  30. `lastTokens` [ReadOnlySpan&lt;LLamaToken&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.readonlyspan-1)<br>
  31. ### **ProcessTokenDataArray(SafeLLamaContextHandle, LLamaTokenDataArray, ReadOnlySpan&lt;LLamaToken&gt;)**
  32. ```csharp
  33. protected LLamaToken ProcessTokenDataArray(SafeLLamaContextHandle ctx, LLamaTokenDataArray candidates, ReadOnlySpan<LLamaToken> lastTokens)
  34. ```
  35. #### Parameters
  36. `ctx` [SafeLLamaContextHandle](./llama.native.safellamacontexthandle.md)<br>
  37. `candidates` [LLamaTokenDataArray](./llama.native.llamatokendataarray.md)<br>
  38. `lastTokens` [ReadOnlySpan&lt;LLamaToken&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.readonlyspan-1)<br>
  39. #### Returns
  40. [LLamaToken](./llama.native.llamatoken.md)<br>
  41. ### **Clone()**
  42. ```csharp
  43. public ISamplingPipeline Clone()
  44. ```
  45. #### Returns
  46. [ISamplingPipeline](./llama.sampling.isamplingpipeline.md)<br>