Silence tokenizer length warning
This commit is contained in:
parent
96bd0efb6c
commit
03c31641b7
2 changed files with 18 additions and 2 deletions
|
|
@ -73,8 +73,16 @@ def get_embed_tokenizer():
|
|||
global _EMBED_TOKENIZER
|
||||
if _EMBED_TOKENIZER is None:
|
||||
from transformers import AutoTokenizer
|
||||
# model_max_length is raised because this tokenizer is used ONLY to
|
||||
# count tokens for chunking -- the model never sees these sequences.
|
||||
# Left at its default (512) it warns on every document longer than
|
||||
# that ("Token indices sequence length is longer than..."), which is
|
||||
# noise here, not a problem. Counts are unaffected either way.
|
||||
_EMBED_TOKENIZER = AutoTokenizer.from_pretrained(
|
||||
EMBED_MODEL_NAME, cache_dir="./models", local_files_only=True
|
||||
EMBED_MODEL_NAME,
|
||||
cache_dir="./models",
|
||||
local_files_only=True,
|
||||
model_max_length=int(1e9),
|
||||
)
|
||||
return _EMBED_TOKENIZER
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue