Skip to content

Commit 974f160

Browse files
authored
Merge pull request #3 from saddam213/feature/gguf
Fix Tokenize of new line, Remove space inserts
2 parents 95dc12d + a5d742b commit 974f160

File tree

3 files changed

+1
-7
lines changed

3 files changed

+1
-7
lines changed

LLama/LLamaEmbedder.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ public float[] GetEmbeddings(string text)
6565
/// <exception cref="RuntimeError"></exception>
6666
public float[] GetEmbeddings(string text, bool addBos)
6767
{
68-
if (addBos)
69-
{
70-
text = text.Insert(0, " ");
71-
}
7268

7369
var embed_inp_array = _ctx.Tokenize(text, addBos);
7470

LLama/LLamaInstructExecutor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ protected override void PreprocessInputs(string text, InferStateArgs args)
114114
if (_is_prompt_run)
115115
{
116116
// When running the first input (prompt) in inteactive mode, we should specially process it.
117-
text = " " + text;
118117
_embed_inps = Context.Tokenize(text, true).ToList();
119118
}
120119
else

LLama/LLamaInteractExecutor.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class InteractiveExecutor : StatefulExecutorBase
2626
/// <param name="context"></param>
2727
public InteractiveExecutor(LLamaContext context) : base(context)
2828
{
29-
_llama_token_newline = Context.NativeHandle.Tokenize("\n", false, Context.Encoding);
29+
_llama_token_newline = new [] { NativeApi.llama_token_nl(Context.NativeHandle) };
3030
}
3131

3232
/// <inheritdoc />
@@ -104,7 +104,6 @@ protected override void PreprocessInputs(string text, InferStateArgs args)
104104
if (_is_prompt_run)
105105
{
106106
// When running the first input (prompt) in inteactive mode, we should specially process it.
107-
text = " " + text;
108107
_embed_inps = Context.Tokenize(text, true).ToList();
109108
}
110109
else

0 commit comments

Comments
 (0)