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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion paddlespeech/s2t/exps/deepspeech2/bin/test_wav.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test(self):
feat = self.preprocessing(audio, **self.preprocess_args)
logger.info(f"feat shape: {feat.shape}")

audio_len = paddle.to_tensor(feat.shape[0])
audio_len = paddle.to_tensor(feat.shape[0]).unsqueeze(0)
audio = paddle.to_tensor(feat, dtype='float32').unsqueeze(axis=0)

result_transcripts = self.compute_result_transcripts(
Expand Down
2 changes: 1 addition & 1 deletion paddlespeech/s2t/exps/u2/bin/quant.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def run(self):
feat = self.preprocessing(audio, **self.preprocess_args)
logger.info(f"feat shape: {feat.shape}")

ilen = paddle.to_tensor(feat.shape[0])
ilen = paddle.to_tensor(feat.shape[0]).unsqueeze(0)
xs = paddle.to_tensor(feat, dtype='float32').unsqueeze(0)
decode_config = self.config.decode
logger.info(f"decode cfg: {decode_config}")
Expand Down
2 changes: 1 addition & 1 deletion paddlespeech/s2t/exps/u2/bin/test_wav.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

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

xs = paddle.to_tensor(feat, dtype='float32').unsqueeze(0)
decode_config = self.config.decode
logger.info(f"decode cfg: {decode_config}")
Expand Down