Browse Source

fix: add check for model file path.

tags/v0.2.3
Yaohui Liu 2 years ago
parent
commit
d6bd1b7107
No known key found for this signature in database GPG Key ID: E86D01E1809BD23E
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      LLama/Utils.cs

+ 6
- 0
LLama/Utils.cs View File

@@ -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 )


Loading…
Cancel
Save