Spaces:
Runtime error
Runtime error
Update wrapper.py
Browse files- wrapper.py +12 -2
wrapper.py
CHANGED
@@ -24,21 +24,31 @@ def main():
|
|
24 |
lyrics_file.write(args.lyrics)
|
25 |
lyrics_path = lyrics_file.name
|
26 |
|
|
|
|
|
27 |
try:
|
|
|
|
|
|
|
28 |
# Run the inference script
|
29 |
subprocess.run([
|
30 |
-
'python', 'infer.py',
|
31 |
'--stage1_model', 'm-a-p/YuE-s1-7B-anneal-en-cot',
|
32 |
'--stage2_model', 'm-a-p/YuE-s2-1B-general',
|
33 |
'--genre_txt', genre_path,
|
34 |
'--lyrics_txt', lyrics_path,
|
35 |
'--run_n_segments', str(args.run_n_segments),
|
36 |
'--stage2_batch_size', str(args.stage2_batch_size),
|
37 |
-
'--output_dir',
|
38 |
'--cuda_idx', str(args.cuda_idx),
|
39 |
'--max_new_tokens', str(args.max_new_tokens)
|
40 |
], check=True)
|
41 |
|
|
|
|
|
|
|
|
|
|
|
42 |
finally:
|
43 |
# Clean up temporary files
|
44 |
os.unlink(genre_path)
|
|
|
24 |
lyrics_file.write(args.lyrics)
|
25 |
lyrics_path = lyrics_file.name
|
26 |
|
27 |
+
output_dir = '/home/user/app/output'
|
28 |
+
|
29 |
try:
|
30 |
+
# Get the directory where wrapper.py is located
|
31 |
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
32 |
+
|
33 |
# Run the inference script
|
34 |
subprocess.run([
|
35 |
+
'python', os.path.join(current_dir, 'infer.py'),
|
36 |
'--stage1_model', 'm-a-p/YuE-s1-7B-anneal-en-cot',
|
37 |
'--stage2_model', 'm-a-p/YuE-s2-1B-general',
|
38 |
'--genre_txt', genre_path,
|
39 |
'--lyrics_txt', lyrics_path,
|
40 |
'--run_n_segments', str(args.run_n_segments),
|
41 |
'--stage2_batch_size', str(args.stage2_batch_size),
|
42 |
+
'--output_dir', output_dir,
|
43 |
'--cuda_idx', str(args.cuda_idx),
|
44 |
'--max_new_tokens', str(args.max_new_tokens)
|
45 |
], check=True)
|
46 |
|
47 |
+
print(f"\nOutput directory: {output_dir}")
|
48 |
+
print("Generated files:")
|
49 |
+
for file in os.listdir(output_dir):
|
50 |
+
print(f"- {os.path.join(output_dir, file)}")
|
51 |
+
|
52 |
finally:
|
53 |
# Clean up temporary files
|
54 |
os.unlink(genre_path)
|