Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ from tqdm import tqdm
|
|
14 |
from einops import rearrange
|
15 |
import numpy as np
|
16 |
import json
|
17 |
-
|
18 |
import torch
|
19 |
import torchaudio
|
20 |
from torchaudio.transforms import Resample
|
@@ -83,6 +83,8 @@ MAX_NEW_TOKENS = 15 # Duration slider (in seconds, scaled internally)
|
|
83 |
RUN_N_SEGMENTS = 2 # Number of segments to generate
|
84 |
STAGE2_BATCH_SIZE = 4 # Batch size for stage2 inference
|
85 |
|
|
|
|
|
86 |
# You may change these defaults via Gradio input (see below)
|
87 |
|
88 |
# ----------------------- Device Setup -----------------------
|
@@ -493,7 +495,7 @@ def generate_music(
|
|
493 |
stage2_result[0],
|
494 |
os.path.join(vocoder_stems_dir, "vocal.mp3"),
|
495 |
rescale,
|
496 |
-
|
497 |
vocal_decoder,
|
498 |
codec_model,
|
499 |
)
|
@@ -501,7 +503,7 @@ def generate_music(
|
|
501 |
stage2_result[1],
|
502 |
os.path.join(vocoder_stems_dir, "instrumental.mp3"),
|
503 |
rescale,
|
504 |
-
|
505 |
inst_decoder,
|
506 |
codec_model,
|
507 |
)
|
|
|
14 |
from einops import rearrange
|
15 |
import numpy as np
|
16 |
import json
|
17 |
+
import argparse
|
18 |
import torch
|
19 |
import torchaudio
|
20 |
from torchaudio.transforms import Resample
|
|
|
83 |
RUN_N_SEGMENTS = 2 # Number of segments to generate
|
84 |
STAGE2_BATCH_SIZE = 4 # Batch size for stage2 inference
|
85 |
|
86 |
+
default_args = argparse.Namespace(cuda_idx=4)
|
87 |
+
|
88 |
# You may change these defaults via Gradio input (see below)
|
89 |
|
90 |
# ----------------------- Device Setup -----------------------
|
|
|
495 |
stage2_result[0],
|
496 |
os.path.join(vocoder_stems_dir, "vocal.mp3"),
|
497 |
rescale,
|
498 |
+
default_args,
|
499 |
vocal_decoder,
|
500 |
codec_model,
|
501 |
)
|
|
|
503 |
stage2_result[1],
|
504 |
os.path.join(vocoder_stems_dir, "instrumental.mp3"),
|
505 |
rescale,
|
506 |
+
default_args,
|
507 |
inst_decoder,
|
508 |
codec_model,
|
509 |
)
|