Instructions to use kmrabby/crisp with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kmrabby/crisp with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="kmrabby/crisp")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq processor = AutoProcessor.from_pretrained("kmrabby/crisp") model = AutoModelForSpeechSeq2Seq.from_pretrained("kmrabby/crisp", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 1,091 Bytes
6459e91 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | def adjust_pauses_for_hf_pipeline_output(pipeline_output, split_threshold=0.12):
"""
Adjust pause timings by distributing pauses up to the threshold evenly between adjacent words.
"""
adjusted_chunks = pipeline_output["chunks"].copy()
for i in range(len(adjusted_chunks) - 1):
current_chunk = adjusted_chunks[i]
next_chunk = adjusted_chunks[i + 1]
current_start, current_end = current_chunk["timestamp"]
next_start, next_end = next_chunk["timestamp"]
pause_duration = next_start - current_end
if pause_duration > 0:
if pause_duration > split_threshold:
distribute = split_threshold / 2
else:
distribute = pause_duration / 2
# Adjust current chunk end time
adjusted_chunks[i]["timestamp"] = (current_start, current_end + distribute)
# Adjust next chunk start time
adjusted_chunks[i + 1]["timestamp"] = (next_start - distribute, next_end)
pipeline_output["chunks"] = adjusted_chunks
return pipeline_output
|