Spaces:
Runtime error
Runtime error
test
Browse files
app.py
CHANGED
|
@@ -17,16 +17,13 @@ MODEL = "facebook/wav2vec2-large-960h"
|
|
| 17 |
# MODEL = "patrickvonplaten/wav2vec2-large-960h-lv60-self-4-gram"
|
| 18 |
|
| 19 |
|
| 20 |
-
# is cuda available?
|
| 21 |
-
cuda = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
| 22 |
-
device = 0 if torch.cuda.is_available() else -1
|
| 23 |
speech_recognizer = pipeline(
|
| 24 |
task="automatic-speech-recognition",
|
| 25 |
model=f"{MODEL}",
|
| 26 |
tokenizer=f"{MODEL}",
|
| 27 |
framework="pt",
|
| 28 |
-
device=device,
|
| 29 |
)
|
|
|
|
| 30 |
|
| 31 |
videos_out_path = Path("./videos_out")
|
| 32 |
videos_out_path.mkdir(parents=True, exist_ok=True)
|
|
|
|
| 17 |
# MODEL = "patrickvonplaten/wav2vec2-large-960h-lv60-self-4-gram"
|
| 18 |
|
| 19 |
|
|
|
|
|
|
|
|
|
|
| 20 |
speech_recognizer = pipeline(
|
| 21 |
task="automatic-speech-recognition",
|
| 22 |
model=f"{MODEL}",
|
| 23 |
tokenizer=f"{MODEL}",
|
| 24 |
framework="pt",
|
|
|
|
| 25 |
)
|
| 26 |
+
speech_recognizer.to("cuda")
|
| 27 |
|
| 28 |
videos_out_path = Path("./videos_out")
|
| 29 |
videos_out_path.mkdir(parents=True, exist_ok=True)
|