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 No.36】为 Paddle 代码转换工具新增 API 转换规则(第 3 组)-part #479

Open
wants to merge 42 commits into
base: master
Choose a base branch
from

Conversation

enkilee
Copy link
Contributor

@enkilee enkilee commented Sep 19, 2024

PR Docs

PaddlePaddle/docs#6879

PR APIs

torch.signal.windows.blackman
torch.signal.windows.cosine
torch.signal.windows.exponential
torch.signal.windows.gaussian
torch.signal.windows.general_cosine
torch.signal.windows.general_hamming
torch.signal.windows.hamming
torch.signal.windows.hann

Copy link

paddle-bot bot commented Sep 19, 2024

Thanks for your contribution!

@zhwesky2010
Copy link
Collaborator

zhwesky2010 commented Sep 19, 2024

单测未通过,请保证CI通过,CI不通过不予合入:

2024-09-19 15:54:54 FAILED tests/test_signal_windows_gaussian.py::test_case_1 - AttributeError: m...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_gaussian.py::test_case_2 - AttributeError: m...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_gaussian.py::test_case_3 - AttributeError: m...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_gaussian.py::test_case_4 - KeyError: 'out'
2024-09-19 15:54:54 FAILED tests/test_signal_windows_gaussian.py::test_case_5 - AttributeError: m...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_gaussian.py::test_case_6 - AttributeError: m...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_gaussian.py::test_case_7 - AttributeError: m...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_general_cosine.py::test_case_1 - AttributeEr...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_general_cosine.py::test_case_2 - AttributeEr...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_general_cosine.py::test_case_3 - AttributeEr...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_general_cosine.py::test_case_4 - KeyError: '...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_general_cosine.py::test_case_5 - AttributeEr...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_general_cosine.py::test_case_6 - AttributeEr...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_general_cosine.py::test_case_7 - AttributeEr...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_general_hamming.py::test_case_1 - AttributeE...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_general_hamming.py::test_case_2 - AttributeE...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_general_hamming.py::test_case_3 - AttributeE...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_general_hamming.py::test_case_4 - KeyError: ...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_general_hamming.py::test_case_5 - AttributeE...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_general_hamming.py::test_case_6 - AttributeE...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_general_hamming.py::test_case_7 - AttributeE...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_hamming.py::test_case_1 - AttributeError: mo...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_hamming.py::test_case_2 - AttributeError: mo...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_hamming.py::test_case_3 - AttributeError: mo...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_hamming.py::test_case_4 - KeyError: 'out'
2024-09-19 15:54:54 FAILED tests/test_signal_windows_hamming.py::test_case_5 - AttributeError: mo...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_hamming.py::test_case_6 - AttributeError: mo...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_hann.py::test_case_1 - AttributeError: modul...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_hann.py::test_case_2 - AttributeError: modul...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_hann.py::test_case_3 - AttributeError: modul...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_hann.py::test_case_4 - KeyError: 'out'
2024-09-19 15:54:54 FAILED tests/test_signal_windows_hann.py::test_case_5 - AttributeError: modul...
2024-09-19 15:54:54 FAILED tests/test_signal_windows_hann.py::test_case_6 - AttributeError: modul...
2024-09-19 15:54:54 =========== 52 failed, 8104 passed, 90 skipped in 188.19s (0:03:08) ============

@enkilee
Copy link
Contributor Author

enkilee commented Sep 19, 2024

能否修复下CI看错误,谢谢。

@paddle-bot paddle-bot bot added the contributor External developers label Sep 19, 2024
@enkilee
Copy link
Contributor Author

enkilee commented Sep 26, 2024

@zhwesky2010
想问一下,比如 blackman,在CI 的单侧pass了。可是在我本地却报错,请问有遇到过吗? 不管怎么写,都是同一种错误

            if self.is_aux_api:
                paddle_code = (
                    textwrap.dedent(
                        """
                    import sys
                    import importlib
                    sys.path.append('test_project/utils')
                    import paddle_aux
                    paddle_aux=importlib.reload(paddle_aux)
                    """
                    )
                    + paddle_code
                )
>           exec(paddle_code, locals())
>           exec(paddle_code, locals())
E             File "<string>", line 2
E               >>>>>>result = torch.signal.windows.blackman(5)
E               ^^
E           SyntaxError: invalid syntax

tests/apibase.py:86: SyntaxError

@luotao1 luotao1 changed the title 【Hackathon 7th No.36】为 Paddle 代码转换工具新增 API 转换规则(第 3 组)PART 1 【Hackathon 7th No.36】为 Paddle 代码转换工具新增 API 转换规则(第 3 组)-part Sep 29, 2024
@zhwesky2010
Copy link
Collaborator

Code Style不用管,其他需要通过

@zhwesky2010
Copy link
Collaborator

@zhwesky2010 想问一下,比如 blackman,在CI 的单侧pass了。可是在我本地却报错,请问有遇到过吗? 不管怎么写,都是同一种错误

            if self.is_aux_api:
                paddle_code = (
                    textwrap.dedent(
                        """
                    import sys
                    import importlib
                    sys.path.append('test_project/utils')
                    import paddle_aux
                    paddle_aux=importlib.reload(paddle_aux)
                    """
                    )
                    + paddle_code
                )
>           exec(paddle_code, locals())
>           exec(paddle_code, locals())
E             File "<string>", line 2
E               >>>>>>result = torch.signal.windows.blackman(5)
E               ^^
E           SyntaxError: invalid syntax

tests/apibase.py:86: SyntaxError

应该是你本地环境不对吧,pip uninstall paconvert 试试,可能跑单测是site-packages环境里的paconvert

Copy link
Collaborator

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

注意:

文档Matcher 严格一致,发现Diff需要回头修正。

"M",
"*",
"center",
"tau",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@enkilee enkilee Sep 30, 2024

Choose a reason for hiding this comment

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

恩,经过测试,是需要转写,已开pr改文档。

],
"kwargs_change": {
"M": "win_length",
"a": "",
Copy link
Collaborator

Choose a reason for hiding this comment

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

文档的转写方式看起来不是直接删除?是否有没对应上的diff?

没对应上的注意回头修正文档

Copy link
Contributor Author

@enkilee enkilee Sep 30, 2024

Choose a reason for hiding this comment

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

文档中a需要转写,a传入的是list, paddle组合成了 tuple(str, list)。a作为非可选参数,没有默认值。paddle中没有a这个参数,所以在general_cosine中,a默认为空。从pytorch拿值给a

pytorch:

torch.signal.windows.general_cosine(10, a=[0.46, 0.23, 0.31])

paddle:

paddle.audio.functional.get_window(('general_cosine', [0.46, 0.23, 0.31]), 10)

"dtype": "dtype"
},
"paddle_default_kwargs": {
"dtype": "paddle.float64",
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个的设置是什么原因,文档中需要强调吗

Copy link
Contributor Author

@enkilee enkilee Sep 30, 2024

Choose a reason for hiding this comment

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

paddle中默认float64。已开pr改文档。

def get_window(
    window: _WindowLiteral | tuple[_WindowLiteral, float],
    win_length: int,
    fftbins: bool = True,
    dtype: str = 'float64',
) -> Tensor:

def _gaussian(
    M: int, std: float, sym: bool = True, dtype: str = 'float64'
) -> Tensor:

def _exponential(
    M: int, center=None, tau=1.0, sym: bool = True, dtype: str = 'float64'
) -> Tensor:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants