gpt4all icon indicating copy to clipboard operation
gpt4all copied to clipboard

C# Bindings fail to load models - Unit tests fail

Open BrainSlugs83 opened this issue 9 months ago • 3 comments

System Info

  • Windows 11 (10.0.22635)
  • Visual Studio Enterprise 2022 (17.7.5)
  • Vulkan SDK 1.3.261.1
  • MSVC 19.37.32825 for x64

Information

  • [X] The official example notebooks/scripts
  • [ ] My own modified scripts

Reproduction

  1. Build the C# bindings with MSVC, and try to run the unit tests.
  2. Notice that at first they fail due to missing files.
  3. Grab all of the models from https://raw.githubusercontent.com/nomic-ai/gpt4all/main/gpt4all-chat/metadata/models.json
  4. Notice that one of the models is still missing... 🤷‍♂️
  5. Notice that the other two Unit Tests fail due to the unmanaged code trying to access protected memory. 😭

image

Expected behavior

  1. The models should all be present (or the documentation should link to them).
  2. The unit tests should pass (without trying to corrupt protected memory!)

BrainSlugs83 avatar Oct 19 '23 05:10 BrainSlugs83

My progress on this: https://github.com/nomic-ai/gpt4all/tree/csharp-gguf Does it work for anyone besides me?

cebtenzzre avatar Nov 13 '23 21:11 cebtenzzre

My progress on this: https://github.com/nomic-ai/gpt4all/tree/csharp-gguf Does it work for anyone besides me?

It works for me as well.

Initially, I encountered the same protected memory error when building on the main branch. After switching to your csharp-gguf branch, I still faced some issues with the NativeMethods.llmodel_model_create2 method.

However, once I re-ran build_win-msvc.ps1 on your branch, the sample project started functioning correctly.

Thank you for your efforts! 😁

Vegolas avatar Nov 14 '23 12:11 Vegolas

I can fully confirm, what @Vegolas said, I managed to create a local model runtime fully integrated into my software using the changes in the https://github.com/nomic-ai/gpt4all/tree/csharp-gguf branch.

SeriousOldMan avatar Nov 14 '23 17:11 SeriousOldMan

Similar error is still exist in March 27th, 2024 version, fresh clone and C++ build.

image

yoyokits avatar Mar 27 '24 16:03 yoyokits

Similar error is still exist in March 27th, 2024 version, fresh clone and C++ build.

Not the same issue. This means you are missing the required native libraries.

cebtenzzre avatar Apr 10 '24 15:04 cebtenzzre