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] 修复 paddle 3.0 transpose 的输入不能为 tensor 的问题 #3933

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

megemini
Copy link
Contributor

@megemini megemini commented Dec 5, 2024

PR types

Bug fixes

PR changes

APIs

Describe

修复 paddle 3.0 transpose 的输入不能为 tensor 的问题(2.5.1 支持 tensor 输入)~

错误日志:

/home/aistudio/PaddleSpeech/paddlespeech/s2t/exps/hubert/bin/train.py", line 32, in main
    main_sp(config, args)
  File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/exps/hubert/bin/train.py", line 28, in main_sp
    exp.run()
  File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/training/trainer.py", line 351, in run
    self.do_train()
  File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/exps/hubert/model.py", line 457, in do_train
    raise e
  File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/exps/hubert/model.py", line 433, in do_train
    self.train_batch(batch_index, batch, msg)
  File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/exps/hubert/model.py", line 193, in train_batch
    loss = self.model(wav, wavs_lens_rate, target, target_lens)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/nn/layer/layers.py", line 1531, in __call__
    return self.forward(*inputs, **kwargs)
  File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/models/hubert/hubert_ASR.py", line 90, in forward
    out = self.hubert.extract_features(wav)[0]
  File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/models/hubert/modules/hubert_model.py", line 548, in extract_features
    res = self.forward(
  File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/models/hubert/modules/hubert_model.py", line 445, in forward
    features = self.forward_features(source)
  File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/models/hubert/modules/hubert_model.py", line 405, in forward_features
    features = self.feature_extractor(source)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/nn/layer/layers.py", line 1531, in __call__
    return self.forward(*inputs, **kwargs)
  File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/models/wav2vec2/modules/wav2vec2_model.py", line 2332, in forward
    x = conv(x)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/nn/layer/layers.py", line 1531, in __call__
    return self.forward(*inputs, **kwargs)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/nn/layer/container.py", line 754, in forward
    input = layer(input)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/nn/layer/layers.py", line 1531, in __call__
    return self.forward(*inputs, **kwargs)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/nn/layer/container.py", line 754, in forward
    input = layer(input)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/nn/layer/layers.py", line 1531, in __call__
    return self.forward(*inputs, **kwargs)
  File "/home/aistudio/PaddleSpeech/paddlespeech/s2t/models/wav2vec2/modules/wav2vec2_model.py", line 1277, in forward
    return x.transpose(trans_dim)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/tensor/linalg.py", line 127, in transpose
    return _C_ops.transpose(x, perm)
TypeError: (InvalidType) transpose(): argument (position 2) must be list or tuple, but got Tensor (at ../paddle/fluid/pybind/op_function_common.cc:592)

@zxcd @Liyulingyue @enkilee @GreatV

Copy link

paddle-bot bot commented Dec 5, 2024

Thanks for your contribution!

@mergify mergify bot added the S2T asr/st label Dec 5, 2024
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 ff539ef into PaddlePaddle:develop Dec 5, 2024
5 checks passed
@GreatV
Copy link
Contributor

GreatV commented Dec 5, 2024

这个是规范化了,还是3.0的bug

@megemini
Copy link
Contributor Author

megemini commented Dec 5, 2024

这个是规范化了,还是3.0的bug

应该不是 bug ~

dygraph_ops.yaml 里面很早就规定是 int[]

- op : transpose
  args : (Tensor x, int[] perm)
  output : Tensor(out)
  infer_meta :
    func : TransposeInferMeta
    spmd_rule: TransposeInferSpmd
  kernel :
    func : transpose
  inplace : (x -> out)
  backward : transpose_grad

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.

3 participants