Skip to main content

Python class

IdentityPipelineTokenizer

IdentityPipelineTokenizer

class max.pipelines.IdentityPipelineTokenizer(*args, **kwargs)

source

Bases: PipelineTokenizer[TokenGeneratorContext, str, TextGenerationRequest]

A pass-through tokenizer that returns prompts unchanged.

decode()

async decode(encoded, **kwargs)

source

Returns the encoded string unchanged (identity decoding).

Parameters:

encoded (str)

Return type:

str

encode()

async encode(prompt, add_special_tokens=False)

source

Returns the prompt unchanged (identity encoding).

Parameters:

  • prompt (str)
  • add_special_tokens (bool)

Return type:

str

eos

property eos: int

source

Returns the end-of-sequence token ID (0 for identity).

expects_content_wrapping

property expects_content_wrapping: bool

source

Returns whether this tokenizer expects content wrapping.