whisperX icon indicating copy to clipboard operation
whisperX copied to clipboard

Wrong cuda device (device_id > 0) on VAD in whisperx.load_model() method

Open grzegorz700 opened this issue 10 months ago • 0 comments

When we use whisperx.load_model(..., device='cuda', device_id=1), we get a quick peek at the wrong (cuda:0) GPU device instead of the desired one. The problem occurs due to different setups for the model and VAD (in the model, we split to device and device_id, but in VAD we use only device name).

https://github.com/m-bain/whisperX/blob/f2da2f858e99e4211fe4f64b5f2938b007827e17/whisperx/asr.py#L347

Bug visually:

whisperX-wrong-gpu

Possible solution:

if device == 'cuda' and device_id  and device_id> 0:
    device_vad = f"cuda:{device_id}"
else:
    device_vad = device
vad_model = load_vad_model(torch.device(device_vad), use_auth_token=None, **default_vad_options)

grzegorz700 avatar Apr 19 '24 16:04 grzegorz700