Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuqiao committed Dec 9, 2023
1 parent 35e4d16 commit 10d67d4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modules/task/forced_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ def _infer_once(
)

# postprocess
frame_length = (
self.melspec_config["hop_length"] / self.melspec_config["sample_rate"]
frame_length = self.melspec_config["hop_length"] / (
self.melspec_config["sample_rate"] * self.melspec_config["scale_factor"]
)
ph_time_fractional = (edge_diff[ph_time_int_pred] / 2).clip(-0.5, 0.5)
ph_time_pred = frame_length * (
Expand Down Expand Up @@ -405,8 +405,11 @@ def predict_step(self, batch, batch_idx):
self.get_melspec = MelSpecExtractor(**self.melspec_config)

waveform = load_wav(wav_path, self.device, self.melspec_config["sample_rate"])
melspec = self.get_melspec(waveform).unsqueeze(0)
melspec = self.get_melspec(waveform).detach().unsqueeze(0)
melspec = (melspec - melspec.mean()) / melspec.std()
melspec = repeat(
melspec, "B C T -> B C (T N)", N=self.melspec_config["scale_factor"]
)
(ph_seq, ph_intervals, word_seq, word_intervals, _, _) = self._infer_once(
melspec, ph_seq, word_seq, ph_idx_to_word_idx, False, False
)
Expand Down

0 comments on commit 10d67d4

Please sign in to comment.