MCPcopy Create free account
hub / github.com/bytedance/MegaTTS3 / decode

Method decode

tts/utils/text_utils/text_encoder.py:78–93  ·  view source on GitHub ↗

Transform a sequence of int ids into a human-readable string. EOS is not expected in ids. Args: ids: list of integers to be converted. strip_extraneous: bool, whether to strip off extraneous tokens (EOS and PAD). Returns: s: human-readab

(self, ids, strip_extraneous=False)

Source from the content-addressed store, hash-verified

76 return [int(w) + self._num_reserved_ids for w in s.split()]
77
78 def decode(self, ids, strip_extraneous=False):
79 """Transform a sequence of int ids into a human-readable string.
80
81 EOS is not expected in ids.
82
83 Args:
84 ids: list of integers to be converted.
85 strip_extraneous: bool, whether to strip off extraneous tokens
86 (EOS and PAD).
87
88 Returns:
89 s: human-readable string.
90 """
91 if strip_extraneous:
92 ids = strip_ids(ids, list(range(self._num_reserved_ids or 0)))
93 return " ".join(self.decode_list(ids))
94
95 def decode_list(self, ids):
96 """Transform a sequence of int ids into a their string versions.

Callers 1

forwardMethod · 0.45

Calls 2

decode_listMethod · 0.95
strip_idsFunction · 0.85

Tested by

no test coverage detected