Instructions to use marinone94/whisper-tiny-sv with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use marinone94/whisper-tiny-sv with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="marinone94/whisper-tiny-sv")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq processor = AutoProcessor.from_pretrained("marinone94/whisper-tiny-sv") model = AutoModelForSpeechSeq2Seq.from_pretrained("marinone94/whisper-tiny-sv", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download tests/test_setup.py from marinone94/whisper-tiny-sv: direct link, hf CLI and curl.
- Browser
- Download file 846 Bytes
-
https://huggingface.co/marinone94/whisper-tiny-sv/resolve/main/tests/test_setup.py
- Command line
-
hf download hf://marinone94/whisper-tiny-sv/tests/test_setup.py
-
curl -L -o test_setup.py https://huggingface.co/marinone94/whisper-tiny-sv/resolve/main/tests/test_setup.py
846 Bytes
| import torch | |
| from transformers import WhisperFeatureExtractor, WhisperForConditionalGeneration | |
| from datasets import load_dataset | |
| if torch.cuda.is_available(): | |
| device = torch.device("cuda") | |
| model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-tiny") | |
| feature_extractor = WhisperFeatureExtractor.from_pretrained("openai/whisper-tiny") | |
| common_voice = load_dataset("mozilla-foundation/common_voice_11_0", "en", split="validation", streaming=True) | |
| inputs = feature_extractor(next(iter(common_voice))["audio"]["array"], sampling_rate=16000, return_tensors="pt") | |
| input_features = inputs.input_features | |
| decoder_input_ids = torch.tensor([[1, 1]]) * model.config.decoder_start_token_id | |
| logits = model(input_features, decoder_input_ids=decoder_input_ids).logits | |
| print("Environment set up successful?", logits.shape[-1] == 51865) | |