whisper时间戳处理,源码地址:https://github.com/mindspore-lab/mindnlp/blob/master/mindnlp/transformers/generation/logits_process.py#L1211
初始化指定
eos_token_id=50256,
no_timestamps_token_id=50362,
forced_decoder_ids= [[1,50362]],
max_initial_timestamp_index=1
继承自nn.Cell
修改__call__ 方法名为construct
修改1285行 seq = list(input_ids[k, self.begin_index :].tolist()) 为 seq = input_ids[k, self.begin_index :]
组成简易模型
使用
timestamps=WhisperTimeStampLogitsProcessor()
inputs=Tensor([[1,2,3,4,5,6]])
inputs_mask=Tensor(np.arange(51864)).reshape(1,-1)
out=timestamps(inputs,inputs_mask)
进行推理,无报错,使用python接口进行mindspore-lite转换,报错 HandleGraphsCommon] Optimize func graph failed: -2 NULL pointer returned.
whisper时间戳处理,源码地址:https://github.com/mindspore-lab/mindnlp/blob/master/mindnlp/transformers/generation/logits_process.py#L1211
初始化指定
eos_token_id=50256,
no_timestamps_token_id=50362,
forced_decoder_ids= [[1,50362]],
max_initial_timestamp_index=1
继承自nn.Cell
修改__call__ 方法名为construct
修改1285行 seq = list(input_ids[k, self.begin_index :].tolist()) 为 seq = input_ids[k, self.begin_index :]
组成简易模型
使用
timestamps=WhisperTimeStampLogitsProcessor()
inputs=Tensor([[1,2,3,4,5,6]])
inputs_mask=Tensor(np.arange(51864)).reshape(1,-1)
out=timestamps(inputs,inputs_mask)
进行推理,无报错,使用python接口进行mindspore-lite转换,报错 HandleGraphsCommon] Optimize func graph failed: -2 NULL pointer returned.