Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jordimas committed Sep 15, 2024
1 parent c970d74 commit cef523c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions open_dubbing/dubbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def __init__(
self._number_of_steps = number_of_steps
self.tts = tts
self.device = device
self.cpu_threads = cpu_threads

@functools.cached_property
def input_file(self):
Expand Down
2 changes: 1 addition & 1 deletion open_dubbing/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def main():
help=("Device to use"),
)
parser.add_argument(
"--cpu-threads",
"--cpu_threads",
type=int,
default=0,
help="number of threads used for CPU inference (if not specified uses defaults for each framework)",
Expand Down
4 changes: 3 additions & 1 deletion open_dubbing/speech_to_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@

class SpeechToText:

def __init__(self, device="cpu"):
def __init__(self, device="cpu", cpu_threads=0):
self.model = None
self.device = device
self.cpu_threads = cpu_threads
logging.getLogger("faster_whisper").setLevel(logging.ERROR)

@property
Expand All @@ -37,6 +38,7 @@ def load_model(self):
self._model = WhisperModel(
model_size_or_path="large-v3",
device=self.device,
cpu_threads=self.cpu_threads,
compute_type="float16" if self.device == "cuda" else "int8",
)

Expand Down
5 changes: 3 additions & 2 deletions r.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ rm -r -f output/

declare -a inputs=("videos/cameratips.mp4" "videos/jordi.mp4" "videos/jobinterview.mp4" "videos/jordimaskudosallhands.mp4" "videos/michael.mp4" "videos/simplicty.mp4")
declare -a target_languages=("cat") # Catalan (cat) and French (fra)
declare -a tts_list=("mms")
declare -a tts_list=("coqui")
declare -a inputs=("videos/jordimaskudosallhands.mp4")

for tts in "${tts_list[@]}"; do
Expand All @@ -20,7 +20,8 @@ for tts in "${tts_list[@]}"; do
--source_language=eng \
--target_language="$language" \
--tts="$tts" \
--device=cpu
--device=cpu \
--cpu_threads=8
done
done
done
Expand Down

0 comments on commit cef523c

Please sign in to comment.