You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: LLama/Batched/Conversation.cs
+13-2Lines changed: 13 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -135,9 +135,20 @@ public Conversation Fork()
135
135
136
136
#region sample
137
137
/// <summary>
138
-
/// Get the logits from this conversation, ready for sampling
138
+
/// Get the index in the context which each token can be sampled from, the return value of this function get be used to retrieve logits
139
+
/// (<see cref="SafeLLamaContextHandle.GetLogitsIth"/>) or to sample a token (<see cref="SafeLLamaSamplerChainHandle.Sample"/>.
139
140
/// </summary>
140
-
/// <param name="offset">How far from the <b>end</b> of the previous prompt should logits be sampled. Any value other than 0 requires allLogits to have been set during prompting</param>
141
+
/// <param name="offset">How far from the <b>end</b> of the previous prompt should logits be sampled. Any value other than 0 requires
142
+
/// allLogits to have been set during prompting.<br />
143
+
/// For example if 5 tokens were supplied in the last prompt call:
144
+
/// <list type="bullet">
145
+
/// <item>The logits of the first token can be accessed with 4</item>
146
+
/// <item>The logits of the second token can be accessed with 3</item>
147
+
/// <item>The logits of the third token can be accessed with 2</item>
148
+
/// <item>The logits of the fourth token can be accessed with 1</item>
149
+
/// <item>The logits of the fifth token can be accessed with 0</item>
Copy file name to clipboardExpand all lines: LLama/Batched/ConversationExtensions.cs
+14-1Lines changed: 14 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
-
usingSystem;
1
+
usingSystem;
2
+
usingLLama.Native;
2
3
3
4
namespaceLLama.Batched;
4
5
@@ -7,6 +8,18 @@ namespace LLama.Batched;
7
8
/// </summary>
8
9
publicstaticclassConversationExtensions
9
10
{
11
+
/// <summary>
12
+
/// Sample a token from this conversation using the given sampler chain
13
+
/// </summary>
14
+
/// <param name="conversation"><see cref="Conversation"/> to sample from</param>
15
+
/// <param name="sampler"></param>
16
+
/// <param name="offset">Offset from the end of the conversation to the logits to sample, see <see cref="Conversation.GetSampleIndex"/> for more details</param>
0 commit comments