diff --git a/LLama/Utils.cs b/LLama/Utils.cs index 2c83b0c6..25b8a4dc 100644 --- a/LLama/Utils.cs +++ b/LLama/Utils.cs @@ -6,6 +6,7 @@ using LLama.Exceptions; using System.Diagnostics; using System.Linq; using System.Runtime.InteropServices; +using System.IO; namespace LLama { @@ -26,6 +27,11 @@ namespace LLama lparams.logits_all = @params.perplexity; lparams.embedding = @params.embedding; + if (!File.Exists(@params.model)) + { + throw new FileNotFoundException($"The model file does not exist: {@params.model}"); + } + var ctx_ptr = NativeApi.llama_init_from_file(@params.model, lparams); if(ctx_ptr == IntPtr.Zero )