-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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][task 293-296] reformat example code with google style in vision
#56458
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
# <class 'paddle.Tensor'> [3, 281, 500] | ||
print(type(label), label.shape) | ||
# <class 'numpy.ndarray'> (281, 500) | ||
>>> import itertools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![image](https://private-user-images.githubusercontent.com/38436475/261782986-e447ca80-8bc3-45a6-8b4d-638cd1acf109.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyODI3NzksIm5iZiI6MTczOTI4MjQ3OSwicGF0aCI6Ii8zODQzNjQ3NS8yNjE3ODI5ODYtZTQ0N2NhODAtOGJjMy00NWE2LThiNGQtNjM4Y2QxYWNmMTA5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDE0MDExOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ4MDEyNDNkNzAxYTI0ZTU3NjJjNmY1M2QyNTQ3YWIyMjM1OTlmNjY1OGNjNjIwNGNjMzRhOGM1NTkwNmUxZTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.BwI6qPMO91hl5UXOqcfBKQ3VwS0NFX-BrZSxY6MLGh8)
这个应该是下载数据集超时了,@megemini 是否有方法通过 directive 来修改超时时间呢,比如 # doctest: +TIMEOUT(15)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好问题!简单的说,不行 ~ xdoctest 不支持自定义 directive ~
不过,之前也有想过,目前这个 timeout 不太灵活,如果能指定时间就好了 ~
#56400 这个 PR 里面看看能不能一起搞定吧!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是要添加# doctest: +TIMEOUT()吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
暂时还不可以加,等 #56400 合入后 merge 一下才可以,这个 PR 应该近期就可以 merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#56400 已 merge,麻烦 merge 下最新的 develop 尝试加上 TIMEOUT directive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我添加了# doctest: +TIMEOUT(15),是15太短了吗,还是我命令写的有问题,现在失败了,pr-ci-static-check直接暂停了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
奇怪,我 rerun 下等会再看看
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2023-08-23 13:57:24 ----------------End of the Check--------------------
2023-08-23 13:57:24 7 sample codes ran success
2023-08-23 13:57:24 <DocTest(<modname?> paddle.vision.datasets.DatasetFolder:1:0 ln 1)>
2023-08-23 13:57:24 <DocTest(<modname?> paddle.vision.datasets.FashionMNIST:1:0 ln 1)>
2023-08-23 13:57:24 <DocTest(<modname?> paddle.vision.datasets.ImageFolder:1:0 ln 1)>
2023-08-23 13:57:24 <DocTest(<modname?> paddle.vision.datasets.MNIST:1:0 ln 1)>
2023-08-23 13:57:24 <DocTest(<modname?> paddle.vision.get_image_backend:1:0 ln 1)>
2023-08-23 13:57:24 <DocTest(<modname?> paddle.vision.image_load:1:0 ln 1)>
2023-08-23 13:57:24 <DocTest(<modname?> paddle.vision.set_image_backend:1:0 ln 1)>
2023-08-23 13:57:24 1 sample codes ran timeout
2023-08-23 13:57:24 paddle.vision.datasets.VOC2012:1 - more than 15.0s
2023-08-23 13:57:24 Sample code check is successful!
15秒太短,看日志里面下载没跑完~~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
示例中有大量的
>>> for i in range(len(data_folder_1)):
... img, label = data_folder_1[i]
... # do something with img and label
... print(type(img), img.size, label)
... # <class 'PIL.Image.Image'> (32, 32) 0
类似的输出 ~ 我觉得不用改,这样就挺好,不然输出有可能受文件顺序的影响,而且也太繁琐。
@SigureMo 看看怎么搞?
for 循环的我觉得确实可以不用展开,目的不是对比输出,主要是展示输出是什么(如果没记错当初这些示例代码还是我统一的写法) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ~ 辛苦!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTMeow 🐾
…vision` (PaddlePaddle#56458) * [Doctest]fix No.293-296, test=docs_preview * empty commit * code style * empty commit * fix timeout * fix timeout
PR types
Others
PR changes
Others
Description
修改如下文件的示例代码,使其通过
xdoctest
检查:python/paddle/vision/datasets/folder.py
python/paddle/vision/datasets/mnist.py
python/paddle/vision/datasets/voc2012.py
python/paddle/vision/image.py
预览:
Related links
@sunzhongkai588 @SigureMo @megemini