Dev gzf (#1435)
* qwenaudio qwenaudiochat
* qwenaudio qwenaudiochat
| | |
| | | |
| | | model = AutoModel(model="Qwen-Audio") |
| | | |
| | | res = model.generate(input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", language=None) |
| | | audio_in = "https://github.com/QwenLM/Qwen-Audio/raw/main/assets/audio/1272-128104-0000.flac" |
| | | prompt = "<|startoftranscription|><|en|><|transcribe|><|en|><|notimestamps|><|wo_itn|>" |
| | | |
| | | res = model.generate(input=audio_in, prompt=prompt) |
| | | print(res) |
| | |
| | | model_path="/nfs/zhifu.gzf/init_model/qwen/Qwen-Audio", |
| | | ) |
| | | |
| | | res = model.generate(input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", language=None) |
| | | audio_in = "https://github.com/QwenLM/Qwen-Audio/raw/main/assets/audio/1272-128104-0000.flac" |
| | | prompt = "<|startoftranscription|><|en|><|transcribe|><|en|><|notimestamps|><|wo_itn|>" |
| | | |
| | | res = model.generate(input=audio_in, prompt=prompt) |
| | | print(res) |
| | |
| | | |
| | | 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) |