Allow tokenization of sequences > 512 for caching

For many applications requiring randomized data access, it's easier to cache the tokenized representations than the words. So why not turn this into a warning?
This commit is contained in:
Catalin Voss
2019-03-02 16:30:21 -08:00
committed by GitHub
parent 2152bfeae8
commit 9775b2eb27

View File

@@ -232,7 +232,7 @@ class OpenAIGPTTokenizer(object):
else:
ids.append(self.encoder.get(token, 0))
if len(ids) > self.max_len:
raise ValueError(
logger.warning(
"Token indices sequence length is longer than the specified maximum "
" sequence length for this OpenAI GPT model ({} > {}). Running this"
" sequence through the model will result in indexing errors".format(len(ids), self.max_len)