FunASR
FunASR copied to clipboard
SANMEncoder中不包含sanm_shift变量
Notice: In order to resolve issues more efficiently, please raise issue following the template. (注意:为了更加高效率解决您遇到的问题,请按照模板提问,补充细节)
🐛 Bug
在使用代码单独调用SANMEncoder进行debug时候发现,paraformer-zh配置文件中SANMEncoder的参数sanm_shift并不存在于SANMEncoder的代码实现中,变量涵义不明。当使用以下方法进行调试时,代码发生报错。
To Reproduce
from funasr.register import tables
kwargs = {
“input_size":80,
"output_size": 512,
"attention_heads": 4,
"linear_units": 2048,
"num_blocks": 50,
"dropout_rate": 0.1,
"positional_dropout_rate": 0.1,
"attention_dropout_rate": 0.1,
"input_layer": "pe",
"pos_enc_class": "SinusoidalPositionEncoder",
"normalize_before": True,
"kernel_size": 11,
"sanm_shift": 0,
"selfattention_layer_type": "sanm"
}
encoder_class = tables.encoder_classes.get("SANMEncoder")
sanm_encoder = encoder_class(**kwargs)
报错信息如下 TypeError: SANMEncoder.init() got an unexpected keyword argument 'sanm_shift'
该类的定义在这里 funasr/models/sanm/encoder.py
Code sample
Expected behavior
修复配置文件中多余的参数,或补充模型中缺失的变量实现。
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: