我有一个按时间顺序排序的事件数据集。我使用熊猫数据框。这是数据框的样子:
Time Event Location ID
2020-05-22 21:22:04.784622 start UK 50
2020-05-22 21:43:07.060629 end UK 50
2020-05-25 23:22:04.784622 start UK 50
2020-05-25 23:43:07.060629 end UK 50
2020-05-25 23:44:15.000566 start US 30
2020-05-25 23:48:23.416348 start Italy 70
2020-05-26 00:48:06.820164 end US 30
2020-05-26 01:33:42.454450 end Italy 70
2020-05-27 20:48:23.416348 start Italy 30
2020-05-27 00:33:42.454450 end Italy 30
etc
Run Code Online (Sandbox Code Playgroud)
这就是我想要的:
Start_Time End_Time Location ID
2020-05-22 21:22:04.784622 2020-05-22 21:43:07.060629 UK 50
2020-05-25 23:22:04.784622 2020-05-25 23:43:07.060629 UK 50
2020-05-25 23:44:15.000566 2020-05-26 00:48:06.820164 US 30
2020-05-25 …Run Code Online (Sandbox Code Playgroud) tldr:我的假设是否正确torch.cuda.init(),device = "cuda"并且result = model.transcribe(etc)应该足以强制使用 GPU?
我检查了几个论坛帖子,但找不到解决方案。抱歉,如果这很愚蠢。我也在耳语 git 上发帖,但也许它不是耳语特定的。
简而言之,这是我的 python 脚本:
import whisper
import soundfile as sf
import torch
# specify the path to the input audio file
input_file = "H:\\path\\3minfile.WAV"
# specify the path to the output transcript file
output_file = "H:\\path\\transcript.txt"
# Cuda allows for the GPU to be used which is more optimized than the cpu
torch.cuda.init()
device = "cuda" # if torch.cuda.is_available() else "cpu"
# Load audio file
audio_data, …Run Code Online (Sandbox Code Playgroud)