Comments (9)
Could you try running this:
var model = LLamaWeights.LoadFromFile("your_model_path");
Console.WriteLine(model.NewlineToken);
The code that's crashing is this:
var nl_token = model.NewlineToken;
var nl_logit = logits[(int)nl_token];
So it seems like your model is probably returning something unexpected for the newline token.
from llamasharp.
I see, it's returning -1, that explains the IndexOutOfRange. Is this an issue with the model itself?
from llamasharp.
I'm not certain, but it doesn't seem correct for any model to be returning -1
for the newline token. That would mean the model has no concept of newlines, which is pretty bizarre!
If other quantizations of the same model are returning other values and it's just the f32 one that's returning -1
I would say that's certainly an error in f32.
from llamasharp.
I'm not sure on this yet but, not having a newline token seems to be a commonality for embedding models. For nomic I tested F32, F16 and Q2_K, I then also tried this model and they all return -1
for their newline token.
from llamasharp.
If multiple models are showing the same thing I guess that must be normal. Very weird!
In that case I think the NewlineToken
method should be updated to return LLamaToken?
instead of LLamaToken
and all callsites fixed to handle that sometimes being null.
from llamasharp.
It could be this is intended behavoir. The models I've been testing are models for generating embeddings so it makes sense that they don't have a newline token as they are never expected to generate text.
Doing this
var memory = new KernelMemoryBuilder()
.WithLLamaSharpTextGeneration(llamaGenerationConfig)
.WithLLamaSharpTextEmbeddingGeneration(llamaEmbeddingConfig)
Resolves the issue, using the embedding model to generate the embeddings and a regular model to generate the output.
WithLLamaSharpDefaults
assumes a regular model which is capable of both.
from llamasharp.
In the #662 PR I've modified how tokens are returned from the LLamaSharp API so it returns nullable tokens and fixed all of the call sites to handle this. I think your approach there is the right one though.
from llamasharp.
c325ac9#commitcomment-141108660
from llamasharp.
The same issue happens when using the SemanticKernel integration using the ITextGenerationService, with an embedding model (nomic).
from llamasharp.
Related Issues (20)
- [BUG]: Vulkan backend crash on model loading HOT 3
- [BUG]: Different continuation after restoring state HOT 1
- Improve `LLamaEmbedder` HOT 2
- [BUG]: KernelMemory.AskAsync() does not work - exception: object reference not set to an instance of an object HOT 25
- [BUG]: fatal error using gemma-2-2b-it HOT 3
- [BUG]: "The type or namespace 'Common' does not exist in the namespace 'LLama'" HOT 4
- Application Not Using GPU Despite Installing LlamaSharp.Backend.Cuda12 HOT 1
- [Feature]: Add development support for Dev Containers HOT 6
- How do i use RAG by kernel memory and Semantic kernel Handlebar Planner with llama3 HOT 3
- versioning issue HOT 11
- [BUG]: gemma-2-9b-it-GGUF - error loading model HOT 3
- [BUG]: Error when starting LLama Cuda11/12 HOT 6
- [BUG]: Second Response Empty when using Grammar HOT 3
- LLamaSharp v0.15.0 broke cuda backend HOT 15
- [BUG]: KernelMemory - Simultaneous execution of AskDocument & ImportDocument HOT 18
- [BUG]: Error setting variables HOT 1
- [BUG:] When switching to new versions of LLamaSharp 0.16.0, there was a slowdown HOT 30
- A few moments in the process of work LLamaSharp & KernelMemory
- Question about promt templates
- [BUG]: DefaultSamplingPipeline - strange behavior at high temperature HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from llamasharp.