MCPcopy Create free account
hub / github.com/modelscope/ms-agent / decode

Method decode

ms_agent/utils/tokenizer_util.py:32–43  ·  view source on GitHub ↗

Decode a list of token IDs back into a natural text string. Args: token_ids: List of token IDs to decode. Returns: Decoded text string.

(self, token_ids: List[int])

Source from the content-addressed store, hash-verified

30 return self.tokenizer.encode(content.strip())
31
32 def decode(self, token_ids: List[int]) -> str:
33 """Decode a list of token IDs back into a natural text string.
34
35 Args:
36 token_ids: List of token IDs to decode.
37
38 Returns:
39 Decoded text string.
40 """
41 if not token_ids:
42 return ''
43 return self.tokenizer.decode(token_ids, skip_special_tokens=True)
44
45 def segment(self, content: str) -> List[str]:
46 """Tokenize text into a list of token strings suitable for BM25-like algorithms indexing/retrieval.

Callers 15

get_image_descriptionMethod · 0.80
_render_manim_implMethod · 0.80
check_manim_qualityMethod · 0.80
_tail_text_from_fileFunction · 0.80
fetch_single_textFunction · 0.80
_coerce_strFunction · 0.80
_read_messageMethod · 0.80
_read_server_stderrMethod · 0.80
startMethod · 0.80
_upload_filesMethod · 0.80
segmentMethod · 0.80
replace_imageFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected