wenet-e2e / wenet

Production First and Production Ready End-to-End Speech Recognition Toolkit
https://wenet-e2e.github.io/wenet/
Apache License 2.0
4.18k stars 1.08k forks source link

运行RNN-T会报错 #1981

Closed DaobinZhu closed 1 year ago

DaobinZhu commented 1 year ago

拉下最新代码执行/home/lsj/zdb/wenet/examples/aishell/rnnt/run.sh第四步的时候报错如下:

Traceback (most recent call last): File "wenet/bin/train.py", line 448, in main() File "wenet/bin/train.py", line 283, in main script_model = torch.jit.script(model) File "/home/lsj/.conda/envs/wenet/lib/python3.8/site-packages/torch/jit/_script.py", line 1286, in script return torch.jit._recursive.create_script_module( File "/home/lsj/.conda/envs/wenet/lib/python3.8/site-packages/torch/jit/_recursive.py", line 476, in create_script_module return create_script_module_impl(nn_module, concrete_type, stubs_fn) File "/home/lsj/.conda/envs/wenet/lib/python3.8/site-packages/torch/jit/_recursive.py", line 542, in create_script_module_impl create_methods_and_properties_from_stubs(concrete_type, method_stubs, property_stubs) File "/home/lsj/.conda/envs/wenet/lib/python3.8/site-packages/torch/jit/_recursive.py", line 393, in create_methods_and_properties_from_stubs concrete_type._create_methods_and_properties(property_defs, property_rcbs, method_defs, method_rcbs, method_defaults) File "/home/lsj/.conda/envs/wenet/lib/python3.8/site-packages/torch/jit/_recursive.py", line 863, in try_compile_fn return torch.jit.script(fn, _rcb=rcb) File "/home/lsj/.conda/envs/wenet/lib/python3.8/site-packages/torch/jit/_script.py", line 1343, in script fn = torch._C._jit_script_compile( RuntimeError: 'torch.wenet.transducer.predictor.RNNPredictor (of Python compilation unit at: 0x51e2a80)' object has no attribute or method 'call'. Did you forget to initialize an attribute in init()?: File "/home/lsj/zdb/wenet/wenet/transducer/transducer.py", line 483 ys_in_pad = add_blank(text, model.blank, model.ignore_id)

predictor

predictor_out = model.predictor(ys_in_pad)
                ~~~~~~~~~~~~~~~ <--- HERE
if not use_k2:
    # joint

'compute_loss' is being compiled since it was called from 'Transducer.forward' File "/home/lsj/zdb/wenet/wenet/transducer/transducer.py", line 116

    # compute_loss
    loss_rnnt = compute_loss(
    ~~~~~~~~~~~~~~~~~~~~~~~~~
        self,
        ~~~~~
        encoder_out,
        ~~~~~~~~~~~~
        encoder_out_lens,
        ~~~~~~~~~~~~~~~~~
        encoder_mask,
        ~~~~~~~~~~~~~
        text,
        ~~~~~
        text_lengths,
        ~~~~~~~~~~~~~
        steps=steps,
        ~~~~~~~~~~~~
        use_k2=self.enable_k2,
        ~~~~~~~~~~~~~~~~~~~~~ <--- HERE
    )
Mddct commented 1 year ago

fix , 可以试下 这个 https://github.com/wenet-e2e/wenet/pull/1990

DaobinZhu commented 1 year ago

fix , 可以试下 这个 #1990

谢谢大佬,已经解决了