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

[xdoctest] reformat example code with google style in No.12-No.15 #56210

Merged
merged 3 commits into from
Aug 15, 2023

Conversation

longranger2
Copy link
Contributor

PR types

Others

PR changes

Others

Description

修改如下文件的示例代码为新的格式,并通过 xdoctest 检查:

  • python/paddle/audio/backends/init_backend.py
  • python/paddle/audio/backends/wave_backend.py
  • python/paddle/audio/datasets/esc50.py
  • python/paddle/audio/datasets/tess.py

@sunzhongkai588 @SigureMo @megemini

@paddle-bot paddle-bot bot added the contributor External developers label Aug 12, 2023
... audio, label = esc50_dataset[idx]
... # do something with audio, label
... print(audio.shape, label)
... # [audio_data_length] , label_id
Copy link
Contributor

Choose a reason for hiding this comment

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

这里可以有输出~ 另外,这行最好也保留吧,有助于理解输出的格式~

Comment on lines +67 to +68
... print(audio.shape, label)
... # [feature_dim, length] , label_id
Copy link
Contributor

Choose a reason for hiding this comment

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

同上

Comment on lines +60 to +61
... print(audio.shape, label)
... # [audio_data_length] , label_id
Copy link
Contributor

Choose a reason for hiding this comment

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

同上

Copy link
Contributor

Choose a reason for hiding this comment

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

这里检查失败了,可能是,TESS 的数据集每段长度不一样,而 _get_data 方法的 os.walk 不能保证每次 split 的数据一样,所以输出的 audio_data_length 不一样~

@SigureMo 帮忙看看是不是可以用 skip 跳过这段的检查?

Copy link
Member

Choose a reason for hiding this comment

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

skip 吧,仅对输出 skip,或者不打印输出也可以

Comment on lines +69 to +70
... print(audio.shape, label)
... # [feature_dim, num_frames] , label_id
Copy link
Contributor

Choose a reason for hiding this comment

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

同上

>>> wav_path = "./test.wav"

>>> current_backend = paddle.audio.backends.get_current_backend()
>>> print(current_backend) # wave_backend, the default backend.
Copy link
Contributor

Choose a reason for hiding this comment

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

可以加个输出 ~

# default backends is ['wave_backend']
# backends is ['wave_backend', 'soundfile'], if have installed paddleaudio >= 1.0.2
>>> current_backend = paddle.audio.backends.get_current_backend()
>>> print(current_backend) # wave_backend, the default backend.
Copy link
Contributor

Choose a reason for hiding this comment

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

同上

>>> wav_path = "./test.wav"

>>> current_backend = paddle.audio.backends.get_current_backend()
>>> print(current_backend) # wave_backend, the default backend.
Copy link
Contributor

Choose a reason for hiding this comment

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

同上

@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Aug 14, 2023
Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow 🐾

@luotao1 luotao1 merged commit e1eb52e into PaddlePaddle:develop Aug 15, 2023
@longranger2 longranger2 deleted the xdoctest3 branch August 15, 2023 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants