From 8fdfc820331f90cdd04133638b2732cdca212c8d Mon Sep 17 00:00:00 2001 From: Stan Ding Date: Wed, 8 Apr 2026 08:54:48 +0800 Subject: [PATCH] bugfix: LamaWeights.NativeHandle.LoadLoraFromFile need read & write access to lora file --- LLama/Native/SafeLlamaModelHandle.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LLama/Native/SafeLlamaModelHandle.cs b/LLama/Native/SafeLlamaModelHandle.cs index 668074090..ac09490b9 100644 --- a/LLama/Native/SafeLlamaModelHandle.cs +++ b/LLama/Native/SafeLlamaModelHandle.cs @@ -478,7 +478,7 @@ public LoraAdapter LoadLoraFromFile(string path) // - File exists (automatically throws FileNotFoundException) // - File is readable (explicit check) // This provides better error messages that llama.cpp, which would throw an access violation exception in both cases. - using (var fs = new FileStream(path, FileMode.Open)) + using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read)) if (!fs.CanRead) throw new InvalidOperationException($"LoRA file '{path}' is not readable");