Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files25 unmodified lines2627282930313225 unmodified linesRESULTS=Path(tempfile.gettempdir())/'trailer_srt_results';RESULTS.mkdir(parents=True,exist_ok=True)torch.set_num_threads(min(2,os.cpu_count() or 1))print('Preparing speech models (first startup downloads model weights).',flush=True)PRIMARY=whisper.load_model('tiny.en' if TEST else 'turbo',device='cpu' if TEST else 'cuda',download_root=str(CACHE))engine._RETRY_MODEL=whisper.load_model('tiny.en' if TEST else 'small.en',device='cpu',download_root=str(CACHE))print('Speech models ready.',flush=True)25 unmodified lines262728293031323334353625 unmodified linesRESULTS=Path(tempfile.gettempdir())/'trailer_srt_results';RESULTS.mkdir(parents=True,exist_ok=True)torch.set_num_threads(min(2,os.cpu_count() or 1))print('Preparing speech models (first startup downloads model weights).',flush=True)PRIMARY=whisper.load_model('tiny.en' if TEST else 'turbo',device='cpu',download_root=str(CACHE))# ZeroGPU cannot virtualize sparse buffers. Whisper's alignment-head mask# is indexing metadata, not model weights: keep it unregistered on CPU.PRIMARY.alignment_heads=PRIMARY._buffers.pop('alignment_heads')if not TEST:PRIMARY=PRIMARY.to('cuda')engine._RETRY_MODEL=whisper.load_model('tiny.en' if TEST else 'small.en',device='cpu',download_root=str(CACHE))print('Speech models ready.',flush=True)
app.py+5-1