MCPcopy
hub / github.com/InternLM/lmdeploy / decode

Method decode

lmdeploy/tokenizer.py:485–503  ·  view source on GitHub ↗

De-tokenize. Args: t: a list of token ids. offset: for incrementally decoding. Default to None, which means not applied. skip_special_tokens: Whether or not to remove special tokens in the decoding. Returns:

(
        self,
        t: Sequence[int],
        offset: int | None = None,
        skip_special_tokens: bool = True,
    )

Source from the content-addressed store, hash-verified

483 return encoded
484
485 def decode(
486 self,
487 t: Sequence[int],
488 offset: int | None = None,
489 skip_special_tokens: bool = True,
490 ):
491 """De-tokenize.
492
493 Args:
494 t: a list of token ids.
495 offset: for incrementally decoding. Default to None, which
496 means not applied.
497 skip_special_tokens: Whether or not to remove special
498 tokens in the decoding.
499
500 Returns:
501 str: text of decoding tokens.
502 """
503 return self.model.decode(t, offset, skip_special_tokens)
504
505 def detokenize_incrementally(self,
506 all_input_ids: Sequence[int],

Callers 15

get_turbomind_depsFunction · 0.45
serialize_state_dictFunction · 0.45
decodeMethod · 0.45
encode_base64Method · 0.45
encode_base64Method · 0.45
encode_base64Method · 0.45
generateMethod · 0.45
chat_completions_v1Method · 0.45
completions_v1Method · 0.45
_postMethod · 0.45

Calls

no outgoing calls

Tested by 4

_postMethod · 0.36
stream_requestMethod · 0.36
test_tokenizerFunction · 0.36