Spaces:
Sleeping
Sleeping
sotirios-slv
commited on
Commit
•
a61e46a
1
Parent(s):
d3e099a
Removed dtype for torch
Browse files
app.py
CHANGED
@@ -8,12 +8,16 @@ from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
|
|
8 |
|
9 |
device = "cpu"
|
10 |
# device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
11 |
-
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
12 |
|
13 |
model_id = "openai/whisper-large-v3"
|
14 |
|
|
|
|
|
|
|
|
|
15 |
model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
16 |
-
model_id,
|
17 |
)
|
18 |
model.to(device)
|
19 |
|
@@ -23,7 +27,7 @@ pipe = pipeline(
|
|
23 |
task="automatic-speech-recognition",
|
24 |
model=model,
|
25 |
tokenizer=processor.tokenizer,
|
26 |
-
|
27 |
# max_new_tokens=128,
|
28 |
chunk_length_s=30,
|
29 |
batch_size=8,
|
|
|
8 |
|
9 |
device = "cpu"
|
10 |
# device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
11 |
+
# torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
12 |
|
13 |
model_id = "openai/whisper-large-v3"
|
14 |
|
15 |
+
# model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
16 |
+
# model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True
|
17 |
+
# )
|
18 |
+
|
19 |
model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
20 |
+
model_id, low_cpu_mem_usage=True, use_safetensors=True
|
21 |
)
|
22 |
model.to(device)
|
23 |
|
|
|
27 |
task="automatic-speech-recognition",
|
28 |
model=model,
|
29 |
tokenizer=processor.tokenizer,
|
30 |
+
feature_extractor=processor.feature_extractor,
|
31 |
# max_new_tokens=128,
|
32 |
chunk_length_s=30,
|
33 |
batch_size=8,
|