convert whisper-small.pt to hugging face

53 Views Asked by At

I took this script on transformers/src/transformers/models/whisper /convert_openai_to_hf.py: https://github.com/huggingface/transformers/blob/main/src/transformers/models/whisper/convert_openai_to_hf.py

import argparse
import io
import json
import os
import tempfile
import urllib
import warnings
from typing import Any, Optional, Tuple

import torch
from huggingface_hub.utils import insecure_hashlib
from torch import nn
from tqdm import tqdm

I have installed all the dependencies but when I try to load I have an error this script help to convert the whisper-small.pt model please can someone help me to find the command line exactly that will execute this script I tried this command line but nothing work:

python3 src/transformers/models/whisper/convert_openai_to_hf.py --checkpoint_path "whisper-small.pt" --pytorch_dump_folder_path "openai/whisper-small" --convert_preprocessor True

the error I encounter:

Traceback (most recent call last):
  File "/Users/sophie/Desktop/small/convert_openai_to_hf.py", line 344, in <module>
    model, is_multilingual, num_languages = convert_openai_whisper_to_tfms(
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sophie/Desktop/small/convert_openai_to_hf.py", line 194, in convert_openai_whisper_to_tfms
    original_checkpoint = torch.load(checkpoint_path, map_location="cpu")
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sophie/Desktop/small/appenv/lib/python3.11/site-packages/torch/serialization.py", line 993, in load
    with _open_zipfile_reader(opened_file) as opened_zipfile:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sophie/Desktop/small/appenv/lib/python3.11/site-packages/torch/serialization.py", line 447, in __init__
    super().__init__(torch._C.PyTorchFileReader(name_or_buffer))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: PytorchStreamReader failed reading zip archive: unsupported multidisk archive
0

There are 0 best solutions below