gguf: Fix special vocab handling when id < 0
This commit is contained in:
parent
6a31a3bd98
commit
c3d3ea9b3a
2 changed files with 3 additions and 3 deletions
|
@ -801,7 +801,7 @@ class SpecialVocab:
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
for maybe_token_id in (atok.get('id') for atok in added_tokens if atok.get('content') == tc_content):
|
for maybe_token_id in (atok.get('id') for atok in added_tokens if atok.get('content') == tc_content):
|
||||||
if isinstance(maybe_token_id, int):
|
if isinstance(maybe_token_id, int) and maybe_token_id >= 0:
|
||||||
self.special_token_ids[typ] = maybe_token_id
|
self.special_token_ids[typ] = maybe_token_id
|
||||||
break
|
break
|
||||||
return True
|
return True
|
||||||
|
@ -814,7 +814,7 @@ class SpecialVocab:
|
||||||
config = json.load(f)
|
config = json.load(f)
|
||||||
for typ in self.special_token_types:
|
for typ in self.special_token_types:
|
||||||
maybe_token_id = config.get(f'{typ}_token_id')
|
maybe_token_id = config.get(f'{typ}_token_id')
|
||||||
if isinstance(maybe_token_id, int):
|
if isinstance(maybe_token_id, int) and maybe_token_id >= 0:
|
||||||
self.special_token_ids[typ] = maybe_token_id
|
self.special_token_ids[typ] = maybe_token_id
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "gguf"
|
name = "gguf"
|
||||||
version = "0.3.1"
|
version = "0.3.2"
|
||||||
description = "Write ML models in GGUF for GGML"
|
description = "Write ML models in GGUF for GGML"
|
||||||
authors = ["GGML <ggml@ggml.ai>"]
|
authors = ["GGML <ggml@ggml.ai>"]
|
||||||
packages = [
|
packages = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue