inference

tokenize

Tokenize text with a local model.

strata inference tokenize

wire inference_tokenize

Encodes text into the token id sequence a local model would see and returns the ids in order. Set `add_special` to include the model's special tokens (such as beginning-of-sequence markers). Tokenization is a local-only operation: it requires a build with the local execution feature and returns `inference.unsupported_operation` for cloud provider specs.

To see the complete help for this command, run:

strata inference tokenize --help

Parameters

NameTypeRequiredDescription
modelstringyesModel spec.
textstringyesText to tokenize.
add_specialbooleannoWhether to add special tokens.

Returns

TokenIds

  • dataarray
  • typestring

Errors

Recover by code. Retry policy and commit outcome come from the shipped error registry.

CodeRetryCommit outcome
failed_precondition.engine.runtime_closednevernot_started
not_found.engine.branchnevernot_applicable
inference.unsupported_operationnevernot_applicable
inference.missing_modelafter_state_changenot_applicable
inference.model_load_failedafter_state_changenot_applicable
inference.local_runtime_failedunknownnot_applicable
inference.registry_corruptnevernot_applicable
← All 11 Inference commands

agents: this page as markdown → /docs/reference/inference/tokenize.md