Merge branch 'master' into HEAD

This commit is contained in:
Georgi Gerganov 2023-12-18 10:17:55 +02:00
commit a8d2a6f3ef
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
19 changed files with 1350 additions and 706 deletions

View file

@ -109,8 +109,10 @@ class SpecialVocab:
return True
def _set_special_token(self, typ: str, tid: Any) -> None:
if not isinstance(tid, int) or tid < 0:
if not isinstance(tid, int):
return
if tid < 0:
raise ValueError(f'invalid value for special token type {typ}: {tid}')
if self.n_vocab is None or tid < self.n_vocab:
if typ in self.special_token_ids:
return