Instructions to use slplab/whisper-large_v2_test with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use slplab/whisper-large_v2_test with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="slplab/whisper-large_v2_test")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq processor = AutoProcessor.from_pretrained("slplab/whisper-large_v2_test") model = AutoModelForSpeechSeq2Seq.from_pretrained("slplab/whisper-large_v2_test", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download handler.py from slplab/whisper-large_v2_test: direct link, hf CLI and curl.
- Browser
- Download file 674 Bytes
-
https://huggingface.co/slplab/whisper-large_v2_test/resolve/main/handler.py
- Command line
-
hf download hf://slplab/whisper-large_v2_test/handler.py
-
curl -L -o handler.py https://huggingface.co/slplab/whisper-large_v2_test/resolve/main/handler.py
674 Bytes
| from typing import Dict, Any, List | |
| from transformers import pipeline | |
| import torch | |
| #### USE of PIPELINE | |
| device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") | |
| class EndpointHandler: | |
| def __init__(self, path=""): | |
| self.pipe = pipeline(task='automatic-speech-recognition', model=path, device=device) | |
| def __call__(self, data: Any) -> List[Dict[str, str]]: | |
| inputs = data.pop("inputs", data) | |
| transcribe = self.pipe | |
| transcribe.model.config.forced_decoder_ids = transcribe.tokenizer.get_decoder_prompt_ids(language="ko", task="transcribe") | |
| result = transcribe(inputs) | |
| return result |