Skip to content

Commit

Permalink
update for funasr-app and bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
R1ckShi committed Feb 6, 2024
1 parent 14a9e01 commit 78ee057
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions funasr/auto/auto_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,11 @@ def inference_with_vad(self, input, input_len=None, **cfg):
result["text"] = punc_res[0]["text"]

# speaker embedding cluster after resorted
if self.spk_model is not None:
if self.spk_model is not None and kwargs.get('return_spk_res', True):
all_segments = sorted(all_segments, key=lambda x: x[0])
spk_embedding = result['spk_embedding']
labels = self.cb_model(spk_embedding.cpu(), oracle_num=kwargs['preset_spk_num'])
del result['spk_embedding']
labels = self.cb_model(spk_embedding.cpu(), oracle_num=kwargs.get('preset_spk_num', None))
# del result['spk_embedding']
sv_output = postprocess(all_segments, None, labels, spk_embedding.cpu())
if self.spk_mode == 'vad_segment': # recover sentence_list
sentence_list = []
Expand All @@ -409,6 +409,7 @@ def inference_with_vad(self, input, input_len=None, **cfg):
result['timestamp'], \
result['raw_text'])
result['sentence_info'] = sentence_list
del result['spk_embedding']

result["key"] = key
results_ret_list.append(result)
Expand Down

0 comments on commit 78ee057

Please sign in to comment.