multimodalart HF staff commited on
Commit
d28357f
·
verified ·
1 Parent(s): a39b430

Update wrapper.py

Browse files
Files changed (1) hide show
  1. wrapper.py +15 -24
wrapper.py CHANGED
@@ -4,23 +4,6 @@ import os
4
  import subprocess
5
  import sys
6
 
7
- def debug_environment():
8
- """Print debug information about the environment"""
9
- print("\n=== Debug Information ===")
10
- print(f"Current working directory: {os.getcwd()}")
11
- print("\nDirectory contents:")
12
- for root, dirs, files in os.walk("."):
13
- level = root.replace(".", "").count(os.sep)
14
- indent = " " * 4 * level
15
- print(f"{indent}{os.path.basename(root)}/")
16
- subindent = " " * 4 * (level + 1)
17
- for f in files:
18
- print(f"{subindent}{f}")
19
-
20
- print("\nEnvironment variables:")
21
- for key, value in os.environ.items():
22
- print(f"{key}={value}")
23
-
24
  def main():
25
  parser = argparse.ArgumentParser(description='Run YuE model with direct input')
26
  parser.add_argument('--genre', type=str, required=True, help='Genre tags for the music')
@@ -33,7 +16,12 @@ def main():
33
  args = parser.parse_args()
34
 
35
  print("\n=== Starting YuE Inference ===")
36
- debug_environment()
 
 
 
 
 
37
 
38
  # Create temporary files for genre and lyrics
39
  with tempfile.NamedTemporaryFile(mode='w', delete=False) as genre_file:
@@ -51,18 +39,22 @@ def main():
51
  output_dir = '/home/user/app/output'
52
 
53
  try:
54
- # Get the directory where wrapper.py is located
55
- current_dir = os.path.dirname(os.path.abspath(__file__))
56
- infer_script = os.path.join(current_dir, 'infer.py')
57
 
 
58
  print(f"\nInference script path: {infer_script}")
59
  print(f"Script exists: {os.path.exists(infer_script)}")
60
 
 
 
 
61
  if os.path.exists('./mm_tokenizer_v0.2_hf'):
62
- print("\nTokenizer directory contents:")
63
  print(os.listdir('./mm_tokenizer_v0.2_hf'))
64
  else:
65
- print("\nWARNING: Tokenizer directory not found!")
66
 
67
  print("\nExecuting inference command...")
68
  command = [
@@ -80,7 +72,6 @@ def main():
80
 
81
  print(f"Command: {' '.join(command)}")
82
 
83
- # Run the inference script
84
  result = subprocess.run(command,
85
  check=True,
86
  capture_output=True,
 
4
  import subprocess
5
  import sys
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  def main():
8
  parser = argparse.ArgumentParser(description='Run YuE model with direct input')
9
  parser.add_argument('--genre', type=str, required=True, help='Genre tags for the music')
 
16
  args = parser.parse_args()
17
 
18
  print("\n=== Starting YuE Inference ===")
19
+ current_dir = os.path.dirname(os.path.abspath(__file__))
20
+ inference_dir = os.path.dirname(os.path.abspath(__file__))
21
+
22
+ print(f"\nCurrent directory: {os.getcwd()}")
23
+ print(f"Script directory: {current_dir}")
24
+ print(f"Inference directory: {inference_dir}")
25
 
26
  # Create temporary files for genre and lyrics
27
  with tempfile.NamedTemporaryFile(mode='w', delete=False) as genre_file:
 
39
  output_dir = '/home/user/app/output'
40
 
41
  try:
42
+ # Go to inference directory for running the script
43
+ os.chdir(inference_dir)
44
+ print(f"\nChanged working directory to: {os.getcwd()}")
45
 
46
+ infer_script = 'infer.py'
47
  print(f"\nInference script path: {infer_script}")
48
  print(f"Script exists: {os.path.exists(infer_script)}")
49
 
50
+ tokenizer_path = './mm_tokenizer_v0.2_hf/tokenizer.model'
51
+ print(f"\nChecking tokenizer at: {tokenizer_path}")
52
+ print(f"Tokenizer exists: {os.path.exists(tokenizer_path)}")
53
  if os.path.exists('./mm_tokenizer_v0.2_hf'):
54
+ print("Tokenizer directory contents:")
55
  print(os.listdir('./mm_tokenizer_v0.2_hf'))
56
  else:
57
+ print("WARNING: Tokenizer directory not found!")
58
 
59
  print("\nExecuting inference command...")
60
  command = [
 
72
 
73
  print(f"Command: {' '.join(command)}")
74
 
 
75
  result = subprocess.run(command,
76
  check=True,
77
  capture_output=True,