| | |
| | | @tables.register("model_classes", "QwenAudio") |
| | | @tables.register("model_classes", "QwenAudioWarp") |
| | | class QwenAudioWarp(nn.Module): |
| | | """ |
| | | Qwen-Audio: Advancing Universal Audio Understanding via Unified Large-Scale Audio-Language Models |
| | | https://arxiv.org/abs/2311.07919 |
| | | Modified from https://github.com/QwenLM/Qwen-Audio |
| | | """ |
| | | def __init__(self, *args, **kwargs): |
| | | super().__init__() |
| | | |
| | |
| | | |
| | | meta_data = {} |
| | | # meta_data["batch_data_time"] = -1 |
| | | |
| | | sp_prompt = "<|startoftranscription|><|en|><|transcribe|><|en|><|notimestamps|><|wo_itn|>" |
| | | query = f"<audio>{data_in[0]}</audio>{sp_prompt}" |
| | | prompt = kwargs.get("prompt", "<|startoftranscription|><|en|><|transcribe|><|en|><|notimestamps|><|wo_itn|>") |
| | | query = f"<audio>{data_in[0]}</audio>{prompt}" |
| | | audio_info = self.tokenizer.process_audio(query) |
| | | inputs = self.tokenizer(query, return_tensors='pt', audio_info=audio_info) |
| | | inputs = inputs.to(self.model.device) |
| | |
| | | @tables.register("model_classes", "QwenAudioChatWarp") |
| | | class QwenAudioChatWarp(nn.Module): |
| | | def __init__(self, *args, **kwargs): |
| | | """ |
| | | Qwen-Audio: Advancing Universal Audio Understanding via Unified Large-Scale Audio-Language Models |
| | | https://arxiv.org/abs/2311.07919 |
| | | Modified from https://github.com/QwenLM/Qwen-Audio |
| | | """ |
| | | super().__init__() |
| | | |
| | | model_or_path = kwargs.get("model_path", "QwenAudio") |