error :

ubuntu@ubuntu-virtual-machine:~/Downloads$ python3 transcribe.py
/home/ubuntu/.local/lib/python3.10/site-packages/pyannote/audio/core/io.py:43: UserWarning: torchaudio._backend.set_audio_backend has been deprecated. With dispatcher enabled, this function is no-op. You can remove the function call.
  torchaudio.set_audio_backend("soundfile")
/home/ubuntu/.local/lib/python3.10/site-packages/pyannote/audio/pipelines/speaker_verification.py:43: UserWarning: torchaudio._backend.get_audio_backend has been deprecated. With dispatcher enabled, this function is no-op. You can remove the function call.
  backend = torchaudio.get_audio_backend()
INFO:speechbrain.utils.quirks:Applied quirks (see `speechbrain.utils.quirks`): [disable_jit_profiling, allow_tf32]
INFO:speechbrain.utils.quirks:Excluded quirks specified by the `SB_DISABLE_QUIRKS` environment (comma-separated list): []
/home/ubuntu/.local/lib/python3.10/site-packages/pyannote/audio/pipelines/speaker_verification.py:45: UserWarning: Module 'speechbrain.pretrained' was deprecated, redirecting to 'speechbrain.inference'. Please update your script. This is a change from SpeechBrain 1.0. See: https://github.com/speechbrain/speechbrain/releases/tag/v1.0.0
  from speechbrain.pretrained import (
/home/ubuntu/.local/lib/python3.10/site-packages/pyannote/audio/pipelines/speaker_verification.py:53: UserWarning: torchaudio._backend.set_audio_backend has been deprecated. With dispatcher enabled, this function is no-op. You can remove the function call.
  torchaudio.set_audio_backend(backend)
/home/ubuntu/.local/lib/python3.10/site-packages/pyannote/audio/tasks/segmentation/mixins.py:37: UserWarning: `torchaudio.backend.common.AudioMetaData` has been moved to `torchaudio.AudioMetaData`. Please update the import path.
  from torchaudio.backend.common import AudioMetaData

Processing with base model...
Error processing base: Requested float16 compute type, but the target device or backend do not support efficient float16 computation.

Processing with base.en model...
Error processing base.en: Requested float16 compute type, but the target device or backend do not support efficient float16 computation.

Processing with small model...
Error processing small: Requested float16 compute type, but the target device or backend do not support efficient float16 computation.

Processing with small.en model...
Error processing small.en: Requested float16 compute type, but the target device or backend do not support efficient float16 computation.

Processing with medium model...
config.json: 100%|█████████████████████████| 2.26k/2.26k [00:00<00:00, 7.41MB/s]
tokenizer.json: 100%|██████████████████████| 2.20M/2.20M [00:01<00:00, 1.80MB/s]
vocabulary.txt: 100%|█████████████████████████| 460k/460k [00:00<00:00, 614kB/s]
model.bin: 100%|███████████████████████████| 1.53G/1.53G [02:57<00:00, 8.62MB/s]
Error processing medium: Requested float16 compute type, but the target device or backend do not support efficient float16 computation.

Processing with medium.en model...
config.json: 100%|█████████████████████████| 2.64k/2.64k [00:00<00:00, 10.7MB/s]
vocabulary.txt: 100%|████████████████████████| 422k/422k [00:00<00:00, 3.20MB/s]
tokenizer.json: 100%|██████████████████████| 2.13M/2.13M [00:00<00:00, 4.32MB/s]
model.bin: 100%|███████████████████████████| 1.53G/1.53G [02:55<00:00, 8.69MB/s]
Error processing medium.en: Requested float16 compute type, but the target device or backend do not support efficient float16 computation.

All processing complete! Check the whisperx_outputs directory for results.
ubuntu@ubuntu-virtual-machine:~/Downloads$ 

code :

import whisperx
import os
from datetime import datetime
import time
import torch

# Path to your audio file
audio_path = os.path.expanduser("~/Downloads/audio.mp3")

# Create main output directory
output_base_dir = "whisperx_outputs"
os.makedirs(output_base_dir, exist_ok=True)

# Function to transcribe and save results
def transcribe_with_model(model_name, device="cpu"):
    print(f"\nProcessing with {model_name} model...")
    start_time = time.time()
    
    # Create model-specific directory
    model_dir = os.path.join(output_base_dir, model_name)
    os.makedirs(model_dir, exist_ok=True)
    
    # Load model and transcribe
    model = whisperx.load_model(model_name, device=device)
    
    # Ensure model is using float32
    model.model.to(torch.float32)
    
    # Load and convert audio to float32
    audio = whisperx.load_audio(audio_path)
    audio = torch.tensor(audio, dtype=torch.float32)
    
    # Transcribe with float32
    result = model.transcribe(audio)
    
    # Save output
    timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
    output_file = os.path.join(model_dir, f"transcript_{timestamp}.txt")
    
    with open(output_file, 'w', encoding='utf-8') as f:
        f.write(result["text"])
    
    end_time = time.time()
    print(f"{model_name} processing time: {end_time - start_time:.2f} seconds")
    print(f"Output saved to: {output_file}")

# Process with all models including medium and medium.en
models = ["base", "base.en", "small", "small.en", "medium", "medium.en"]

for model_name in models:
    try:
        transcribe_with_model(model_name)
    except Exception as e:
        print(f"Error processing {model_name}: {e}")

print("\nAll processing complete! Check the whisperx_outputs directory for results.")