test_voice / test_imports.py
tonyshark's picture
Upload 239 files
34b0b92 verified
#!/usr/bin/env python3
"""
Test script to check if all imports work correctly
"""
import sys
import os
# Add paths
current_dir = os.path.dirname(__file__)
src_path = os.path.join(current_dir, 'src')
examples_path = os.path.join(current_dir, 'examples')
if src_path not in sys.path:
sys.path.append(src_path)
if examples_path not in sys.path:
sys.path.append(examples_path)
print("πŸ§ͺ Testing EmoVoice imports...")
print(f"Current directory: {current_dir}")
print(f"Source path: {src_path}")
print(f"Examples path: {examples_path}")
# Test basic imports
try:
import numpy as np
print("βœ… numpy imported successfully")
except ImportError as e:
print(f"❌ numpy import failed: {e}")
try:
import torch
print("βœ… torch imported successfully")
except ImportError as e:
print(f"❌ torch import failed: {e}")
try:
import soundfile as sf
print("βœ… soundfile imported successfully")
except ImportError as e:
print(f"❌ soundfile import failed: {e}")
# Test SLAM-LLM imports
try:
from slam_llm.utils.model_utils import get_custom_model_factory
print("βœ… slam_llm.utils.model_utils imported successfully")
except ImportError as e:
print(f"❌ slam_llm.utils.model_utils import failed: {e}")
try:
from slam_llm.utils.dataset_utils import get_preprocessed_dataset
print("βœ… slam_llm.utils.dataset_utils imported successfully")
except ImportError as e:
print(f"❌ slam_llm.utils.dataset_utils import failed: {e}")
try:
from examples.tts.utils.codec_utils import audio_decode_cosyvoice
print("βœ… examples.tts.utils.codec_utils imported successfully")
except ImportError as e:
print(f"❌ examples.tts.utils.codec_utils import failed: {e}")
try:
from examples.tts.tts_config import ModelConfig, TrainConfig, DataConfig, DecodeConfig
print("βœ… examples.tts.tts_config imported successfully")
except ImportError as e:
print(f"❌ examples.tts.tts_config import failed: {e}")
# Test Hugging Face imports
try:
from huggingface_hub import hf_hub_download
print("βœ… huggingface_hub imported successfully")
except ImportError as e:
print(f"❌ huggingface_hub import failed: {e}")
print("\n🎯 Import test completed!")