Spaces:
Runtime error
Runtime error
torch and chunk settings
Browse files
app.py
CHANGED
|
@@ -5,7 +5,6 @@ from datetime import datetime
|
|
| 5 |
from pathlib import Path
|
| 6 |
import tempfile
|
| 7 |
import pandas as pd
|
| 8 |
-
import accelerate
|
| 9 |
|
| 10 |
import gradio as gr
|
| 11 |
import yt_dlp as youtube_dl
|
|
@@ -34,7 +33,8 @@ model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
|
| 34 |
MODEL_NAME,
|
| 35 |
use_cache=False,
|
| 36 |
device_map="auto",
|
| 37 |
-
low_cpu_mem_usage=
|
|
|
|
| 38 |
)
|
| 39 |
|
| 40 |
# Flash Attention setup for memory and speed optimization if supported
|
|
@@ -56,7 +56,7 @@ pipe = pipeline(
|
|
| 56 |
model=model,
|
| 57 |
tokenizer=tokenizer,
|
| 58 |
feature_extractor=feature_extractor,
|
| 59 |
-
chunk_length_s=
|
| 60 |
)
|
| 61 |
|
| 62 |
def reset_and_update_dataset(new_data):
|
|
|
|
| 5 |
from pathlib import Path
|
| 6 |
import tempfile
|
| 7 |
import pandas as pd
|
|
|
|
| 8 |
|
| 9 |
import gradio as gr
|
| 10 |
import yt_dlp as youtube_dl
|
|
|
|
| 33 |
MODEL_NAME,
|
| 34 |
use_cache=False,
|
| 35 |
device_map="auto",
|
| 36 |
+
low_cpu_mem_usage=True,
|
| 37 |
+
attn_implementation="flash_attention_2"
|
| 38 |
)
|
| 39 |
|
| 40 |
# Flash Attention setup for memory and speed optimization if supported
|
|
|
|
| 56 |
model=model,
|
| 57 |
tokenizer=tokenizer,
|
| 58 |
feature_extractor=feature_extractor,
|
| 59 |
+
chunk_length_s=900, # Increased to 15 minutes
|
| 60 |
)
|
| 61 |
|
| 62 |
def reset_and_update_dataset(new_data):
|