GithubHelp home page GithubHelp logo

Comments (6)

martindevans avatar martindevans commented on September 22, 2024 1

I'll close this issue since it looks like it's been resolved :)

from llamasharp.

MagicMaxxx avatar MagicMaxxx commented on September 22, 2024

PROBABLY (!!) the reason of that exception is that that every news row started with "Дата:" (which is "Date:" in Russian) and LLM (?) decides that it's a kind of Role... So when I added minus before the Date ("- Дата:") then I can't reproduce the exception... Checking it...

from llamasharp.

MagicMaxxx avatar MagicMaxxx commented on September 22, 2024

I've got this exception again, even if I used "minus" signs before the every news row.

In StatelessExecutor, in the line 81, it comes from LlamaContext:
DecodeResult decodeResult = await Context.DecodeAsync(_batch, cancellationToken);
if (decodeResult != 0)
{
throw new LLamaDecodeError(decodeResult);
}

from llamasharp.

martindevans avatar martindevans commented on September 22, 2024

The NoKvSlot error means that there's not enough memory to hold all of the tokens you're trying to submit to the system.

You'll probably need to reduce the amount of text you are submitting in the initial prompt.

from llamasharp.

MagicMaxxx avatar MagicMaxxx commented on September 22, 2024

ok, got it, thanks for the info!

I increased ModelParams.ContextSize 1024 -> 4096, checking it now (BTW - will it help? I've just started learning LLMs and LLamaSharp)... The prompt I used before had length of 2009 symbols, and if my assumption is right, it caused these exceptions

UPD - this is for llama-2-7b-chat.Q4_K_M, I can see that Mistral-based LLMs can have 8K as the context size, will check it later.

from llamasharp.

martindevans avatar martindevans commented on September 22, 2024

There are 2 "contexts" here, which means different things. There's actually a PR in llama.cpp to change the naming, because it's so confusing!

There is a pre-allocated buffer (called the KV cache) which holds information about each token. That's what's set by the ModelParams.ContextSize parameter. If you had this set to 1024 then that will definitely cause an issue with trying to fit in 2009 tokens.

I can see that Mistral-based LLMs can have 8K as the context size

LLMs are trained for a certain number of positions (i.e. how many tokens they can understand, you can feed in more but this isn't something the system is trained for). That's what the 8k "context size" is here.

from llamasharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.