88e07487ee
- Added generate_stream() method for token-by-token streaming - Added generate_and_play() method for real-time playback - Added decode_chunk() to ncodec codec - First audio chunk in ~180ms (390% faster than non-streaming) - Updated README with streaming documentation
12 lines
192 B
Python
12 lines
192 B
Python
import re
|
|
import gc
|
|
import torch
|
|
|
|
def split_text(text):
|
|
sentences = re.split(r'(?<=[.!?])\s+', text)
|
|
return sentences
|
|
|
|
def clear_cache():
|
|
gc.collect()
|
|
torch.cuda.empty_cache()
|