121 lines
2.8 KiB
Markdown
121 lines
2.8 KiB
Markdown
# MirostateSamplingPipeline
|
|
|
|
Namespace: LLama.Sampling
|
|
|
|
A sampling pipeline which uses mirostat (v1) to select tokens
|
|
|
|
```csharp
|
|
public class MirostateSamplingPipeline : BaseSamplingPipeline, ISamplingPipeline, System.IDisposable
|
|
```
|
|
|
|
Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [BaseSamplingPipeline](./llama.sampling.basesamplingpipeline.md) → [MirostateSamplingPipeline](./llama.sampling.mirostatesamplingpipeline.md)<br>
|
|
Implements [ISamplingPipeline](./llama.sampling.isamplingpipeline.md), [IDisposable](https://docs.microsoft.com/en-us/dotnet/api/system.idisposable)
|
|
|
|
## Properties
|
|
|
|
### **Mu**
|
|
|
|
Currently learned mu value
|
|
|
|
```csharp
|
|
public float Mu { get; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
[Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
|
|
|
|
### **Tau**
|
|
|
|
target entropy
|
|
|
|
```csharp
|
|
public float Tau { get; set; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
[Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
|
|
|
|
### **Eta**
|
|
|
|
learning rate
|
|
|
|
```csharp
|
|
public float Eta { get; set; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
[Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
|
|
|
|
### **Grammar**
|
|
|
|
Grammar to constrain valid tokens
|
|
|
|
```csharp
|
|
public SafeLLamaGrammarHandle Grammar { get; set; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
[SafeLLamaGrammarHandle](./llama.native.safellamagrammarhandle.md)<br>
|
|
|
|
## Constructors
|
|
|
|
### **MirostateSamplingPipeline()**
|
|
|
|
```csharp
|
|
public MirostateSamplingPipeline()
|
|
```
|
|
|
|
## Methods
|
|
|
|
### **ProcessLogits(SafeLLamaContextHandle, Span<Single>, ReadOnlySpan<LLamaToken>)**
|
|
|
|
```csharp
|
|
protected void ProcessLogits(SafeLLamaContextHandle ctx, Span<float> logits, ReadOnlySpan<LLamaToken> lastTokens)
|
|
```
|
|
|
|
#### Parameters
|
|
|
|
`ctx` [SafeLLamaContextHandle](./llama.native.safellamacontexthandle.md)<br>
|
|
|
|
`logits` [Span<Single>](https://docs.microsoft.com/en-us/dotnet/api/system.span-1)<br>
|
|
|
|
`lastTokens` [ReadOnlySpan<LLamaToken>](https://docs.microsoft.com/en-us/dotnet/api/system.readonlyspan-1)<br>
|
|
|
|
### **ProcessTokenDataArray(SafeLLamaContextHandle, LLamaTokenDataArray, ReadOnlySpan<LLamaToken>)**
|
|
|
|
```csharp
|
|
protected LLamaToken ProcessTokenDataArray(SafeLLamaContextHandle ctx, LLamaTokenDataArray candidates, ReadOnlySpan<LLamaToken> lastTokens)
|
|
```
|
|
|
|
#### Parameters
|
|
|
|
`ctx` [SafeLLamaContextHandle](./llama.native.safellamacontexthandle.md)<br>
|
|
|
|
`candidates` [LLamaTokenDataArray](./llama.native.llamatokendataarray.md)<br>
|
|
|
|
`lastTokens` [ReadOnlySpan<LLamaToken>](https://docs.microsoft.com/en-us/dotnet/api/system.readonlyspan-1)<br>
|
|
|
|
#### Returns
|
|
|
|
[LLamaToken](./llama.native.llamatoken.md)<br>
|
|
|
|
### **Reset()**
|
|
|
|
```csharp
|
|
public void Reset()
|
|
```
|
|
|
|
### **Clone()**
|
|
|
|
```csharp
|
|
public ISamplingPipeline Clone()
|
|
```
|
|
|
|
#### Returns
|
|
|
|
[ISamplingPipeline](./llama.sampling.isamplingpipeline.md)<br>
|