sunxiaoyi 1 year ago
parent
commit
3425ed2b0e
4 changed files with 6 additions and 3 deletions
  1. 1 1
      asr_task.py
  2. 1 1
      audio_process.py
  3. 3 0
      cuda_test.py
  4. 1 1
      whisper_asr.py

+ 1 - 1
asr_task.py

@@ -158,7 +158,7 @@ if __name__ == '__main__':
     if not os.path.exists(asr_folder):
         os.makedirs(asr_folder)
 
-    pool = multiprocessing.Pool(processes=1)
+    pool = multiprocessing.Pool(processes=2)
     for video_id in video_folder_list:
         pool.apply_async(
             func=get_asr,

+ 1 - 1
audio_process.py

@@ -7,7 +7,7 @@ config_ = set_config()
 def get_wav(video_path):
     """提取音频"""
     # 音频采样率设置为:2K
-    video = VideoFileClip(video_path, audio_fps=2000)
+    video = VideoFileClip(video_path, audio_fps=8000)
     # Extract the audio from the video
     audio = video.audio
     # Save the extracted audio to a file

+ 3 - 0
cuda_test.py

@@ -0,0 +1,3 @@
+import torch
+
+print(torch.cuda.device_count())

+ 1 - 1
whisper_asr.py

@@ -2,7 +2,7 @@ import whisper
 from zhconv import convert
 
 
-def get_whisper_asr(audio, model='base'):
+def get_whisper_asr(audio, model='medium'):
     try:
         model = whisper.load_model(model, device='cuda')
         result = model.transcribe(audio, language='Chinese')