{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"from transformers import WhisperTokenizer\nfrom transformers import WhisperProcessor\nfrom transformers import WhisperFeatureExtractor\nfrom transformers import WhisperForConditionalGeneration\nfrom tqdm.auto import tqdm\n","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-07-18T06:26:59.048481Z","iopub.execute_input":"2023-07-18T06:26:59.049392Z","iopub.status.idle":"2023-07-18T06:27:15.535582Z","shell.execute_reply.started":"2023-07-18T06:26:59.049344Z","shell.execute_reply":"2023-07-18T06:27:15.534371Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def save_whisper_model(model_path, path):\n    feature_extractor = WhisperFeatureExtractor.from_pretrained(model_path)\n    tokenizer = WhisperTokenizer.from_pretrained(model_path)\n    processor = WhisperProcessor.from_pretrained(model_path)\n    model = WhisperForConditionalGeneration.from_pretrained(model_path)\n    feature_extractor.save_pretrained(path)\n    tokenizer.save_pretrained(path)\n    processor.save_pretrained(path)\n    model.save_pretrained(path)","metadata":{"execution":{"iopub.status.busy":"2023-07-18T06:27:26.444561Z","iopub.execute_input":"2023-07-18T06:27:26.445120Z","iopub.status.idle":"2023-07-18T06:27:26.454825Z","shell.execute_reply.started":"2023-07-18T06:27:26.445075Z","shell.execute_reply":"2023-07-18T06:27:26.453317Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model_urls = ['openai/whisper-tiny', 'openai/whisper-small', 'openai/whisper-base', 'openai/whisper-medium', 'openai/whisper-large', 'openai/whisper-large-v2']\nmodel_paths = [i.split('/')[1] for i in model_urls]\nfor i,j in tqdm(zip(model_urls, model_paths)):\n    save_whisper_model(i,j)","metadata":{"execution":{"iopub.status.busy":"2023-07-18T06:27:28.469386Z","iopub.execute_input":"2023-07-18T06:27:28.469874Z"},"trusted":true},"execution_count":null,"outputs":[]}]}