zylon-ai/private-gpt · error · NotImplementedError
RemoteTokenizeTokenizer only supports text tokenization
Error message
RemoteTokenizeTokenizer only supports text tokenization
What it means
Raised by RemoteTokenizeTokenizer.tokenize (the sync path) when the call includes images or audios. The remote tokenizer protocol only handles text — the implementation explicitly deletes add_special_tokens/truncation/max_length kwargs and rejects any non-text payload with NotImplementedError. Any multimodal content must be tokenized elsewhere (e.g. by the embedding/multimodal pipeline), not by this tokenizer.
Source
Thrown at private_gpt/components/llm/tokenizers/remote.py:109
@property
def is_multimodal(self) -> bool:
return False
def __call__(
self,
texts: TextLike | None = None,
images: ImageLike | None = None,
audios: AudioLike | None = None,
add_special_tokens: bool = True,
truncation: bool = False,
max_length: int | None = None,
**kwargs: Any,
) -> TokenizedInput:
del add_special_tokens, truncation, max_length, kwargs
if images or audios:
raise NotImplementedError(
"RemoteTokenizeTokenizer only supports text tokenization"
)
if texts is None:
return TokenizedInput(input_ids=[])
if isinstance(texts, str):
return TokenizedInput(input_ids=self.encode(texts))
if isinstance(texts, Sequence):
input_ids: list[int] = []
for text in texts:
input_ids.extend(self.encode(str(text)))
return TokenizedInput(input_ids=input_ids)
return TokenizedInput(input_ids=self.encode(str(texts)))
def get_vocab(self) -> dict[str, int]:
raise NotImplementedError(View on GitHub (pinned to 4a030776a3)
Solutions
- Remove images/audios from the tokenize() call and pass only texts (or None).
- Tokenize non-text modalities with a multimodal-aware component instead of the remote text tokenizer.
- Switch tokenizer_mode to an implementation that supports the modalities you need, if one exists.
- Guard call sites: forward images/audios only when non-empty.
Example fix
# before result = tok.tokenize(texts=prompt, images=[img_bytes]) # NotImplementedError # after text_result = tok.tokenize(texts=prompt) # handle img_bytes via the multimodal embedding path
Defensive patterns
Strategy: validation
Validate before calling
def tokenize_safe(tok, texts=None, images=None, audios=None):
if getattr(tok, 'remote_only_text', False) and (images or audios):
raise SkipModality('use multimodal counter for non-text')
return tok.tokenize(texts=texts) Type guard
def supports_multimodal(tok) -> bool:
return 'RemoteTokenizeTokenizer' not in type(tok).__name__ Try / catch
try:
result = tok.tokenize(texts=t, images=imgs)
except NotImplementedError:
result = tok.tokenize(texts=t) # count images separately Prevention
- Only forward images/audios kwargs when truthy and when the tokenizer is known to support them.
- Keep a modality-aware dispatcher at the pipeline level so text and non-text content never share one tokenizer call.
When it happens
Trigger: Calling tokenizer.tokenize(texts=..., images=[...]) or tokenizer.tokenize(texts=..., audios=[...]) on a RemoteTokenizeTokenizer instance; routing mixed-mode content (image + caption) through the text tokenizer; a generic call site that always forwards all modality arguments even when they are empty is fine, but any truthy images/audios value raises.
Common situations: Upgrading a pipeline to multimodal ingestion while keeping tokenizer_mode=remote_tokenize; a shared helper that passes image/audio placeholders unconditionally; testing the tokenizer with multimodal fixtures.
Related errors
- Multimodal input provided but tokenizer is not multimodal
- TikTokenTokenizer only supports text token counting
- Tokenizer is required and must support apply_chat_template:
- RemoteTokenizeTokenizer is not available with the given conf
- tokenizer_fn must be provided.
AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15).
Data as JSON: /api/errors/8b2fd8bd897d6581.
Report an issue: GitHub.