Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hackathon 7th] 修复 tal_cs 测试中 0D tensor to 1D #3913

Merged
merged 2 commits into from
Nov 29, 2024

Conversation

megemini
Copy link
Contributor

PR types

Bug fixes

PR changes

Others

Describe

修复 tal_cs 测试中 0D tensor to 1D

原代码中

ilen = paddle.to_tensor(feat.shape[0])

在 paddle 3.0 中是个 0D 的 tensor,而这里实际需要的是 1D 的,否则报错

> CUDA_VISIBLE_DEVICES= ./local/test_wav.sh conf/conformer.yaml conf/tuning/decode.yaml exp/conformer/checkpoints/avg_10 data/demo_01_03.wav

 File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/exps/u2/bin/test_wav.py", line 130, in <module>
    main(config, args)
  File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/exps/u2/bin/test_wav.py", line 122, in main
    U2Infer(config, args).run()
  File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/exps/u2/bin/test_wav.py", line 86, in run
    result_transcripts = self.model.decode(
  File "/usr/local/lib/python3.8/dist-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/base/dygraph/base.py", line 397, in _decorate_function
    return func(*args, **kwargs)
  File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/models/u2/u2.py", line 821, in decode
    hyp = self.attention_rescoring(
  File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/models/u2/u2.py", line 535, in attention_rescoring
    assert speech.shape[0] == speech_lengths.shape[0]
IndexError: list index out of range
Failed in evaluation!

@zxcd @Liyulingyue

Copy link

paddle-bot bot commented Nov 26, 2024

Thanks for your contribution!

@mergify mergify bot added the S2T asr/st label Nov 26, 2024
@@ -78,7 +78,7 @@ def run(self):
if self.args.debug:
np.savetxt("feat.transform.txt", feat)

ilen = paddle.to_tensor(feat.shape[0])
ilen = paddle.to_tensor(feat.shape[0]).unsqueeze(0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

类似目录下的test_wav.py均有可能出现此问题,建议一起改了吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一共找到三个地方,都已修改 ~ 不过,不知道哪些地方会测试用到,没法本地测试 ... ...

@megemini megemini requested a review from zxcd November 28, 2024 09:50
Copy link
Collaborator

@zxcd zxcd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zxcd zxcd merged commit 5e8c727 into PaddlePaddle:develop Nov 29, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants