MahmoudAshraf97 / whisper-diarization

Automatic Speech Recognition with Speaker Diarization based on OpenAI Whisper
BSD 2-Clause "Simplified" License
2.53k stars 243 forks source link

---Installation and run Instructions which worked for me---- #107

Open manjunath7472 opened 9 months ago

manjunath7472 commented 9 months ago

Hi there, Below are the steps to make it work in windows. 1.Download repo. 2.Inside repo create a python venv. 3.Download and run vs_buildtools.exe from below link. download 4.Go to individual components and check MSVCv143 c++ x64/x86 build tools MSVCv140 c++ x64/x86 build tools windows 10 SDK (latest) 5.activate venv. 6.pip install Cython. 7.pip install -r requirements.txt.

8.If your using .ipynb file, then remove lines in transcribe cell. del whisper_model torch.cuda.empty_cache()

  1. update definition "_get_next_start_timestamp"
def _get_next_start_timestamp(word_timestamps, current_word_index):
        # if current word is the last word
        if current_word_index == len(word_timestamps) - 1:
            return word_timestamps[current_word_index]["start"]
        next_word_index = current_word_index + 1
        while current_word_index < len(word_timestamps) - 1:
            if word_timestamps[next_word_index].get("start") is None:
                # if next word doesn't have a start timestamp
                # merge it with the current word and delete it
                if word_timestamps[next_word_index]["word"] is not None:

                    word_timestamps[current_word_index]["word"] += (
                        " " + str(word_timestamps[next_word_index]["word"])
                    )
                    word_timestamps[next_word_index]["word"] = None
                    next_word_index += 1
                else:                
                    next_word_index += 1
            else:
                return word_timestamps[next_word_index]["start"]
manjunath7472 commented 9 months ago

Thank you Ashraf for pipeline! It's good. As matter of fact am not using Realigning speech segments with punctuation. it is breaking whole purpose of diarization as it is merging chats. Otherwise its good.

MahmoudAshraf97 commented 9 months ago

Thanks @manjunath7472 for your words, the function modification that you provided is not necessary as the if condition is always evaluated to True, also word_timestamps[next_word_index]["word"] is always a string so no conversion needed

manjunath7472 commented 9 months ago

But for me i got None as value for word_timestamps[next_word_index]["word"] at one instance some where.

MahmoudAshraf97 commented 9 months ago

that was already fixed in a recent commit, please pull the latest code

manjunath7472 commented 9 months ago

oh ok cool. I ll take. Thank you.

gallojorge commented 9 months ago

install venv in the python 3.10