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

Method generate_chatml

model.py:565–581  ·  view source on GitHub ↗
(self, prompt: str, data: Union[str, torch.Tensor])

Source from the content-addressed store, hash-verified

563 return prompt + ":"
564
565 def generate_chatml(self, prompt: str, data: Union[str, torch.Tensor]):
566 if isinstance(data, str):
567 return [
568 {"role": "system", "content": "You are a helpful assistant."},
569 {"role": "user", "content": f"{prompt}<|startofspeech|>!{data}<|endofspeech|>"},
570 {"role": "assistant", "content": "null"},
571 ]
572 elif isinstance(data, torch.Tensor):
573 return [
574 {"role": "system", "content": "You are a helpful assistant."},
575 {
576 "role": "user",
577 "content": f"{prompt}<|startofspeech|>!!<|endofspeech|>",
578 "audio": data,
579 },
580 {"role": "assistant", "content": "null"},
581 ]
582
583 def inference(
584 self,

Callers 1

inferenceMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected