EtienneAb3d / WhisperHallu

Experimental code: sound file preprocessing to optimize Whisper transcriptions without hallucinated texts
281 stars 22 forks source link

Can't load Whisper model: large #14

Closed MX-05 closed 1 year ago

MX-05 commented 1 year ago

Good eavening, i was trying to run whisper hallu on my computer but the program rais me this exeption: Can't load Whisper model: large

this is my code:

from transcribeHallu import loadModel
from transcribeHallu import transcribePrompt

import argparse
import os

#### ARGUMENTS
parser = argparse.ArgumentParser()

parser.add_argument('-i', '--input', help="input audio file")
parser.add_argument('-o', '--output', help="output directory (by default is the input dir)")
parser.add_argument('-lng', '--lenguage', help="audio input lenguage (by default is it)")

args = vars(parser.parse_args())

##### The audio language may be different from the one for the output transcription.
path=args["input"]
if not path:
    raise Exception("Missing audio input parameter, use -h for more info")

if not args["output"]:
    out_path = os.path.split(args["input"])[0]
else:
    out_path = args["output"]

if not args["lenguage"]:
    lngInput="it"
else:
    lngInput=args["lenguage"]

##### Activate this for music file to get a minimal processing
isMusic=False

##### Need to be adapted for each language.
##### For prompt examples, see transcribeHallu.py getPrompt(lng:str)
lng=lngInput
prompt= "Whisper, Ok. "\
    +"A pertinent sentence for your purpose in your language. "\
    +"Ok, Whisper. Whisper, Ok. "\
    +"Ok, Whisper. Whisper, Ok. "\
    +"Please find here, an unlikely ordinary sentence. "\
    +"This is to avoid a repetition to be deleted. "\
    +"Ok, Whisper. "

##### Model size to use
if lngInput == "it":
    modelSize = "large"
else:
    modelSize="medium"

loadModel("0",modelSize=modelSize)

result = transcribePrompt(path=path, lng=lng, lngInput=lngInput,isMusic=isMusic)

i checked if the model was in the correct path, and it was. I'm on windows 10, and i am using faster-whisper

MX-05 commented 1 year ago

UPDATE: i tryed to reinstall CUDA on my pc but it doesn't worked. So i thought that my invidia graphic card could be obsolate.

i'm using INVIDIA geforce 610M, the last driver for this card is realised on 2018, is it compatible?

EtienneAb3d commented 1 year ago

@MX-05 Your card is really too small, and certainly too old. See the required VRAM for each model here: https://github.com/openai/whisper#available-models-and-languages

You may try to use Whisper with CPU calculation, but it will be very slow.