-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export distilled whisper to TFLite #26
Comments
I have not tried converting Distilled Whisper to TFLite |
Just setting all the paths to import tensorflow as tf
from datasets import load_dataset
from transformers import WhisperProcessor, WhisperFeatureExtractor, TFWhisperForConditionalGeneration, WhisperTokenizer
feature_extractor = WhisperFeatureExtractor.from_pretrained("distil-whisper/distil-small.en")
tokenizer = WhisperTokenizer.from_pretrained("distil-whisper/distil-small.en", predict_timestamps=False)
processor = WhisperProcessor(feature_extractor, tokenizer)
model = TFWhisperForConditionalGeneration.from_pretrained("distil-whisper/distil-small.en")
# Loading dataset
ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
inputs = feature_extractor(
ds[0]["audio"]["array"], sampling_rate=ds[0]["audio"]["sampling_rate"], return_tensors="tf"
)
input_features = inputs.input_features
# Generating Transcription
generated_ids = model.generate(input_features=input_features)
print(generated_ids)
transcription = processor.tokenizer.decode(generated_ids[0])
print(transcription)
model.save('/content/tf_whisper_saved') surprisingly works @nyadla-sys. We tried the same |
@mikel-brostrom Good work, Could you post generated Distiled whisper small tflite model via google drive link ? |
Have you tried the TFLite export notebook on Distilled Whisper (https://github.com/huggingface/distil-whisper)? I modified the script like this:
I am not sure if the same tokenizer as for regular whisper can be used... Anyways, this piece of code crashes:
Any idea on how to get a successful distilled whisper export?
The text was updated successfully, but these errors were encountered: