Skip to content

Commit 5f7dafc

Browse files
authored
Merge pull request #10 from audiohacking/copilot/fix-generation-failed-issue
Fix MPS out of memory error by disabling PyTorch memory watermark
2 parents 36d09cf + 25d90b6 commit 5f7dafc

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

backend/app/services/music_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,6 +1858,7 @@ def _pipeline_callback(progress, msg):
18581858

18591859
def _run_pipeline():
18601860
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"
1861+
os.environ["PYTORCH_MPS_HIGH_WATERMARK_RATIO"] = "0.0"
18611862

18621863
sound_tags = request.tags if request.tags and request.tags.strip() else "pop music"
18631864

launcher.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def setup_environment():
5555
os.environ["HEARTMULA_GENERATED_AUDIO_DIR"] = str(generated_audio_dir)
5656
os.environ["HEARTMULA_REF_AUDIO_DIR"] = str(ref_audio_dir)
5757
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1" # Enable Metal Performance Shaders
58+
os.environ["PYTORCH_MPS_HIGH_WATERMARK_RATIO"] = "0.0" # Disable MPS memory limit to prevent OOM errors
5859

5960
# Change working directory to app bundle for frontend serving
6061
# Backend will use absolute paths from environment variables

0 commit comments

Comments
 (0)