From 39255451479eea8fe20023b36533a527e22cdb2f Mon Sep 17 00:00:00 2001 From: Martin Evans Date: Tue, 2 Jan 2024 03:41:16 +0000 Subject: [PATCH] Fixed LLamaExecutorBase.cs --- LLama/LLamaExecutorBase.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/LLama/LLamaExecutorBase.cs b/LLama/LLamaExecutorBase.cs index cb1b850b..e7b768be 100644 --- a/LLama/LLamaExecutorBase.cs +++ b/LLama/LLamaExecutorBase.cs @@ -95,7 +95,7 @@ namespace LLama /// /// /// - public unsafe StatefulExecutorBase WithSessionFile(string filename) + public StatefulExecutorBase WithSessionFile(string filename) { _pathSession = filename; if (string.IsNullOrEmpty(filename)) @@ -105,9 +105,8 @@ namespace LLama 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}");