MCPcopy Create free account
hub / github.com/FunAudioLLM/Fun-ASR / get_prompt

Method get_prompt

model.py:550–563  ·  view source on GitHub ↗
(self, hotwords: list[str], language: str = None, itn: bool = True)

Source from the content-addressed store, hash-verified

548 return inputs_embeds, contents, batch, source_ids, meta_data
549
550 def get_prompt(self, hotwords: list[str], language: str = None, itn: bool = True):
551 if len(hotwords) > 0:
552 hotwords = ", ".join(hotwords)
553 prompt = f"请结合上下文信息,更加准确地完成语音转写任务。如果没有相关信息,我们会留空。\n\n\n**上下文信息:**\n\n\n"
554 prompt += f"热词列表:[{hotwords}]\n"
555 else:
556 prompt = ""
557 if language is None:
558 prompt += "语音转写"
559 else:
560 prompt += f"语音转写成{language}"
561 if not itn:
562 prompt += ",不进行文本规整"
563 return prompt + ":"
564
565 def generate_chatml(self, prompt: str, data: Union[str, torch.Tensor]):
566 if isinstance(data, str):

Callers 1

inferenceMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected