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

Method store_to_file

utils/text_encoder.py:290–301  ·  view source on GitHub ↗

Write vocab file to disk. Vocab files have one token per line. The file ends in a newline. Reserved tokens are written to the vocab file as well. Args: filename: Full path of the file to store the vocab to.

(self, filename)

Source from the content-addressed store, hash-verified

288 return self.seg_index
289
290 def store_to_file(self, filename):
291 """Write vocab file to disk.
292
293 Vocab files have one token per line. The file ends in a newline. Reserved
294 tokens are written to the vocab file as well.
295
296 Args:
297 filename: Full path of the file to store the vocab to.
298 """
299 with open(filename, "w") as f:
300 for i in range(len(self._id_to_token)):
301 f.write(self._id_to_token[i] + "\n")
302
303 def sil_phonemes(self):
304 return [p for p in self._id_to_token.values() if not p[0].isalpha()]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected