You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just upgraded the NuGet packages from 0.16 to 0.18. CPU backend. The simple test console program still compiled but it no longer runs. Inside ChatSession.ChatAsync I get the exception:
System.NullReferenceException: 'Object reference not set to an instance of an object.'
usingSystem;usingSystem.Collections.Generic;usingSystem.Threading.Tasks;usingLLama;usingLLama.Common;usingLLama.Sampling;namespaceLLamaSharpConsole{internalclassProgram{staticasyncTaskMain(string[]args){stringmodelPath=@"D:\Projects\dotNet\Solutions\LLMPlayground\Models\model.gguf";//string modelPath = @"D:\Projects\dotNet\Solutions\LLMPlayground\Models\model.quantized.gguf";varparameters=newModelParams(modelPath){ContextSize=4096,GpuLayerCount=10};usingvarmodel=LLamaWeights.LoadFromFile(parameters);usingvarcontext=model.CreateContext(parameters);varexecutor=newInteractiveExecutor(context);ChatHistorychatHistory=newChatHistory();ChatSessionsession=new(executor,chatHistory);session.WithOutputTransform(newLLamaTransforms.KeywordTextOutputStreamTransform(newstring[]{"User:","Assistant:","�"},redundancyLength:8));InferenceParamsinferenceParams=newInferenceParams(){AntiPrompts=newList<string>{"User:","Assistant:"},//SamplingPipeline = new Mirostat2SamplingPipeline()//{// Tau = 1f,// Eta = 0.2f//}};Console.ForegroundColor=ConsoleColor.Yellow;Console.WriteLine("The chat session has started.");Console.Write("\r\nReady> ");// show the promptConsole.ForegroundColor=ConsoleColor.Green;stringuserInput=Console.ReadLine()??"";while(userInput!="exit"){Console.ForegroundColor=ConsoleColor.White;awaitforeach(vartextinsession.ChatAsync(newChatHistory.Message(AuthorRole.User,userInput+"\nAssistant: "),inferenceParams)){Console.Write(text);}Console.ForegroundColor=ConsoleColor.Yellow;Console.Write("\r\nReady> ");Console.ForegroundColor=ConsoleColor.Green;userInput=Console.ReadLine()??"";}Console.ForegroundColor=ConsoleColor.White;}}//end of class Program}
Environment & Configuration
Windows 10
.NET 8.0
LLamaSharp version: 0.18
CUDA version (if you are using cuda backend): CPU backend
CPU & GPU device: x64
Known Workarounds
No response
The text was updated successfully, but these errors were encountered:
The null refererence exception is caused by the InferenceParams.SamplingPipeline being null. It's meant to default to the DefaultSamplingPipeline if you don't set it, so that looks like a bug in the LLamaInteractExecutor.
InferenceParams inferenceParams = new InferenceParams()
{
SamplingPipeline = new DefaultSamplingPipeline(), // Use default sampling pipeline. <-- not in sample
MaxTokens = 256, // No more than 256 tokens should appear in answer. Remove it if antiprompt is enough for control.
AntiPrompts = new List<string> { "User:" } // Stop generation once antiprompts appear.
};
Description
I just upgraded the NuGet packages from 0.16 to 0.18. CPU backend. The simple test console program still compiled but it no longer runs. Inside
ChatSession.ChatAsync
I get the exception:Reproduction Steps
Environment & Configuration
Known Workarounds
No response
The text was updated successfully, but these errors were encountered: