MCPcopy Create free account
hub / github.com/MoonInTheRiver/DiffSinger / decode

Method decode

utils/text_encoder.py:62–77  ·  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

60 return [int(w) + self._num_reserved_ids for w in s.split()]
61
62 def decode(self, ids, strip_extraneous=False):
63 """Transform a sequence of int ids into a human-readable string.
64
65 EOS is not expected in ids.
66
67 Args:
68 ids: list of integers to be converted.
69 strip_extraneous: bool, whether to strip off extraneous tokens
70 (EOS and PAD).
71
72 Returns:
73 s: human-readable string.
74 """
75 if strip_extraneous:
76 ids = strip_ids(ids, list(range(self._num_reserved_ids or 0)))
77 return " ".join(self.decode_list(ids))
78
79 def decode_list(self, ids):
80 """Transform a sequence of int ids into a their string versions.

Callers 4

out2durMethod · 0.45
decodeMethod · 0.45
plot_durMethod · 0.45
after_inferMethod · 0.45

Calls 2

decode_listMethod · 0.95
strip_idsFunction · 0.85

Tested by

no test coverage detected