Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6519e9c

Browse files
authored
gguf(python): Fix special vocab handling when id < 0 (ggml-org#2984)
1 parent b7f2aa9 commit 6519e9c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

gguf-py/gguf/gguf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ def try_load_from_tokenizer_json(self, path: Path) -> bool:
801801
else:
802802
continue
803803
for maybe_token_id in (atok.get('id') for atok in added_tokens if atok.get('content') == tc_content):
804-
if isinstance(maybe_token_id, int):
804+
if isinstance(maybe_token_id, int) and maybe_token_id >= 0:
805805
self.special_token_ids[typ] = maybe_token_id
806806
break
807807
return True
@@ -814,7 +814,7 @@ def try_load_from_config_json(self, path: Path) -> bool:
814814
config = json.load(f)
815815
for typ in self.special_token_types:
816816
maybe_token_id = config.get(f'{typ}_token_id')
817-
if isinstance(maybe_token_id, int):
817+
if isinstance(maybe_token_id, int) and maybe_token_id >= 0:
818818
self.special_token_ids[typ] = maybe_token_id
819819
return True
820820

gguf-py/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "gguf"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
description = "Write ML models in GGUF for GGML"
55
authors = ["GGML <[email protected]>"]
66
packages = [

0 commit comments

Comments
 (0)