OpenAI Whisper探索(一)

庄智
2023-12-01

1.根据提示安装依赖 :

安装Whisper前先安装依赖

1.1安装torch:

ERROR: Could not find a version that satisfies the requirement torch (from versions: none)

经过了解torch是

pip install torch
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting torch
  Downloading https://mirrors.aliyun.com/pypi/packages/a6/41/122f37c99422566ea74b9cce90eb9218f5e8fb2582466da220f95842a0a0/torch-1.13.1-cp38-cp38-win_amd64.whl (162.6 MB)
     ---------------------------------------- 162.6/162.6 MB 502.9 kB/s eta 0:00:00
Requirement already satisfied: typing-extensions in 。。。 (from torch) (3.10.0.2)
Installing collected packages: torch
Successfully installed torch-1.13.1
  • PS: 运行的时候还会遇到提示缺少VC环境,按照提示地址下载安装就可以了

Microsoft Visual C++ Redistributable is not installed, this may lead to the DLL
load failure.
It can be downloaded at https://aka.ms/vs/16/release/vc_redist.x64.exe
OSError: [WinError 126] 找不到指定的模块。 Error loading “c:\python\python38\lib
\site-packages\torch\lib\c10.dll” or one of its dependencies.

1.2安装transformers

ERROR: Could not find a version that satisfies the requirement transformers>=4.19.0 (from whisper) (from versions: none)

pip install transformers
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting transformers
  Downloading https://mirrors.aliyun.com/pypi/packages/90/5b/02becd3e137fdacdc30c6442d04094d0b92e500f978df00b1a197b68fd2b/transformers-4.25.1-py3-none-any.whl (5.8 MB)
     ---------------------------------------- 5.8/5.8 MB 670.1 kB/s eta 0:00:00
Installing collected packages: tokenizers, regex, packaging, filelock, huggingface-hub, transformers
Successfully installed filelock-3.8.2 huggingface-hub-0.11.1 packaging-22.0 regex-2022.10.31 tokenizers-0.13.2 transformers-4.25.1

1.3安装ffmpeg-python

ERROR: Could not find a version that satisfies the requirement ffmpeg-python==0.2.0 (from whisper) (from versions: none)

pip install ffmpeg-python
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting ffmpeg-python
  Downloading https://mirrors.aliyun.com/pypi/packages/d7/0c/56be52741f75bad4dc6555991fabd2e07b432d333da82c11ad701123888a/ffmpeg_python-0.2.0-py3-none-any.whl (25 kB)
Requirement already satisfied: future in h:\program files\python\python38\lib\site-packages (from ffmpeg-python) (0.18.2)
Installing collected packages: ffmpeg-python
Successfully installed ffmpeg-python-0.2.0

。。。根据提示安装其他依赖

2.安装完所有依赖后安装whisper

pip install git+https://github.com/openai/whisper.git
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting git+https://github.com/openai/whisper.git
  Cloning https://github.com/openai/whisper.git to 。。。。\local\temp\pip-req-build-wj07mmuz
  Running command git clone --quiet https://github.com/openai/whisper.git '。。。。\Local\Temp\pip-req-build-wj07mmuz'
  Resolved https://github.com/openai/whisper.git to commit 0b5dcfdef7ec04250b76e13f1630e32b0935ce76
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in 。。。 (from whisper==1.0) (1.18.4)
Requirement already satisfied: torch in 。。。 (from whisper==1.0) (1.13.1)
Requirement already satisfied: tqdm in 。。。 (from whisper==1.0) (4.48.0)
Requirement already satisfied: more-itertools in 。。。 (from whisper==1.0) (8.5.0)
Requirement already satisfied: transformers>=4.19.0 in 。。。 (from whisper==1.0) (4.25.1)
Requirement already satisfied: ffmpeg-python==0.2.0 in 。。。 (from whisper==1.0) (0.2.0)
Requirement already satisfied: future in 。。。 (from ffmpeg-python==0.2.0->whisper==1.0) (0.18.2)
Requirement already satisfied: regex!=2019.12.17 in 。。。 (from transformers>=4.19.0->whisper==1.0) (2022.10.31)
Requirement already satisfied: huggingface-hub<1.0,>=0.10.0 in 。。。 (from transformers>=4.19.0->whisper==1.0) (0.11.1)
Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in 。。。 (from transformers>=4.19.0->whisper==1.0) (0.13.2)
Requirement already satisfied: pyyaml>=5.1 in 。。。 (from transformers>=4.19.0->whisper==1.0) (5.4.1)
Requirement already satisfied: requests in 。。。 (from transformers>=4.19.0->whisper==1.0) (2.23.0)
Requirement already satisfied: packaging>=20.0 in 。。。 (from transformers>=4.19.0->whisper==1.0) (22.0)
Requirement already satisfied: filelock in 。。。 (from transformers>=4.19.0->whisper==1.0) (3.8.2)
Requirement already satisfied: typing-extensions in 。。。 (from torch->whisper==1.0) (3.10.0.2)
Requirement already satisfied: idna<3,>=2.5 in 。。。 (from requests->transformers>=4.19.0->whisper==1.0) (2.9)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in 。。。 (from requests->transformers>=4.19.0->whisper==1.0) (1.25.9)
Requirement already satisfied: certifi>=2017.4.17 in 。。。 (from requests->transformers>=4.19.0->whisper==1.0) (2020.4.5.1)
Requirement already satisfied: chardet<4,>=3.0.2 in 。。。 (from requests->transformers>=4.19.0->whisper==1.0) (3.0.4)
Installing collected packages: whisper
  DEPRECATION: whisper is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for whisper ... done
Successfully installed whisper-1.0

下载引用models文件所在默认路径

%UserProfile%\.cache\whisper
 类似资料: