Skip to content

Fix Apple Silicon (MPS) watermarking crash & enable MPS device - #26

Open
Thearchitectoffire wants to merge 3 commits into
MisoLabsAI:mainfrom
Thearchitectoffire:fix-mps-watermark
Open

Fix Apple Silicon (MPS) watermarking crash & enable MPS device#26
Thearchitectoffire wants to merge 3 commits into
MisoLabsAI:mainfrom
Thearchitectoffire:fix-mps-watermark

Conversation

@Thearchitectoffire

Copy link
Copy Markdown

The MisoTTS watermark (silentcipher) relies on aten::unfold_backward during its inverse STFT, which is not natively supported by the MPS backend on Apple Silicon Macs and causes the generation to crash at the very end. Setting PYTORCH_ENABLE_MPS_FALLBACK=1 in the environment variables fixes this crash by allowing just that operation to fall back to the CPU while keeping the heavy generation on the GPU. I also enabled MPS by default in run_misotts.py since the float64 limitation doesn't seem to stop the generation from working with this fallback.

@ded-furby ded-furby left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the fallback env var is currently set too late to fix the default run_misotts.py path. run_misotts.py imports torch before it imports generator, so by the time generator.py executes os.environ.setdefault("PYTORCH_ENABLE_MPS_FALLBACK", "1"), PyTorch has already initialized without the fallback flag.

That means users who run the documented entrypoint can still hit the same MPS crash even though the PR adds the env var. Moving the flag into run_misotts.py before import torch (or documenting an external env export) should make the fix effective for the common path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants