| | |
| | |
| |
|
| | """ |
| | 修复numpy和transformers兼容性问题 |
| | """ |
| |
|
| | import subprocess |
| | import sys |
| |
|
| | def run_command(command): |
| | """运行命令并打印输出""" |
| | print(f"执行: {command}") |
| | result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| | if result.stdout: |
| | print(result.stdout.decode('utf-8')) |
| | if result.stderr: |
| | print(f"错误: {result.stderr.decode('utf-8')}") |
| | return result.returncode == 0 |
| |
|
| | def main(): |
| | """修复环境问题""" |
| | print("开始修复环境问题...") |
| | |
| | |
| | print("步骤1: 卸载当前的numpy和transformers") |
| | run_command("pip uninstall -y numpy transformers") |
| | |
| | |
| | print("步骤2: 安装兼容的numpy版本") |
| | run_command("pip install numpy==1.23.5") |
| | |
| | |
| | print("步骤3: 安装兼容的transformers版本") |
| | run_command("pip install transformers==4.26.1") |
| | |
| | |
| | print("步骤4: 安装pydantic v1版本") |
| | run_command("pip uninstall -y pydantic") |
| | run_command("pip install pydantic==1.10.8") |
| | |
| | |
| | print("步骤5: 安装CLIP模型") |
| | run_command("pip install ftfy regex") |
| | run_command("pip install git+https://github.com/openai/CLIP.git") |
| | |
| | print("\n环境修复完成!") |
| | print("请使用以下命令重新运行你的脚本:") |
| | print("python batch_process.py --txt_path /home/wangjuntong/VQA_model/dataset/video_editing_score/video_quality_with_prompts.txt --output_path /home/wangjuntong/VQA_model/PickScore-main/output") |
| |
|
| | if __name__ == "__main__": |
| | main() |