SciSharp / LLamaSharp

A C#/.NET library to run LLM (🦙LLaMA/LLaVA) on your local device efficiently.
https://scisharp.github.io/LLamaSharp
MIT License
2.65k stars 345 forks source link

[BUG]: Fail to Load Model with Chinese Model Path #744

Open tinkle-bell opened 5 months ago

tinkle-bell commented 5 months ago

Description

当模型路径里面有中文的时候,读取会失败,我尝试了v0.11和v0.12,只有v0.12有这个bug,把模型里面的中文改掉就可以读取了。

When there are Chinese characters in the model path, reading fails. I tried LLamaSharp v0.11 and v0.12, but this bug only happened with v0.12. Changing the Chinese characters in the model to English allows it to be read.

Reproduction Steps

class Program {

static void  Main(string[] args)
{
    string modelPath = @"E:\AI\模型.gguf"; 

    var parameters = new ModelParams(modelPath)
    {
        ContextSize =2048,
        GpuLayerCount = 20 // How many layers to offload to GPU. Please adjust it according to your GPU memory.
    };
   var model = LLamaWeights.LoadFromFile(parameters);
}

}

Environment & Configuration

Known Workarounds

No response

martindevans commented 5 months ago

What error do you get when this code runs?

tinkle-bell commented 5 months ago

image This is the output of my code. When I change the filename from "模型.gguf” to "model.gguf", it works. I guess there is a problem in llamasharp.backend.cuda12_v0.12.0.

martindevans commented 5 months ago

Unfortunately that looks like it is a llama.cpp error, not a LLamaSharp error. Could you try loading that model with the llama.cpp main.exe and see if you get the same error there.