File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed
examples/industrial_data_pretraining/qwen_audio Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 9
9
10
10
model = AutoModel (model = "Qwen-Audio" )
11
11
12
- res = model .generate (input = "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" , language = None )
12
+ audio_in = "https://github.com/QwenLM/Qwen-Audio/raw/main/assets/audio/1272-128104-0000.flac"
13
+ prompt = "<|startoftranscription|><|en|><|transcribe|><|en|><|notimestamps|><|wo_itn|>"
14
+
15
+ res = model .generate (input = audio_in , prompt = prompt )
13
16
print (res )
Original file line number Diff line number Diff line change 11
11
model_path = "/nfs/zhifu.gzf/init_model/qwen/Qwen-Audio" ,
12
12
)
13
13
14
- res = model .generate (input = "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav" , language = None )
14
+ audio_in = "https://github.com/QwenLM/Qwen-Audio/raw/main/assets/audio/1272-128104-0000.flac"
15
+ prompt = "<|startoftranscription|><|en|><|transcribe|><|en|><|notimestamps|><|wo_itn|>"
16
+
17
+ res = model .generate (input = audio_in , prompt = prompt )
15
18
print (res )
Original file line number Diff line number Diff line change @@ -54,9 +54,8 @@ def inference(self,
54
54
55
55
meta_data = {}
56
56
# meta_data["batch_data_time"] = -1
57
-
58
- sp_prompt = "<|startoftranscription|><|en|><|transcribe|><|en|><|notimestamps|><|wo_itn|>"
59
- query = f"<audio>{ data_in [0 ]} </audio>{ sp_prompt } "
57
+ prompt = kwargs .get ("prompt" , "<|startoftranscription|><|en|><|transcribe|><|en|><|notimestamps|><|wo_itn|>" )
58
+ query = f"<audio>{ data_in [0 ]} </audio>{ prompt } "
60
59
audio_info = self .tokenizer .process_audio (query )
61
60
inputs = self .tokenizer (query , return_tensors = 'pt' , audio_info = audio_info )
62
61
inputs = inputs .to (self .model .device )
You can’t perform that action at this time.
0 commit comments