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
{{ message }}
Repository navigation
Token generation broken on CUDA when offload_kqv is false #4991
Originally spotted by @iamlemec in abetlen/llama-cpp-python#1089 reproduced with llama.cpp by passing --no_kv_offload to ./main. Bug causes the model to generate repeated #'s instead of a valid completion.
I can reproduce the bug. It seems to have been introduced in #4766 and only occurs from the second eval onwards. So ./perplexity with defaults will not detect this bug but ./perplexity -b 256 will.
Hopefully some useful info: This occurs on every type of model I've tried: llama, mistral, mixtral, even llava, regardless of quantization.
When running a modified simple program with offload_kqv = false, very short prompts work. At some point you hit a length where the logit value becomes different from the offload_kqv = true case. For any prompt length strictly higher than this cutoff the logit value is simply nan. The cutoff value varies from model to model, for llama-7b and llama-13b it's 16 and for mistral it's 4.
Looking at different values for n_gpu_layers with longer prompts and offload_kqv = false, if it's fully offloaded you get nan. Anything less than full offload you get 0.0 for the most part, unless ngl=1 when you get a non-zero but incorrect number.
Activity
JohannesGaessler commentedon Jan 17, 2024
I can reproduce the bug. It seems to have been introduced in #4766 and only occurs from the second eval onwards. So
./perplexitywith defaults will not detect this bug but./perplexity -b 256will.cc: @slaren
Artefact2 commentedon Jan 17, 2024
Duplicate of #4983?
ggerganov commentedon Jan 17, 2024
Yup, will be looking into this - if anyone has additional insights like which models / params work and which do not work would be helpful
thiner commentedon Jan 19, 2024
@ggerganov I tried with below model and params, and it ran into the generation error.
iamlemec commentedon Jan 19, 2024
Hopefully some useful info: This occurs on every type of model I've tried: llama, mistral, mixtral, even llava, regardless of quantization.
When running a modified
simpleprogram withoffload_kqv = false, very short prompts work. At some point you hit a length where the logit value becomes different from theoffload_kqv = truecase. For any prompt length strictly higher than this cutoff the logit value is simplynan. The cutoff value varies from model to model, for llama-7b and llama-13b it's 16 and for mistral it's 4.Looking at different values for
n_gpu_layerswith longer prompts andoffload_kqv = false, if it's fully offloaded you getnan. Anything less than full offload you get0.0for the most part, unlessngl=1when you get a non-zero but incorrect number.slaren commentedon Jan 20, 2024
This should have been fixed in #5049 (already merged), please let me know if you find any other issues.
abetlen commentedon Jan 25, 2024
Forgot to close this, it works, thanks for the fix!