Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| 检查MiniGPT4-Video依赖安装状态 | |
| """ | |
| import sys | |
| import importlib | |
| # 必需的包列表 | |
| REQUIRED_PACKAGES = [ | |
| 'torch', | |
| 'torchvision', | |
| 'transformers', | |
| 'gradio', | |
| 'opencv-cv2', # opencv-python-headless | |
| 'moviepy', | |
| 'webvtt', | |
| 'pytubefix', | |
| 'omegaconf', | |
| 'timm', | |
| 'webdataset', | |
| 'sentence_transformers', | |
| 'sklearn', # scikit-learn | |
| 'skimage', # scikit-image | |
| 'decord', | |
| 'peft', | |
| 'bitsandbytes', | |
| 'whisper', # openai-whisper | |
| 'numpy', | |
| 'soundfile', | |
| 'accelerate', | |
| 'PIL', # Pillow | |
| 'requests' | |
| ] | |
| def check_package(package_name): | |
| """检查单个包是否安装""" | |
| try: | |
| importlib.import_module(package_name) | |
| return True, "✅" | |
| except ImportError as e: | |
| return False, f"❌ {str(e)}" | |
| def main(): | |
| print("🔍 检查MiniGPT4-Video依赖安装状态...\n") | |
| missing_packages = [] | |
| for package in REQUIRED_PACKAGES: | |
| success, status = check_package(package) | |
| print(f"{status} {package}") | |
| if not success: | |
| missing_packages.append(package) | |
| print(f"\n📊 检查结果:") | |
| print(f"✅ 已安装: {len(REQUIRED_PACKAGES) - len(missing_packages)}/{len(REQUIRED_PACKAGES)}") | |
| print(f"❌ 缺失: {len(missing_packages)}") | |
| if missing_packages: | |
| print(f"\n🔧 缺失的包:") | |
| for pkg in missing_packages: | |
| print(f" - {pkg}") | |
| print(f"\n💡 修复建议:") | |
| print(f"pip install -r requirements.txt") | |
| return False | |
| else: | |
| print(f"\n🎉 所有依赖都已正确安装!") | |
| return True | |
| if __name__ == "__main__": | |
| success = main() | |
| sys.exit(0 if success else 1) |