m-bain / whisperX

WhisperX: Automatic Speech Recognition with Word-level Timestamps (& Diarization)
BSD 2-Clause "Simplified" License
11.49k stars 1.21k forks source link

Stuck on load_model() #656

Closed dgoryeo closed 8 months ago

dgoryeo commented 8 months ago

It appears that whipserX has stopped working on Google Colab. The code does not pass beyond load_model(). Here is my code:


import whisperx
import gc 

device = "cuda" 
audio_file = "/content/drive/MyDrive/0.original.S01E04-sc4.wav3"
batch_size = 16
compute_type = "float16" 

# 1. Transcribe with original whisper (batched)
model = whisperx.load_model("large-v2", device, compute_type=compute_type)
audio = whisperx.load_audio(audio_file)
result = model.transcribe(audio, batch_size=batch_size)
print(result["segments"]) # before alignment

My installation environment is: !pip install --no-cache-dir torch==2.0.0 torchvision==0.15.1 torchaudio==2.0.1 torchtext torchdata --index-url https://download.pytorch.org/whl/cu118

Colab execution notification on the line [model = whisperx.load_model("large-v2", device, compute_type=compute_type) ]that it is stuck on:


Executing (12m 35s)   <cell line: 10>
navigate_next
 load_model()
navigate_next
 __init__()
navigate_next
 download_model()
navigate_next
 _inner_fn()
navigate_next
 snapshot_download()
navigate_next
 _inner_fn()
navigate_next
 repo_info()
navigate_next
 _inner_fn()
navigate_next
 model_info()
navigate_next
 _build_hf_headers()
navigate_next
 _inner_fn()
navigate_next
 build_hf_headers()
navigate_next
 get_token_to_send()
navigate_next
 get_token()
navigate_next
 _get_token_from_google_colab()
navigate_next
 get()
navigate_next
 blocking_request()
navigate_next
 read_reply_from_input()

I think this happend after a recent upgrade of Google Colab: Upgrade to Colab

anjehub commented 8 months ago

I'm experiencing the same issue, it just gets stuck 'forever' on the whisperx.load_model("large-v2", device, compute_type=compute_type) line.

My installation environment:

!pip install torch==2.0.0 torchaudio==2.0.1
!pip install git+https://github.com/m-bain/whisperx.git
iUnknownAdorn commented 8 months ago

+1 - facing the same issue

Quick fix:

from huggingface_hub.utils import _runtime
_runtime._is_google_colab = False

Don't know if something else will break if you are doing something colab dependent, but you can always turn on the flag after model is downloaded.

Related: https://github.com/huggingface/huggingface_hub/issues/1952

vietanhlampartvn commented 8 months ago

@iUnknownAdorn

Quick fix:

from huggingface_hub.utils import _runtime
_runtime._is_google_colab = False

It worked, thank you very much👼👼👼

dgoryeo commented 8 months ago

@iUnknownAdorn , thanks so much for the fix. It worked like a charm and no other issues so far.