Closed Any-Winter-4079 closed 4 months ago
This commit does work 8a56075b07a8b571bf95a912ffdce4c928c2b414
The image presents a simple yet striking visual. Dominating the frame is a single, vertical line, painted in a vibrant shade of green. The line is slightly curved, adding a sense of dynamism to the composition. It stands out starkly against a solid blue background, creating a strong contrast that draws the viewer's attention. The line is positioned on the right side of the image, leaving the left side untouched and open. The image is devoid of any text or additional elements, making the green line the sole focus of this composition.
This one (next commit) makes it output gibberish f4dea7da1841a92d2788b0535063abf2f0e28461
, whereas,RESS, and thus, }
, }
}RESS, but, }
, }}
RESS, and thus,RESS,RESS, }}
RESS, and thus, }}
RESS, }}
RESS, }}
RESS, }}
}}
RESS, and thus,RESS, }}
RESS, }}
}RESS,RESS, }
}RESS, }
}}
RESS, }RESS,RESS,RESS, }
}RESS,RESS, }
RESS,RESS, }}
}RESS,RESS, }
}RESS,RESS,RESS,RESS,RESS,RESS, }
}}
RESS, }}
RESS, }}
RESS, }}
}}
RESS,RESS, }}
}RESS,RESS,RESS,RESS, }
RESS,RESS,RESS,RESS, }}
}}
RESS,RESS,RESS,RESS,RESS,RESS, }}
RESS,RESS,RESS, }RESS,RESS,RESS,RESS, }
RESS,RESS,RESS, }}
}RESS,RESS, }
}}
}}
}}
RESS,RESS,RESS, }RESS, }
RESS,RESS, }RESS,RESS,RESS, }
}}
}}
}}
RESS,RESS,RESS,RESS,RESS,RESS,RESS,
Alright, so for my use case, I'll stick to commit https://github.com/ggerganov/llama.cpp/commit/8a56075b07a8b571bf95a912ffdce4c928c2b414. If anyone needs more information about my Python version, packages, ... provided they can't reproduce it with arbitrary versions, I'll share them
Hope this helps someone!
Possibly related to the tokenization issues discussed in #7056 #7062 #7049 #7006
I can't reproduce. This works on latest master
with M2 Ultra (both CPU and GPU):
make -j && ./llava-cli -m ./models/llava-7b-v1.6/ggml-model-f16.gguf --mmproj ./models/llava-7b-v1.6/mmproj-model-f16.gguf --image ~/Downloads/cat.png -p "What is the animal doing?" --temp 0.0 -ngl 99
@turian Don't think this is related to tokenization changes, since LLaMA 1 and 2, Mistral and Phi-3 all use what we call SPM tokenizer - i.e. no pre-tokenization is done. The tokenization changes only affect models using BPE tokenizer
@ggerganov Thank you for the explanation, but perhaps I need to open another bug report?
I have a colab notebook using TinyLlama-1.1b-1 (SPM according to llama.cpp output) showing that the llama-cpp-python tokenizer gives different output from the HF tokenizer. I am using TheBloke GGUF's which are quite old.
HF tokens + HF model = perplexity ~6
llama tokens + llama model = perplexity ~15
HF tokens + llama model = perplexity ~6
./perplexity.cpp = perplexity ~15
So I'm still seeing that with an old GGUF SPM model that the llama.cpp tokenization is different and bad.
Huggingface tokens: [1, 259, 13, 353, 4755, 350, 5059, 357, 353, 29871, 13, 29871, 13, 4755, 350, 5059, 357, 338, 385, 4223, 2706, 1919, 11456, 322, 24520, 11339, 869, 940, 750, 263, 17838, 732, 29899, 29992, 380, 23693, 6297, 373, 278, 11456, 3652, 450, 6682, 297, 29871, 29906, 29900, 29900, 29900, 869, 910, 471, 5643, 491, 263, 380, 23693, 6297, 297, 278, 1708, 2439, 787, 3971, 491, 11254, 27265, 575, 1919, 607, 471, 8560, 297, 29871, 29906, 29900, 29900, 29896, 472, 278, 7021, 9245, 15521, 869, 940, 750, 263, 17838, 6297, 297, 278, 11456, 3652, 26817, 2259, 897, 287, 297, 29871, 29906, 29900, 29900, 29906, 869, 512, 29871, 29906, 29900, 29900, 29946, 350, 5059, 357, 2982, 287, 263, 6297, 408, 376, 28050, 376, 297, 278, 12720, 376, 22040, 4518, 525, 29879, 13740, 376, 310, 278, 11456, 3652, 450, 6242, 383, 3568, 2056, 540, 5810, 1127, 19963, 29701, 4485, 3767, 549, 322, 360, 20400, 10968, 29875, 869, 940, 471, 4320, 297, 278, 29871, 29906, 29900, 29900, 29945, 24520, 1391, 1953, 310, 278, 14920, 390, 333, 2330, 1708, 29389, 29891, 7509, 1919, 607, 471, 8560, 472, 278, 4942, 398, 15521, 297, 349, 368, 21026, 322, 278, 7567, 631, 678, 542, 23167, 27561, 297, 4517, 869, 940, 471, 10624, 491, 2259, 323, 2593, 1384, 322, 5810, 1127, 19963, 4111, 806, 728, 1450, 1919, 1383, 1662, 796, 19924, 1919, 10686, 13272, 1919, 383, 3417, 261, 15846, 690, 1919, 19122, 347, 624, 11960, 322, 13298, 293, 6573, 869, 29871, 13, 512, 29871, 29906, 29900, 29900, 29953, 1919, 350, 5059, 357, 5810, 1127, 19963, 806, 728, 1450, 297, 278, 1708, 21353, 466, 575, 4034, 3971, 491, 4485, 390, 3496, 29131, 869, 940, 7470, 373, 263, 29871, 29906, 29900, 29900, 29953, 12720, 310, 278, 11456, 3652, 1919, 1938, 14359, 1919, 5643, 491, 263, 6297, 297, 278, 29871, 29906, 29900, 29900, 29955, 24520, 5802, 310, 1128, 304, 10837, 344, 10624, 491, 5875, 347, 390, 473, 446, 869, 1128, 304, 10837, 344, 471, 8560, 472, 24715, 15521, 297, 278, 4517, 6780, 820, 310, 26356, 414, 29885, 389, 322, 23004, 3391, 869, 350, 5059, 357, 5810, 1127, 297, 1023, 12298, 297, 29871, 29906, 29900, 29900, 29947, 1919, 8373, 4366, 6417, 495, 29891, 491, 2706, 28107, 3681, 951, 609, 29875, 1919, 322, 3872, 1989, 349, 3322, 10624, 491, 7137, 368, 6054, 18712, 869, 512, 2610, 29871, 29906, 29900, 29900, 29947, 1919, 350, 5059, 357, 1754, 263, 17838, 10097, 373, 263, 1023, 732, 29899, 29992, 760, 12720, 15232, 310, 278, 11456, 3652, 399, 5086, 278, 16992, 1919, 5643, 491, 385, 10097, 373, 278, 11456, 3652, 6298, 24759, 943, 297, 3979, 29871, 29906, 29900, 29900, 29947, 869, 940, 750, 263, 1162, 1038, 292, 6297, 297, 3006, 23238, 310, 278, 11456, 3652, 6960, 950, 1017, 297, 29871, 29906, 29900, 29896, 29900, 1919, 408, 376, 476, 10243, 383, 1026, 4630, 376, 869, 350, 5059, 357, 5810, 1127, 297, 278, 29871, 29906, 29900, 29896, 29896, 2706, 4702, 10278, 4314, 10624, 491, 3681, 951, 609, 29875, 869, 29871, 13, 29871, 13, 353, 353, 15825, 353, 353, 29871, 13, 29871, 13, 29871, 13, 353, 353, 353, 29871, 29906, 29900, 29900, 29900, 785]
Llama GGUF tokens: [1, 259, 13, 353, 4755, 12476, 1896, 261, 353, 29871, 13, 29871, 13, 4755, 12476, 1896, 261, 338, 385, 4223, 2706, 1919, 11456, 322, 24520, 11339, 869, 940, 750, 263, 17838, 732, 29899, 29992, 5810, 5393, 6297, 373, 278, 11456, 3652, 450, 6682, 297, 29871, 29906, 29900, 29900, 29900, 869, 910, 471, 5643, 491, 263, 5810, 5393, 6297, 297, 278, 1708, 22167, 1983, 3971, 491, 11254, 14317, 29879, 1919, 607, 471, 8560, 297, 29871, 29906, 29900, 29900, 29896, 472, 278, 7021, 9245, 15521, 869, 940, 750, 263, 17838, 6297, 297, 278, 11456, 3652, 26817, 2259, 897, 287, 297, 29871, 29906, 29900, 29900, 29906, 869, 512, 29871, 29906, 29900, 29900, 29946, 12476, 1896, 261, 2982, 287, 263, 6297, 408, 376, 28050, 376, 297, 278, 12720, 376, 22040, 4518, 525, 29879, 13740, 376, 310, 278, 11456, 3652, 450, 6242, 14152, 29885, 2056, 540, 5810, 1127, 19963, 29701, 4485, 3767, 549, 322, 2452, 1416, 10968, 29875, 869, 940, 471, 4320, 297, 278, 29871, 29906, 29900, 29900, 29945, 24520, 5802, 29879, 310, 278, 14920, 21710, 11671, 1032, 1708, 29389, 29891, 7509, 1919, 607, 471, 8560, 472, 278, 16597, 29885, 15521, 297, 1858, 962, 2438, 322, 278, 7567, 631, 14542, 15519, 371, 27561, 297, 4517, 869, 940, 471, 10624, 491, 2259, 18439, 600, 1384, 322, 5810, 1127, 19963, 4111, 806, 728, 1450, 1919, 1383, 1662, 16753, 1362, 1919, 10686, 13272, 1919, 7347, 643, 15846, 690, 1919, 19122, 347, 7813, 880, 322, 13298, 293, 6573, 869, 29871, 13, 512, 29871, 29906, 29900, 29900, 29953, 1919, 12476, 1896, 261, 5810, 1127, 19963, 806, 728, 1450, 297, 278, 1708, 21353, 19642, 3527, 3971, 491, 4485, 28093, 264, 29131, 869, 940, 7470, 373, 263, 29871, 29906, 29900, 29900, 29953, 12720, 310, 278, 11456, 3652, 1919, 15460, 29879, 1919, 5643, 491, 263, 6297, 297, 278, 29871, 29906, 29900, 29900, 29955, 24520, 5802, 310, 1128, 304, 10837, 344, 10624, 491, 5875, 347, 15915, 29878, 446, 869, 1128, 304, 10837, 344, 471, 8560, 472, 24715, 15521, 297, 278, 4517, 6780, 820, 310, 26356, 414, 2415, 29882, 322, 23004, 3391, 869, 12476, 1896, 261, 5810, 1127, 297, 1023, 12298, 297, 29871, 29906, 29900, 29900, 29947, 1919, 8373, 4366, 6417, 495, 29891, 491, 2706, 28107, 3681, 10255, 2034, 1919, 322, 3872, 1989, 12129, 17608, 29882, 10624, 491, 7137, 368, 6054, 18712, 869, 512, 2610, 29871, 29906, 29900, 29900, 29947, 1919, 12476, 1896, 261, 1754, 263, 17838, 10097, 373, 263, 1023, 732, 29899, 29992, 760, 12720, 15232, 310, 278, 11456, 3652, 22552, 9292, 278, 16992, 1919, 5643, 491, 385, 10097, 373, 278, 11456, 3652, 6298, 24759, 943, 297, 3979, 29871, 29906, 29900, 29900, 29947, 869, 940, 750, 263, 1162, 1038, 292, 6297, 297, 3006, 23238, 310, 278, 11456, 3652, 6960, 950, 1017, 297, 29871, 29906, 29900, 29896, 29900, 1919, 408, 376, 16540, 1489, 29876, 13859, 14246, 2276, 376, 869, 12476, 1896, 261, 5810, 1127, 297, 278, 29871, 29906, 29900, 29896, 29896, 2706, 4702, 10278, 4314, 10624, 491, 3681, 10255, 2034, 869, 29871, 13, 29871, 13, 353, 353, 15825, 353, 353, 29871, 13, 29871, 13, 29871, 13, 353, 353, 353, 29871, 29906, 29900, 29900, 29900, 785, 29871, 29906]
Is this expected and why? I can share a minimal code example here or in a new issue.
I can't reproduce. This works on latest
master
with M2 Ultra (both CPU and GPU):make -j && ./llava-cli -m ./models/llava-7b-v1.6/ggml-model-f16.gguf --mmproj ./models/llava-7b-v1.6/mmproj-model-f16.gguf --image ~/Downloads/cat.png -p "What is the animal doing?" --temp 0.0 -ngl 99
@turian Don't think this is related to tokenization changes, since LLaMA 1 and 2, Mistral and Phi-3 all use what we call SPM tokenizer - i.e. no pre-tokenization is done. The tokenization changes only affect models using BPE tokenizer
The issue happened on the latest (https://github.com/ggerganov/llama.cpp/commit/928e0b7013c862cf10701957b3d654aa70f11bd8) commit that day. Can you try that one if you want?
, g m is d is,,' has r h and to, the a is the to un, and is c,' has do is with is l in is, in a is and has re, is at.. is, is he the b to > t to with. the on' d is at s is. with un and with at t t d un d s- l is st a., is for is to t to d. a with b has for is m d is t as the > is in in on to to as the a is to p s set new g is has is in he is d to the, pro to is is new t t for st for is., is, for. t. set b in l > st as s, the, has at t for # se and the in a is r, the t d is a,, l a has,. c re un and/ a r on in a., the a with for a, in,. for', a with,. for m a and/ d at n at > on is for is g do in on re,. re c r a un is-- is- new-- is, is s.. p
On today's latest commit, it works.
The image shows a pink X symbol. It's a simple, two-dimensional graphic with a solid color and a clear, bold outline. The X is centered in the image, with no additional context or objects present. The image is minimalistic, focusing solely on the X symbol. There's no text or other elements visible in the image.
And a previous commit (https://github.com/ggerganov/llama.cpp/commit/8a56075b07a8b571bf95a912ffdce4c928c2b414) had it working as well.
I guess the issue is solved now, although if the source was found it may be useful, to prevent reintroduction in the future. I'm pretty sure it was commit https://github.com/ggerganov/llama.cpp/commit/f4dea7da1841a92d2788b0535063abf2f0e28461 that introduced it.
Update: Actually, nevermind and apologies, it does work (even) on the referenced (https://github.com/ggerganov/llama.cpp/commit/928e0b7013c862cf10701957b3d654aa70f11bd8, https://github.com/ggerganov/llama.cpp/commit/f4dea7da1841a92d2788b0535063abf2f0e28461) commit(s). For some reason (arghhhh), I or some AI tool must have inadvertently removed make -j && from my code base, which messed up the execution after git pull
'ing. Apologies 🫣 and closing the issue 😓 -and thank you for your work!
@turian You can open another issue, but I just verified that TinyLlama tokenization is correct using latest master
.
Here are the steps:
diff --git a/convert-hf-to-gguf-update.py b/convert-hf-to-gguf-update.py
index a26f45a5..4fbec9f1 100755
--- a/convert-hf-to-gguf-update.py
+++ b/convert-hf-to-gguf-update.py
@@ -70,6 +70,7 @@ models = [
{"name": "qwen2", "tokt": TOKENIZER_TYPE.BPE, "repo": "https://huggingface.co/Qwen/Qwen1.5-7B", },
{"name": "olmo", "tokt": TOKENIZER_TYPE.BPE, "repo": "https://huggingface.co/allenai/OLMo-1.7-7B-hf", },
{"name": "dbrx", "tokt": TOKENIZER_TYPE.BPE, "repo": "https://huggingface.co/databricks/dbrx-base", },
+ {"name": "tinyllama", "tokt": TOKENIZER_TYPE.SPM, "repo": "https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0", },
]
# make directory "models/tokenizers" if it doesn't exist
python3 convert-hf-to-gguf-update.py <hf_token>
python3 convert-hf-to-gguf.py models/tokenizers/tinyllama/ --outfile models/ggml-vocab-tinyllama.gguf --vocab-only
make -j tests && ./tests/test-tokenizer-0 ./models/ggml-vocab-tinyllama.gguf
@ggerganov My issue is that an OLD previously converted TinyLlama GGUF a) has buggy tokenization b) doesn't provide any warning.
Is there any workaround for getting old GGUF files to work, rather than creating new GGUF files from HF?
Maybe a version bump every time models break? Could do major.minor.revision and update the minor most of time? Update the major for breaking?
I am using an M1, on commit 928e0b70.
When I run
./llava-cli -m ./models/llava-v1.6-mistral-7b/ggml-mistral-7b-q_5_k.gguf --mmproj ./models/llava-v1.6-mistral-7b/mmproj-mistral7b-f16-q6_k.gguf -p 'Describe the image.' --image ./models/llava-v1.6-mistral-7b/S.jpg -c 4096
I get:
I also tried with xtuner/llava-phi-3-mini with similar results.
./llava-cli -m ./models/llava-phi-3-mini/ggml-model-f16.gguf --mmproj ./models/llava-phi-3-mini/mmproj-model-f16.gguf -p 'Describe the image.' --image ./models/llava-v1.6-mistral-7b/S.jpg -c 4096
Have there been any breaking changes to the llava-cli command? Can someone reproduce this issue as well?