]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
Fix convert-llama-ggmlv3-to-gguf.py vocab conversion (#2698)
authorKerfuffle <redacted>
Tue, 22 Aug 2023 00:01:34 +0000 (18:01 -0600)
committerGitHub <redacted>
Tue, 22 Aug 2023 00:01:34 +0000 (18:01 -0600)
When converting without metadata, the hex value for bytes entries weren't 0 padded to 2 digits.

convert-llama-ggmlv3-to-gguf.py

index 30038072f4bd51c8f19ac3cfc8875ce0aaa5a4ae..fa4a044ca383e159783869190dd34da3b9a1bab7 100644 (file)
@@ -236,8 +236,7 @@ class GGMLToGGUF:
             if len(vbytes) == 0:
                 tt = 3 # Control
             elif tokid >= 3 and tokid <= 258 and len(vbytes) == 1:
-                hv = hex(vbytes[0])[2:].upper()
-                vbytes = bytes(f'<0x{hv}>', encoding = 'UTF-8')
+                vbytes = bytes(f'<0x{vbytes[0]:02X}>', encoding = 'UTF-8')
                 tt = 6 # Byte
             else:
                 vbytes = vbytes.replace(b' ', b'\xe2\x96\x81')