From ecb359c9e7f78f1b181ebd8ca8031ef6d165dfc7 Mon Sep 17 00:00:00 2001 From: Martin Evans Date: Fri, 26 Apr 2024 13:39:09 +0100 Subject: [PATCH] - Using more specific `LoadWeightsFailedException` when a llava model fails to load (#697) - Passing model path, instead of a message, to `LoadWeightsFailedException` constructor --- LLama/Native/SafeLlamaModelHandle.cs | 2 +- LLama/Native/SafeLlavaModelHandle.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LLama/Native/SafeLlamaModelHandle.cs b/LLama/Native/SafeLlamaModelHandle.cs index 31b73dfd..23c1f767 100644 --- a/LLama/Native/SafeLlamaModelHandle.cs +++ b/LLama/Native/SafeLlamaModelHandle.cs @@ -121,7 +121,7 @@ namespace LLama.Native throw new InvalidOperationException($"Model file '{modelPath}' is not readable"); return llama_load_model_from_file(modelPath, lparams) - ?? throw new LoadWeightsFailedException($"Failed to load model {modelPath}."); + ?? throw new LoadWeightsFailedException(modelPath); } #region native API diff --git a/LLama/Native/SafeLlavaModelHandle.cs b/LLama/Native/SafeLlavaModelHandle.cs index bd49a578..f73af27c 100644 --- a/LLama/Native/SafeLlavaModelHandle.cs +++ b/LLama/Native/SafeLlavaModelHandle.cs @@ -53,7 +53,7 @@ namespace LLama.Native throw new InvalidOperationException($"Llava MMP Model file '{modelPath}' is not readable"); return clip_model_load(modelPath, verbosity) - ?? throw new RuntimeError($"Failed to load LLaVa model {modelPath}."); + ?? throw new LoadWeightsFailedException(modelPath); } ///