Skip to content

Commit

Permalink
Fixed LLamaExecutorBase.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
martindevans committed Jan 2, 2024
1 parent c002642 commit 3925545
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions LLama/LLamaExecutorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected StatefulExecutorBase(LLamaContext context, ILogger? logger = null)
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="RuntimeError"></exception>
public unsafe StatefulExecutorBase WithSessionFile(string filename)
public StatefulExecutorBase WithSessionFile(string filename)
{
_pathSession = filename;
if (string.IsNullOrEmpty(filename))
Expand All @@ -105,9 +105,8 @@ public unsafe StatefulExecutorBase WithSessionFile(string filename)
if (File.Exists(filename))
{
_logger?.LogInformation($"[LLamaExecutor] Attempting to load saved session from {filename}");
llama_token[] session_tokens = new llama_token[Context.ContextSize];
ulong n_token_count_out = 0;
if (!NativeApi.llama_load_session_file(Context.NativeHandle, _pathSession, session_tokens, (ulong)Context.ContextSize, &n_token_count_out))
var session_tokens = new llama_token[Context.ContextSize];
if (!NativeApi.llama_load_session_file(Context.NativeHandle, _pathSession, session_tokens, (ulong)Context.ContextSize, out var n_token_count_out))
{
_logger?.LogError($"[LLamaExecutor] Failed to load session file {filename}");
throw new RuntimeError($"Failed to load session file {_pathSession}");
Expand Down

0 comments on commit 3925545

Please sign in to comment.