Luigi commited on
Commit
1261e7b
·
verified ·
1 Parent(s): 49158ed

export: disable non-ONNX group planner

Browse files
Files changed (1) hide show
  1. scripts/export_8k.py +9 -2
scripts/export_8k.py CHANGED
@@ -34,7 +34,8 @@ class DecoderHead(torch.nn.Module):
34
  x = frames + m.frame_proj(frame_meta) + m.local_ctx(local_ctx_raw)
35
  x = x + m.abs_frame(abs_pos)
36
  if m.cfg.use_frame_pitch:
37
- x = x + m.pitch_proj(pitch_frame)
 
38
  for blk in m.decoder:
39
  x = blk(x, frame_mask)
40
  x = x + m.frame_gru(x)[0]
@@ -73,7 +74,13 @@ def main():
73
 
74
  ac = torch.load(args.acoustic_ckpt, map_location=dev, weights_only=False)
75
  cfg = MicroFastSpeechConfig(**ac["config"])
76
- m = MicroFastSpeech(cfg); m.load_state_dict(ac["model"]); m.eval()
 
 
 
 
 
 
77
  enc, dec = EncoderHead(m).eval(), DecoderHead(m).eval()
78
  print(f"acoustic: sr={cfg.sample_rate} vocab={cfg.vocab_size} tone={cfg.tone_size} lang={cfg.lang_size} "
79
  f"abs_bins={cfg.abs_frame_bins} max_frames={cfg.max_frames}")
 
34
  x = frames + m.frame_proj(frame_meta) + m.local_ctx(local_ctx_raw)
35
  x = x + m.abs_frame(abs_pos)
36
  if m.cfg.use_frame_pitch:
37
+ refined = m.refine_frame_pitch(frames, frame_meta, pitch_frame)
38
+ x = x + m.pitch_proj(refined)
39
  for blk in m.decoder:
40
  x = blk(x, frame_mask)
41
  x = x + m.frame_gru(x)[0]
 
74
 
75
  ac = torch.load(args.acoustic_ckpt, map_location=dev, weights_only=False)
76
  cfg = MicroFastSpeechConfig(**ac["config"])
77
+ m = MicroFastSpeech(cfg); m.load_state_dict(ac["model"], strict=False); m.eval()
78
+ # The group-duration planner uses a non-ONNX-able host loop and only adjusts inference-time
79
+ # durations (the mel decoder is trained on GT durations). Disable it so the exported encoder's
80
+ # plain-duration path (which keeps the contextual duration-delta) matches m.infer() for parity.
81
+ if getattr(m, "group_duration_delta", None) is not None:
82
+ m.group_duration_delta = None
83
+ print("note: group_duration_planner disabled at export (host-loop; plain durations used)")
84
  enc, dec = EncoderHead(m).eval(), DecoderHead(m).eval()
85
  print(f"acoustic: sr={cfg.sample_rate} vocab={cfg.vocab_size} tone={cfg.tone_size} lang={cfg.lang_size} "
86
  f"abs_bins={cfg.abs_frame_bins} max_frames={cfg.max_frames}")