Import tensorflow if it exists
Browse filesThis is necessary to avoid the following error when
TensorFlow is present:
"SystemError: google/protobuf/pyext/descriptor.cc:
358: bad argument to internal function"
More details here:
https://github.com/tensorflow/tensorflow/issues/48797
vad.py
CHANGED
@@ -1,9 +1,17 @@
|
|
1 |
from abc import ABC, abstractmethod
|
2 |
from collections import Counter
|
3 |
from dis import dis
|
4 |
-
from typing import Any,
|
5 |
|
6 |
from pprint import pprint
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
import torch
|
8 |
|
9 |
import ffmpeg
|
@@ -95,7 +103,7 @@ class AbstractTranscription(ABC):
|
|
95 |
|
96 |
segment_duration = segment_end - segment_start
|
97 |
|
98 |
-
segment_audio = self.get_audio_segment(audio, start_time = str(segment_start)
|
99 |
|
100 |
print("Running whisper from ", format_timestamp(segment_start), " to ", format_timestamp(segment_end), ", duration: ", segment_duration, "gap: ", segment_gap)
|
101 |
if segment_gap:
|
|
|
1 |
from abc import ABC, abstractmethod
|
2 |
from collections import Counter
|
3 |
from dis import dis
|
4 |
+
from typing import Any, Iterator, List, Dict
|
5 |
|
6 |
from pprint import pprint
|
7 |
+
|
8 |
+
# Workaround for https://github.com/tensorflow/tensorflow/issues/48797
|
9 |
+
try:
|
10 |
+
import tensorflow as tf
|
11 |
+
except ModuleNotFoundError:
|
12 |
+
# Error handling
|
13 |
+
pass
|
14 |
+
|
15 |
import torch
|
16 |
|
17 |
import ffmpeg
|
|
|
103 |
|
104 |
segment_duration = segment_end - segment_start
|
105 |
|
106 |
+
segment_audio = self.get_audio_segment(audio, start_time = str(segment_start), duration = str(segment_duration))
|
107 |
|
108 |
print("Running whisper from ", format_timestamp(segment_start), " to ", format_timestamp(segment_end), ", duration: ", segment_duration, "gap: ", segment_gap)
|
109 |
if segment_gap:
|