Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The type or namespace name "LLamaModel" could not be founded Error. #161

Closed
summertube opened this issue Sep 9, 2023 · 3 comments
Closed

Comments

@summertube
Copy link

summertube commented Sep 9, 2023

Hello!
I am using Visual Studio 2022 along with .NET 6, and I've integrated LLamaSharp and Backend.Cpu version 0.5.1 into my console project via NuGet. I've also copied the provided example code.

However, I've encountered a compiler error, and I'm not sure about what's causing this issue. Here is the error message. I don't see any other errors.


Error CS0246 The type or namespace name 'LLamaModel' could not be found (are you missing a using directive or an assembly reference?) LLamaConsole


using LLama.Common;
using LLama;

string modelPath = @"C:\Projects\LLamaSharp\ConsoleApp1\model\wizardLM-7B.ggmlv3.q4_1.bin";
var prompt = "Transcript of a dialog"; // use the "chat-with-bob" prompt here.

// Initialize a chat session
var ex = new InteractiveExecutor(new LLamaModel(new ModelParams(modelPath, contextSize: 1024, seed: 1337, gpuLayerCount: 5)));
ChatSession session = new ChatSession(ex);

// show the prompt
Console.WriteLine();
Console.Write(prompt);

// run the inference in a loop to chat with LLM
while (prompt != "stop")
{
foreach (var text in session.Chat(prompt, new InferenceParams() { Temperature = 0.6f, AntiPrompts = new List { "User:" } }))
{
Console.Write(text);
}
prompt = Console.ReadLine();
}

// save the session
session.SaveSession("SavedSessionPath");

@martindevans
Copy link
Member

It looks like the example is slightly out of date. Where did you copy that from?

Have a look at the example code here (line 13 - 21) for something up to date.

@summertube
Copy link
Author

summertube commented Sep 9, 2023

Thank you for your help! The example is functioning as expected. I found the old example on the LLamaSharp project page. https://github.com/SciSharp/LLamaSharp (Usages)

@martindevans
Copy link
Member

Oops! I'll update the readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants