Skip to content

Commit dbb643a

Browse files
authored
Merge pull request #19 from audiohacking/copilot/fix-decoding-audio-failure
Fix audio decoding: preserve long dtype for token indices
2 parents a80cb17 + c187b41 commit dbb643a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

backend/app/services/music_service.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,8 +844,9 @@ def _pad_audio_token(token):
844844
else:
845845
raise RuntimeError("Cannot load HeartCodec: codec_path not available")
846846

847-
# Convert frames to codec device and dtype (important for MPS float16)
848-
frames_for_codec = frames.to(device=pipeline.codec_device, dtype=codec_dtype)
847+
# Move frames to codec device (keep dtype as long for indexing)
848+
# frames contains token IDs (integers) used as indices, so dtype must remain long
849+
frames_for_codec = frames.to(device=pipeline.codec_device)
849850
wav = pipeline.codec.detokenize(frames_for_codec)
850851

851852
# Cleanup codec if using lazy loading (free VRAM for next generation)

0 commit comments

Comments
 (0)