m-bain / whisperX

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

Warning `Lightning automatically upgraded your loaded checkpoint from v1.5.4 to v2.1.0.` #538

Open flexchar opened 11 months ago

flexchar commented 11 months ago

Every time I load I get

Lightning automatically upgraded your loaded checkpoint from v1.5.4 to v2.1.0. To apply the upgrade to your files permanently, run `python -m pytorch_lightning.utilities.upgrade_checkpoint .cache/torch/whisperx-vad-segmentation.bin`

The project requirements list PyTorch version 2 so I'm confused. Running this command results in Python library not found. Any ideas?

flexchar commented 11 months ago

I actually managed to run the command. It had to be this python -m pytorch_lightning.utilities.upgrade_checkpoint /root/.cache/torch/whisperx-vad-segmentation.bin. But now I cannot load the model because of RuntimeError: Model has been downloaded but the SHA256 checksum does not not match. Please retry loading the model.. Frankly, my OCD is killing me more than the severity of this error actually is. But it'd be nice to hide it.

feliperafael commented 10 months ago

@flexchar in the file https://github.com/m-bain/whisperX/blob/dbeb8617f298bb4b5847d771bfb600379255c860/whisperx/vad.py#L46 there is a hash check of the loaded model.

I was able to trace the use of the function in the ASR where the parameters are sourced from load_model. Therefore, I believe that if you pass the segmentation model parameters in the load_model call along with vad_options, it will resolve this warning.

These are the default vad_options parameters (which are used when you don't specify any model):

default_vad_options = {
        "vad_onset": 0.500,
        "vad_offset": 0.363
}

I believe that to remove the warning you need to add:

my_vad_options = {
    "vad_onset": 0.500,
    "vad_offset": 0.363,
    "model_fp": "path/to/your-vad-segmentation.bin"
}

model = whisperx.load_model("large-v2", device, compute_type=compute_type, vad_options=my_vad_options)

Let me know if this helped you

Riley16 commented 10 months ago

I'm using whisperx with CPU only and am also getting the following notification upon loading whisperX models:

"Lightning automatically upgraded your loaded checkpoint from v1.5.4 to v2.1.0. To apply the upgrade to your files permanently, run python -m pytorch_lightning.utilities.upgrade_checkpoint ../../.cache/torch/whisperx-vad-segmentation.bin"

The update command

python -m pytorch_lightning.utilities.upgrade_checkpoint .cache/torch/whisperx-vad-segmentation.bin --map-to-cpu

runs (requires --map-to-cpu option if no GPU is available) but then it appears downloading the updated model no longer matches the model hash hard-coded here.

Should device mappings affect the model hashes? Can I safely comment out the hash checking lines?

feliperafael commented 10 months ago

@Riley16 Converting to the CPU is likely to affect the hash, as they are different data types (I believe float16 isn't supported on the CPU), and any changes in the binary values will alter the hash. As for removing the hash check comment, I don't anticipate any issues, as long as the model you intend to use is compatible with the rest of the code.

richginsberg commented 3 weeks ago

@flexchar in the file

https://github.com/m-bain/whisperX/blob/dbeb8617f298bb4b5847d771bfb600379255c860/whisperx/vad.py#L46

there is a hash check of the loaded model. I was able to trace the use of the function in the ASR where the parameters are sourced from load_model. Therefore, I believe that if you pass the segmentation model parameters in the load_model call along with vad_options, it will resolve this warning.

These are the default vad_options parameters (which are used when you don't specify any model):

default_vad_options = {
        "vad_onset": 0.500,
        "vad_offset": 0.363
}

I believe that to remove the warning you need to add:

my_vad_options = {
    "vad_onset": 0.500,
    "vad_offset": 0.363,
    "model_fp": "path/to/your-vad-segmentation.bin"
}

model = whisperx.load_model("large-v2", device, compute_type=compute_type, vad_options=my_vad_options)

Let me know if this helped you

I got into the bash shell of my docker container. executed the following command.

python3.11 -m lightning.pytorch.utilities.upgrade_checkpoint /root/.cache/torch/whisperx-vad-segmentation.bin verified the file bytes and md5 had changed

a799710614d12fa30bda9df676fdf60b ./whisperx-vad-segmentation.bin 17725130

copied back into my container via Dockerfile: COPY whisperx-vad-segmentation.bin /root/.cache/torch/whisperx-vad-segmentation.bin

Updated my code to

    custom_vad_checkpoint = {
        "vad_onset": 0.500,
        "vad_offset": 0.363,
        "model_fp": "/root/.cache/torch/whisperx-vad-segmentation.bin"
    }
    model = whisperx.load_model("large-v3", device, compute_type=compute_type, vad_options=custom_vad_checkpoint)

Then received the following error:

RuntimeError: Model has been downloaded but the SHA256 checksum does not not match. Please retry loading the model.

TemporalLabsLLC-SOL commented 2 days ago

I've been fighting this and resolved by completely clearing all folders from C:\Users{USERNAME}.cache