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

Method _phone_encoder

data_gen/singing/binarize.py:99–111  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

97 self.process_data('train')
98
99 def _phone_encoder(self):
100 ph_set_fn = f"{hparams['binary_data_dir']}/phone_set.json"
101 ph_set = []
102 if hparams['reset_phone_dict'] or not os.path.exists(ph_set_fn):
103 for ph_sent in self.item2ph.values():
104 ph_set += ph_sent.split(' ')
105 ph_set = sorted(set(ph_set))
106 json.dump(ph_set, open(ph_set_fn, 'w'))
107 print("| Build phone set: ", ph_set)
108 else:
109 ph_set = json.load(open(ph_set_fn, 'r'))
110 print("| Load phone set: ", ph_set)
111 return build_phone_encoder(hparams['binary_data_dir'])
112
113 # @staticmethod
114 # def get_pitch(wav_fn, spec, res):

Callers 1

processMethod · 0.95

Calls 1

build_phone_encoderFunction · 0.90

Tested by

no test coverage detected