daihui.zhang commited on
Commit
715c7e0
·
1 Parent(s): 9a3c402

update pipelines launch wait

Browse files
Files changed (1) hide show
  1. transcribe/translatepipes.py +5 -8
transcribe/translatepipes.py CHANGED
@@ -6,7 +6,7 @@ class TranslatePipes:
6
  # self.whisper_input_q = mp.Queue()
7
  # self.translate_input_q = mp.Queue()
8
  # self.result_queue = mp.Queue()
9
-
10
  # whisper 转录
11
  self._whisper_pipe_en = self._launch_process(WhisperPipe())
12
  self._whisper_pipe_zh = self._launch_process(WhisperChinese())
@@ -18,22 +18,19 @@ class TranslatePipes:
18
  self._translate_7b_pipe = self._launch_process(Translate7BPipe())
19
  # vad
20
  # self._vad_pipe = self._launch_process(VadPipe())
21
-
22
  # def reset(self):
23
  # self._vad_pipe.reset()
24
 
25
  def _launch_process(self, process_obj):
26
  process_obj.daemon = True
27
  process_obj.start()
 
28
  return process_obj
29
 
30
  def wait_ready(self):
31
- self._whisper_pipe_zh.wait()
32
- self._funasr_pipe.wait()
33
- self._whisper_pipe_en.wait()
34
- # self._translate_pipe.wait()
35
- # self._vad_pipe.wait()
36
- self._translate_7b_pipe.wait()
37
 
38
  def translate(self, text, src_lang, dst_lang) -> MetaItem:
39
  item = MetaItem(
 
6
  # self.whisper_input_q = mp.Queue()
7
  # self.translate_input_q = mp.Queue()
8
  # self.result_queue = mp.Queue()
9
+ self._process = []
10
  # whisper 转录
11
  self._whisper_pipe_en = self._launch_process(WhisperPipe())
12
  self._whisper_pipe_zh = self._launch_process(WhisperChinese())
 
18
  self._translate_7b_pipe = self._launch_process(Translate7BPipe())
19
  # vad
20
  # self._vad_pipe = self._launch_process(VadPipe())
21
+
22
  # def reset(self):
23
  # self._vad_pipe.reset()
24
 
25
  def _launch_process(self, process_obj):
26
  process_obj.daemon = True
27
  process_obj.start()
28
+ self._process.append(process_obj)
29
  return process_obj
30
 
31
  def wait_ready(self):
32
+ for p in self._process:
33
+ p.wait()
 
 
 
 
34
 
35
  def translate(self, text, src_lang, dst_lang) -> MetaItem:
36
  item = MetaItem(