Skip to content
This repository has been archived by the owner on Oct 13, 2022. It is now read-only.

RuntimeError in ctc_att_transformer_train.py #142

Open
csukuangfj opened this issue Mar 28, 2021 · 5 comments · Fixed by #143
Open

RuntimeError in ctc_att_transformer_train.py #142

csukuangfj opened this issue Mar 28, 2021 · 5 comments · Fixed by #143

Comments

@csukuangfj
Copy link
Collaborator

See below (using the latest master)

2021-03-29 07:34:23,835 INFO [common.py:270] ================================================================================                
2021-03-29 07:34:23,837 INFO [ctc_att_transformer_train.py:440] epoch 0, learning rate 0
Traceback (most recent call last):
  File "./ctc_att_transformer_train.py", line 508, in <module>
    main()
  File "./ctc_att_transformer_train.py", line 442, in main
    objf, valid_objf, global_batch_idx_train = train_one_epoch(dataloader=train_dl,
  File "./ctc_att_transformer_train.py", line 220, in train_one_epoch
    curr_batch_objf, curr_batch_frames, curr_batch_all_frames = get_objf(
  File "./ctc_att_transformer_train.py", line 95, in get_objf
    nnet_output, encoder_memory, memory_mask = model(feature, supervisions)
  File "/ceph-fj/fangjun/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/root/fangjun/open-source/s2/snowfall/snowfall/models/transformer.py", line 92, in forward
    encoder_memory, memory_mask = self.encode(x, supervision)
  File "/root/fangjun/open-source/s2/snowfall/snowfall/models/transformer.py", line 108, in encode
    x = self.encoder_embed(x)
  File "/ceph-fj/fangjun/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/root/fangjun/open-source/s2/snowfall/snowfall/models/transformer.py", line 384, in forward
    x = self.out(x.transpose(1, 2).contiguous().view(b, t, c * f))
  File "/ceph-fj/fangjun/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/ceph-fj/fangjun/py38/lib/python3.8/site-packages/torch/nn/modules/linear.py", line 93, in forward
    return F.linear(input, self.weight, self.bias)
  File "/ceph-fj/fangjun/py38/lib/python3.8/site-packages/torch/nn/functional.py", line 1692, in linear
    output = input.matmul(weight.t())
RuntimeError: mat1 dim 1 must match mat2 dim 0
@zhu-han
Copy link
Contributor

zhu-han commented Mar 29, 2021

In #140, feature dimention is changed from 40 to 80. Replace num_features=40 with num_features=80 in https://github.com/k2-fsa/snowfall/blob/master/egs/librispeech/asr/simple_v1/ctc_att_transformer_train.py#L406 could fix it.

@csukuangfj
Copy link
Collaborator Author

@zhu-han
thanks

@pzelasko
Copy link
Collaborator

I think that we should consider a refactoring of snowfall to share more code between the recipes. The number of similar issues will grow exponentially as we start adding new recipes (new corpora or scripts with new training methods).

@danpovey
Copy link
Contributor

danpovey commented Mar 30, 2021 via email

@pzelasko
Copy link
Collaborator

I’m happy to do it, it’s actually been on my radar for some time now, but my time is also spread a bit thin lately. Anyway, I guess let’s just keep our eyes open for easy wins for now, once I can I’ll look into it more..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants