learnmlf commited on
Commit
048983c
·
1 Parent(s): e2bca25

Fix missing dependencies

Browse files

- Add torchdiffeq and other missing packages to requirements.txt
- Update dependency versions to match hf_AC requirements
- Add better error handling and dependency checking in app.py
- Include nitrous-ema, hydra_colorlog, and python-dotenv

Files changed (2) hide show
  1. app.py +31 -0
  2. requirements.txt +17 -10
app.py CHANGED
@@ -36,8 +36,36 @@ USAGE_TIPS = """
36
  4. **CFG强度**: 数值越高越贴合提示词,但可能降低质量
37
  """
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  # Import hf_AC modules with error handling
40
  try:
 
 
 
 
 
 
41
  from hf_AC.mmaudio.eval_utils import (ModelConfig, all_model_cfg, generate, load_video,
42
  setup_eval_logging)
43
  from hf_AC.mmaudio.model.flow_matching import FlowMatching
@@ -48,8 +76,11 @@ try:
48
  setup_eval_logging()
49
  log = logging.getLogger()
50
  HF_AC_AVAILABLE = True
 
 
51
  except ImportError as e:
52
  print(f"Warning: hf_AC modules not available: {e}")
 
53
  log = logging.getLogger()
54
  HF_AC_AVAILABLE = False
55
 
 
36
  4. **CFG强度**: 数值越高越贴合提示词,但可能降低质量
37
  """
38
 
39
+ # Check and install missing dependencies
40
+ def check_dependencies():
41
+ """Check if all required packages are available"""
42
+ missing_packages = []
43
+ required_packages = [
44
+ 'torch', 'torchaudio', 'numpy', 'scipy', 'librosa',
45
+ 'torchdiffeq', 'einops', 'hydra', 'tensordict', 'av'
46
+ ]
47
+
48
+ for package in required_packages:
49
+ try:
50
+ if package == 'hydra':
51
+ __import__('hydra')
52
+ elif package == 'av':
53
+ __import__('av')
54
+ else:
55
+ __import__(package)
56
+ except ImportError:
57
+ missing_packages.append(package)
58
+
59
+ return missing_packages
60
+
61
  # Import hf_AC modules with error handling
62
  try:
63
+ # First check basic dependencies
64
+ missing_deps = check_dependencies()
65
+ if missing_deps:
66
+ print(f"Warning: Missing dependencies: {missing_deps}")
67
+ print("Some dependencies may be installing in the background...")
68
+
69
  from hf_AC.mmaudio.eval_utils import (ModelConfig, all_model_cfg, generate, load_video,
70
  setup_eval_logging)
71
  from hf_AC.mmaudio.model.flow_matching import FlowMatching
 
76
  setup_eval_logging()
77
  log = logging.getLogger()
78
  HF_AC_AVAILABLE = True
79
+ print("✅ hf_AC modules loaded successfully!")
80
+
81
  except ImportError as e:
82
  print(f"Warning: hf_AC modules not available: {e}")
83
+ print("This may be due to missing dependencies. Please wait for installation to complete.")
84
  log = logging.getLogger()
85
  HF_AC_AVAILABLE = False
86
 
requirements.txt CHANGED
@@ -2,18 +2,25 @@ torch>=2.0.0
2
  torchvision
3
  torchaudio
4
  gradio>=4.0.0
5
- huggingface_hub>=0.20.0
6
- numpy>=1.21.0
7
- Pillow>=9.0.0
8
- opencv-python>=4.6.0
9
  scipy>=1.7.0
10
- tqdm>=4.60.0
11
  einops>=0.6.0
12
  requests
13
  librosa>=0.8.1
14
- av>=10.0.0
15
- timm>=0.9.0
16
- open_clip_torch>=2.20.0
17
- tensordict>=0.3.0
18
- hydra-core>=1.3.0
19
  colorlog
 
 
 
 
 
 
 
 
2
  torchvision
3
  torchaudio
4
  gradio>=4.0.0
5
+ huggingface_hub>=0.26.0
6
+ numpy>=1.21.0,<2.1
7
+ Pillow>=9.5.0
8
+ opencv-python>=4.8.0
9
  scipy>=1.7.0
10
+ tqdm>=4.66.1
11
  einops>=0.6.0
12
  requests
13
  librosa>=0.8.1
14
+ av>=14.0.1
15
+ timm>=1.0.12
16
+ open_clip_torch>=2.29.0
17
+ tensordict>=0.6.1
18
+ hydra-core>=1.3.2
19
  colorlog
20
+ torchdiffeq>=0.2.5
21
+ cython
22
+ gitpython>=3.1.0
23
+ tensorboard>=2.11.0
24
+ nitrous-ema
25
+ hydra_colorlog
26
+ python-dotenv