Skip to content

Commit

Permalink
[Hackathon 7th] 修复 tal_cs 测试中 0D tensor to 1D (#3913)
Browse files Browse the repository at this point in the history
* [Fix] 0D tensor to 1D

* [Update] feat dim
  • Loading branch information
megemini authored Nov 29, 2024
1 parent a397ebe commit 5e8c727
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
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)
xs = paddle.to_tensor(feat, dtype='float32').unsqueeze(0)
decode_config = self.config.decode
logger.info(f"decode cfg: {decode_config}")
Expand Down

0 comments on commit 5e8c727

Please sign in to comment.