Skip to content

Commit

Permalink
Fix convert-llama-ggmlv3-to-gguf.py vocab conversion (#2698)
Browse files Browse the repository at this point in the history
When converting without metadata, the hex value for bytes entries weren't 0 padded to 2 digits.
  • Loading branch information
KerfuffleV2 authored Aug 22, 2023
1 parent c8dba40 commit 930523c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions convert-llama-ggmlv3-to-gguf.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ def add_vocab(self, gguf_writer):
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')
Expand Down

0 comments on commit 930523c

Please sign in to comment.