Skip to content

Commit 930523c

Browse files
authored
Fix convert-llama-ggmlv3-to-gguf.py vocab conversion (#2698)
When converting without metadata, the hex value for bytes entries weren't 0 padded to 2 digits.
1 parent c8dba40 commit 930523c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

convert-llama-ggmlv3-to-gguf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,7 @@ def add_vocab(self, gguf_writer):
236236
if len(vbytes) == 0:
237237
tt = 3 # Control
238238
elif tokid >= 3 and tokid <= 258 and len(vbytes) == 1:
239-
hv = hex(vbytes[0])[2:].upper()
240-
vbytes = bytes(f'<0x{hv}>', encoding = 'UTF-8')
239+
vbytes = bytes(f'<0x{vbytes[0]:02X}>', encoding = 'UTF-8')
241240
tt = 6 # Byte
242241
else:
243242
vbytes = vbytes.replace(b' ', b'\xe2\x96\x81')

0 commit comments

Comments
 (0)