FunASR icon indicating copy to clipboard operation
FunASR copied to clipboard

ParaformerOnline::ExtractFeats

Open CaptainNeil opened this issue 7 months ago • 0 comments

Notice: In order to resolve issues more efficiently, please raise issue following the template. (注意:为了更加高效率解决您遇到的问题,请按照模板提问,补充细节)

❓ Questions and Help

https://github.com/modelscope/FunASR/blob/main/runtime/onnxruntime/src/paraformer-online.cpp#L160-L171

在这段代码中,reserve_waveforms_的作用是什么,似乎并未参与特征的运算,是否有存在的必要

Before asking:

  1. search the issues.
  2. search the docs.

What is your question?

梳理模型输入的前后处理,这部分代码让我很疑惑

Code

if (wav_feats.size() + lfr_splice_cache_.size() >= lfr_m) {
            wav_feats.insert(wav_feats.begin(), lfr_splice_cache_.begin(), lfr_splice_cache_.end());
            int frame_from_waves = (waves.size() - frame_sample_length_) / frame_shift_sample_length_ + 1;
            int minus_frame = reserve_waveforms_.empty() ? (lfr_m - 1) / 2 : 0;
            int lfr_splice_frame_idxs = OnlineLfrCmvn(wav_feats, input_finished);
            int reserve_frame_idx = std::abs(lfr_splice_frame_idxs - minus_frame);
            reserve_waveforms_.clear();
            reserve_waveforms_.insert(reserve_waveforms_.begin(),
                                        waves.begin() + reserve_frame_idx * frame_shift_sample_length_,
                                        waves.begin() + frame_from_waves * frame_shift_sample_length_);
            int sample_length = (frame_from_waves - 1) * frame_shift_sample_length_ + frame_sample_length_;
            waves.erase(waves.begin() + sample_length, waves.end());
        } 

What have you tried?

删除了这部分代码,似乎也可以很好的运行

What's your environment?

  • OS (e.g., Linux):
  • FunASR Version (e.g., 1.0.0):
  • ModelScope Version (e.g., 1.11.0):
  • PyTorch Version (e.g., 2.0.0):
  • How you installed funasr (pip, source):
  • Python version:
  • GPU (e.g., V100M32)
  • CUDA/cuDNN version (e.g., cuda11.7):
  • Docker version (e.g., funasr-runtime-sdk-cpu-0.4.1)
  • Any other relevant information:

CaptainNeil avatar Mar 19 '25 09:03 CaptainNeil