Automatic Speech Recognition
Transformers
PyTorch
TensorFlow
JAX
ONNX
Safetensors
whisper
audio
asr
hf-asr-leaderboard
Instructions to use NbAiLab/nb-whisper-medium-beta with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NbAiLab/nb-whisper-medium-beta with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="NbAiLab/nb-whisper-medium-beta")# Load model directly from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq processor = AutoProcessor.from_pretrained("NbAiLab/nb-whisper-medium-beta") model = AutoModelForSpeechSeq2Seq.from_pretrained("NbAiLab/nb-whisper-medium-beta", device_map="auto") - Notebooks
- Google Colab
- Kaggle
| pip install optimum[exporters] tensorflow | |
| python << END | |
| from transformers import WhisperForConditionalGeneration, TFWhisperForConditionalGeneration, WhisperTokenizerFast | |
| tokenizer = WhisperTokenizerFast.from_pretrained("./") | |
| print("Saving model to PyTorch...", end=" ") | |
| model = WhisperForConditionalGeneration.from_pretrained("./", from_flax=True) | |
| model.save_pretrained("./", safe_serialization=True) | |
| model.save_pretrained("./") | |
| print("Done.") | |
| print("Saving model to TensorFlow...", end=" ") | |
| tf_model = TFWhisperForConditionalGeneration.from_pretrained("./", from_pt=True) | |
| tf_model.save_pretrained("./") | |
| print("Done.") | |
| print("Saving model to ONNX...", end=" ") | |
| from optimum.onnxruntime import ORTModelForSpeechSeq2Seq | |
| ort_model = ORTModelForSpeechSeq2Seq.from_pretrained("./", export=True) | |
| ort_model.save_pretrained("./onnx") | |
| print("Done") | |
| tokenizer.save_pretrained("./") | |
| END | |
| echo "Saving model to GGML (whisper.cpp)" | |
| wget -O convert-h5-to-ggml.py "https://raw.githubusercontent.com/ggerganov/whisper.cpp/94aa56f19eed8b2419bc5ede6b7fda85d5ca59be/models/convert-h5-to-ggml.py" | |
| mkdir -p whisper/assets | |
| wget -O whisper/assets/mel_filters.npz "https://github.com/openai/whisper/raw/55237228425e39828bbb964fd7bf774c9962eb67/whisper/assets/mel_filters.npz" | |
| python ./convert-h5-to-ggml.py ./ ./ ./ | |
| rm ./convert-h5-to-ggml.py | |
| rm -rf ./whisper |