Skip to content

Commit

Permalink
- Using more specific LoadWeightsFailedException when a llava model…
Browse files Browse the repository at this point in the history
… fails to load (#697)

- Passing model path, instead of a message, to `LoadWeightsFailedException` constructor
  • Loading branch information
martindevans authored Apr 26, 2024
1 parent ccc49eb commit ecb359c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LLama/Native/SafeLlamaModelHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public static SafeLlamaModelHandle LoadFromFile(string modelPath, LLamaModelPara
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
Expand Down
2 changes: 1 addition & 1 deletion LLama/Native/SafeLlavaModelHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static SafeLlavaModelHandle LoadFromFile(string modelPath, int verbosity
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);
}

/// <summary>
Expand Down

0 comments on commit ecb359c

Please sign in to comment.