����λ�ã���ҳ > �����̳� > �̳� > ������win10�ϲ���whisper��faster-whisper��whisperx��CPU��GPU�ĸ��Ա������
Anaconda��ʲô�� Anaconda ��һ����Դ�� Python ���а汾����Ҫ�������ݿ�ѧ������ѧϰ�����ݷ��������������������� Python ����������������Ҫ���Ǽ����˴��������ڿ�ѧ���㡢���ݷ����ͻ���ѧϰ��صĵ������⣬�����ṩ��һ��ǿ��İ������ͻ����������ߡ���Conda�� ͨ��C
Anaconda ��һ����Դ�� Python ���а汾����Ҫ�������ݿ�ѧ������ѧϰ�����ݷ��������������������� Python ����������������Ҫ���Ǽ����˴��������ڿ�ѧ���㡢���ݷ����ͻ���ѧϰ��صĵ������⣬�����ṩ��һ��ǿ��İ������ͻ����������ߡ���Conda��
ͨ��Conda������һ̨�����ϣ��������python�Ļ������dz����ɵĽ����л���
������ Anaconda ����Ҫ�ص�͹��ܣ�
��ݵĻ���������Anaconda ͨ�������õİ������� Conda��ʹ�ô������������л���ͬ�� Python ������ü�Ϊ�򵥡��û������ڲ�ͬ��Ŀ֮���������ö����Ļ�����ÿ�������п��԰�װ�ض��汾�� Python �������⣬�����˲�ͬ��Ŀ����֮��ij�ͻ��
�ḻ�����ݿ�ѧ���ߣ���װ Anaconda ʱ�ḽ��һϵ�г��õ����ݿ�ѧ�⣬�� NumPy��Pandas��Matplotlib��Scikit-learn �ȣ��Լ� Jupyter Notebook �����Ľ���ʽ�����������������������õĹ��ߣ����� Spyder IDE�����ɿ����������� IPython �ն˵ȣ���Щ��Ϊ���ݿ�ѧ���ṩ�˿��伴�õ�һվʽ���������
��Ч�İ�������Conda �������Թ��� Python �������ܹ����� Python ����������R������ذ��� C/C++ �������ȡ�Conda �ܹ����ܵؽ�����ӵ�����������ϵ��ȷ�����п�����������ȷ��װ��Ðͬ���������������˿���Ч�ʡ�
��ƽ̨֧�֣�Anaconda ֧�� Windows��Linux �� MacOS �ȶ��ֲ���ϵͳ�������ڲ�ͬ�Ŀ���ƽ̨��ͳһʹ�úͲ���
https://www.anaconda.com/download/success
����anaconda�Ĺ������ص�ַ
����Ҫע��python�İ汾��������������һ�£��������֮���������õĻ��ȴ�һ�������������ˡ�
������Ϻ󣬴�exe���а�װ
���ﰲװʱ����ܻ��һЩ��������ĵȴ�һ����ɡ�
ȷʵ�������õ�ʱ��ģ������������ˣ����ܴ�����15-20�������Ұɣ�ǧ��������ڰ�װ�ɹ���
��ʱ�����������鿴���Dz��еģ���Ϊû�����û�������
�Դ˵�����ҵĵ���=> �Ҽ�����=>�߼�ϵͳ����=>��������=> Path =>�à¼
����������·�����ӵ� Path��ȥ
ע���滻����İ�װ·��
D:\ProgramData\anaconda3
D:\ProgramData\anaconda3\Scripts
D:\ProgramData\anaconda3\Library\mingw-w64\bin
D:\ProgramData\anaconda3\Library\usr\bin
D:\ProgramData\anaconda3\Library\bin
�������ȷ��֮������������������
����˵�������İ�װ�ɹ��ˣ����������������ʹ��
// �鿴�汾
conda -V
// �鿴��װ����Щ��
conda list
//�鿴��ǰ������Щ���⻷��
conda env list �� conda info -e
//�����µ�ǰconda
conda update conda
// ʹ��conda��װpython����
conda install xxxx
��Ϊ��֮ǰ�����ϰ�װ�ľ���3.11.2�İ汾������������ֱ�Ӽ���ָ��python�汾Ϊ3.11.2
conda create -n python3112 python=3.11.2
��ʱ���Բ鿴window������ӵ����Щ���⻷��
conda env list
�����
conda activate python3112
�״�ִ����������������Ҫʹ��
conda init
,ִ����Ϻ�رյ�ǰshell�ű���������´�ִ�м����������
�˳����⻷��
conda deactivate
ע�⣺����������ֱ����CMD��ʹ�õ�����������������git bash������conda�Ļ�
echo ". /d/ProgramData/anaconda3/etc/profile.d/conda.sh" >>~/.profile
�����滻���Լ��İ�װĿ¼��ִ�����֮�󣬹ر�����ڣ����´�һ���µı����ִ�� conda������
conda��װ�ɹ�֮�󣬰�װ��������ʹ��conda �����Ͳ�Ҫʹ��pip��
��ʼʹ���˼����conda,�о�������
����ʹ�� cmd ���������� nvidia-smi ���ڵ�һ�����ұ߿��Կ���CUDA�İ汾�ţ��ҵİ汾��12.3
https://pytorch.org/get-started/locally/
����ַѡ��һ���ȽϿ����İ汾
����ѡ������������Ϊ
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
����п�ס�Ŀ��ܾ��������������ˣ�����ֱ�ӵ�����Դ�������ذ�װ https://download.pytorch.org/whl/torch_stable.html
����Ҳ��Ҫ������ĵȴ�Ӵ����ΪPytorch �İ�װ�����Dz�С�ġ�
���һ���������done�������װ�ɹ��ˣ�Ȼ����������������pip list����Կ���torch��صİ�����װ��
CUDA��ʲô��CUDA��NVIDIA�Ƴ���һ�ֱ�̼�����������������ʹ��C��������д����NVIDIA��ͼ�δ����������еĴ��롣ͨ��CUDA�������߿��Խ�GPU����ͨ�õIJ��м��㣬�������˼���Ч�ʡ�
CUDA��һ����Ҫ�ص��ǣ�����������������ֱ��ʹ��NVIDIA��GPU��ִ��ijЩ�����ܼ��͵�����������ΪGPU�ڲ������ಢ�д�����Ԫ������ͬʱִ������������񣬴Ӷ��������˼����ٶȡ�
���⣬CUDA���ṩ��һ�������Ŀ����������������������������������ܷ�������ʹ�ÿ����߿��Ը�����ؿ������Ż�CUDA����
������ֱ����֤CUDA�Ƿ���ã�ֱ�Ӽ��������������� python
import torch
torch.cuda.is_available()
������Ϊtrue���������ʹ��GPU�Կ���
import whisper
from whisper.utils import get_writer
import os
import time
import torch
import os #����OS
from faster_whisper import WhisperModel
import whisperx
import gc
def whisperx_test():
device = "cpu"
model_size = "large-v3"
audio_file = "test.mp4"
batch_size = 16
compute_type = "int8"
# widnow CPU
model = whisperx.load_model("large-v3", device, compute_type=compute_type)
# window GPU
# model = whisperx.load_model("large-v3", "cuda", compute_type="float16")
audio = whisperx.load_audio(audio_file)
result = model.transcribe(audio, batch_size=batch_size)
print(result["segments"])
def faster_whisper_test():
model_size = "large-v3"
## window cpu
model = WhisperModel(model_size, device="cpu", compute_type="int8", cpu_threads=16)
# window gpu
# model = WhisperModel(model_size, device="cuda", compute_type="float16")
segments, info = model.transcribe("test.mp4", beam_size = 5)
print("Detected language '%s' with probability %f" % (info.language, info.language_probability))
for segment in segments:
print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))
def whisper_test():
os.environ['KMP_DUPLICATE_LIB_OK'] = 'TRUE'
filename = "test.mp4"
## window GPU cuda
## window CPU cpu
## mac CPU cpu
## mac GPU
model = whisper.load_model("large-v3",device="cuda")
result = model.transcribe(audio=filename, fp16 =False)
output_directory = "."
word_options = {
"highlight_words": True,
"max_line_count": 50,
"max_line_width": 3
}
srt_writer = get_writer("srt", output_directory)
srt_writer(result, filename, word_options)
if __name__ == "__main__":
# print(torch.cuda.is_available())
start_time = time.time() # ��ʼʱ��
print("start time:", start_time)
# whisper_test()
# faster_whisper_test()
whisperx_test()
end_time = time.time() # ����ʱ��
print("Execution time: ", end_time - start_time, "seconds")
������Դ��Ŀ�ĵ�ַ�ֱ��ǣ�
���ݴ���Ҫ���а�װ����,Ҳ���Ҵ�������Դ��Ŀ��readme�п����ҵ���װ����������
// ��װopenai-whisper
pip install -U openai-whisper --user
//����
pip install --upgrade --no-deps --force-reinstall git+https://github.com/openai/whisper.git
// ��װfaster-whisper
pip install faster-whisper
//����
pip install git+https://github.com/openai/whisper.git
//��װwhisperx
pip install git+https://github.com/m-bain/whisperx.git
//������к󣬿���ffmpeg not found
Ҫ�ǵð�װһ��ffmpeg
��Ȼ�����pipҲ���Ի���conda
׼������������
���ݲ����������ע��������������,�������������������
python main.py
�������ȸ����ҵĵ������ã���ʵ�DZȽ�һ���
û���в��Ե�ʱ��GPU��ռ����ʵ���ٵģ����һ��������GPU���ԾͿ��Կ�����ͼ��ʾ��GPU�ڴ�ռ��
������GPU���е�����£��Ҳ���������
window-whisper-GPU:����ƽ��150��
ͬ������ʹ��CPU������£�����������
���������GPU�Կ����Ƿdz�һ��ģ���Ȼû��CPU�Ŀ�
window-whisper-CPU:����ƽ��100��
ͬ�������ν��в��Դ���Ҳ����50�����ң���GPU������£��ڴ�ռ�þ�Ȼ��whisper�����˽�һ�룬�ѵ��ٶ�Ҳ������һ����
window-faster-whisper-GPU: ����ƽ��50������
û�뵽����������ٶȣ����Ҳ�ֹһ�룬�治��
ͬ����CPU�ӽ�100%�ˣ������ڴ�����Ô�����˲��һ��
window-faster-whisper-CPU: ����ƽ��50������
GPU ��������
window-whisperX-GPU: ����ƽ��36������
CPU ��������
window-faster-whisperX-CPU: ����ƽ��43������
û�뵽����whisperx��faster-whisper�Ļ����ϻ�������
�������������mac�ϲ��ԣ����ֳ���openai��whisper����CPU�����У��������������������⣬����Ҳ�����Լ��������
mac-openai-whisper-CPU:����50������
������Mac M1 Pro�����IJ���
��ֻ�ǽ��м򵥵IJ�������һ���Աȡ�mac��CPU���Ƿdz�ǿ��ģ���Ȼ�˼۸�Ҳ���������
��������Ե�ʱ��Ҳû�н��й���IJ�����������ʱ��Ļ����Խ��б��� int8��float16��float32�ȵ������Ķ���������ݡ�
�����������л���������������������Դģ��
ʹ��Blender���ɳ���ģ��
�Ķ�ȫ����������ERA5�����ط���
�Ķ�Xpath���������﷨
�Ķ�����ѧϰ�������繹�����£�
�Ķ���ΪMateƷ��ʢ�䣺HarmonyOS NEXT�ӳ�����Ϸ���ܵõ�����ͷ�
�Ķ�ʵ�ֶ��󼯺���DataTable���໥ת��
�Ķ�Ӳ�̵Ļ���֪ʶ��ѡ��ָ��
�Ķ�������й��ƶ��ı�ͼ��ײ�
�Ķ�����NEXTԪ�����������ѿ����ϼ���Ʒ
�Ķ��ᳲ���С������������Ƽ��رշ���
�Ķ������ArcMap�����н���դ��ͼ���ز�������
�Ķ��㷨�����ݽṹ 1 - ģ��
�Ķ���Ѷ�����߿ͷ���Ӫ��ϵͳ����
�Ķ���Ѷ��Ƶҹ��ģʽ���ý̳�
�Ķ����ں���NEXT��Ѫ���Ŵ���������������
�Ķ�5. Spring Cloud OpenFeign ����ʽ WebService �ͻ��˵ij���ϸʹ��
�Ķ�Java����ģʽ����̬�����Ͷ�̬�����ĶԱȷ���
�Ķ�Win11�ʼDZ����Զ�����Ӧ�õ���ɫ����ʾ����
�Ķ�˼�� V1.5.6 ��׿��
��ս�귨 V7.5.0 ��׿��
У��������������׵������� V1.0 ��׿��
��˸֮�� V1.9.7 ��׿��
������Ե����� v1.0.4 ��׿��
������֮ŠV5.2.3 ��׿��
��������������Դ V1.0 ��׿��
���֮Ϣ V1.0 ��׿��
��ħ������������䣩 V1.0 ��׿��
���ں�������ϵ�����������������վ�����������������Ƽ�����
Ƶ�� ����Ƶ��������ר������������׿�������app����
�Ƽ� ��Ô���������°��������ܿ������ز���
���� ����ɫ������������ ���������ս������������
ɨ��ά�����������ֻ��汾��
ɨ��ά����������΢�Ź��ںţ�
��վ�������������������ϴ��������ַ���İ�Ȩ���뷢�ʼ�[email protected]
��ICP��2022002427��-10 �湫��������43070202000427��© 2013~2025 haote.com ������