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] 分批次修改已有代码的示例 #55629

Closed
megemini opened this issue Jul 23, 2023 · 50 comments
Closed

[xdoctest] 分批次修改已有代码的示例 #55629

megemini opened this issue Jul 23, 2023 · 50 comments
Assignees
Labels
HappyOpenSource 快乐开源活动issue与PR PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/close 已关闭

Comments

@megemini
Copy link
Contributor

megemini commented Jul 23, 2023

commit db921ae

✅ 第 1 批 (整体进展:99/99)

按 merge 的时间顺序,排名不分先后: @SigureMo (9) @longranger2 (19) @sunzhongkai588 (2) @ooooo-create (15) @enkilee (24) @Liyulingyue (2) @gouzil (14) @Kaedeharai (5) @yuchen202 (8) @jinyouzhi (1)

序号 行数 文件 认领人 Github id PR 链接
1 74 python/paddle/batch.py✅(2023/8/1) @longranger2 #55804
2 386 python/paddle/dataset/image.py✅(2023/8/1) @longranger2 #55804
3 1710 python/paddle/fft.py✅(2023/8/1) @longranger2 #55804
4 833 python/paddle/metric/metrics.py✅(2023/8/1) @longranger2 #55804
5 107 python/paddle/onnx/export.py✅(2023/8/1) @longranger2 #55804
6 77 python/paddle/reader/__init__.py ✅(2023/8/30) @longranger2 #56146
7 688 python/paddle/reader/decorator.py✅(2023/8/30) @longranger2 #56146
8 256 python/paddle/regularizer.py✅(2023/8/30) @longranger2 #56146
9 616 python/paddle/signal.py✅(2023/8/30) @longranger2 #56146
10 55 python/paddle/sysconfig.py ✅(2023/8/30) @longranger2 #56146
11 154 python/paddle/audio/backends/backend.py✅(2023/8/3) @Liyulingyue #55925
12 188 python/paddle/audio/backends/init_backend.py✅(2023/8/15) @longranger2 #56210
13 230 python/paddle/audio/backends/wave_backend.py✅(2023/8/15) @longranger2 #56210
14 190 python/paddle/audio/datasets/esc50.py✅(2023/8/15) @longranger2 #56210
15 155 python/paddle/audio/datasets/tess.py✅(2023/8/15) @longranger2 #56210
16 413 python/paddle/audio/features/layers.py✅(2023/8/18) @longranger2 #56296
17 339 python/paddle/audio/functional/functional.py✅(2023/8/18) @longranger2 #56296
18 390 python/paddle/audio/functional/window.py✅(2023/8/18) @longranger2 #56296
19 711 python/paddle/autograd/autograd.py ✅(2023/8/18) @longranger2 #56296
20 119 python/paddle/autograd/backward_mode.py✅(2023/8/18) @longranger2 #56296
21 406 python/paddle/autograd/py_layer.py✅(2023/8/2) @ooooo-create #55849
22 112 python/paddle/autograd/saved_tensors_hooks.py✅(2023/8/2) @ooooo-create #55849
23 114 python/paddle/framework/dtype.py✅(2023/8/2) @ooooo-create #55849
24 82 python/paddle/framework/framework.py✅(2023/8/2) @ooooo-create #55849
25 1180 python/paddle/framework/io.py✅(2023/8/2) @ooooo-create #55849
26 271 python/paddle/framework/io_utils.py✅(2023/8/2) @ooooo-create #55849
27 264 python/paddle/framework/random.py✅(2023/8/2) @ooooo-create #55849
28 185 python/paddle/nn/initializer/Bilinear.py✅(2023/8/2) @ooooo-create #55849
29 222 python/paddle/nn/initializer/assign.py✅(2023/8/2) @ooooo-create #55849
30 109 python/paddle/nn/initializer/constant.py✅(2023/8/2) @ooooo-create #55849
31 307 python/paddle/nn/initializer/dirac.py✅(2023/8/9) @Kaedeharai #56051
32 159 python/paddle/nn/initializer/initializer.py ✅(2023/8/9) @Kaedeharai #56051
33 289 python/paddle/nn/initializer/kaiming.py✅(2023/8/9) @Kaedeharai #56051
34 279 python/paddle/nn/initializer/normal.py✅(2023/8/9) @Kaedeharai #56051
35 242 python/paddle/nn/initializer/orthogonal.py✅(2023/8/9) @Kaedeharai #56051
36 187 python/paddle/nn/initializer/uniform.py✅(2023/8/31) @yuchen202 #56440
37 290 python/paddle/nn/initializer/xavier.py✅(2023/8/31) @yuchen202 #56440
38 1728 python/paddle/nn/functional/activation.py ✅(2023/8/31) @yuchen202 #56440
39 2379 python/paddle/nn/functional/common.py ✅(2023/8/31) @yuchen202 #56440
40 1824 python/paddle/nn/functional/conv.py✅(2023/8/31) @yuchen202 #56440
41 111 python/paddle/nn/functional/distance.py ✅(2023/8/31) @yuchen202 #56440
42 430 python/paddle/nn/functional/extension.py✅(2023/8/31) @yuchen202 #56440
43 410 python/paddle/nn/functional/flash_attention.py ✅(2023/8/31) @yuchen202 #56440
44 485 python/paddle/distribution/bernoulli.py✅(2023/8/7) @gouzil #55813
45 162 python/paddle/distribution/beta.py✅(2023/8/7) @gouzil #55813
46 357 python/paddle/distribution/categorical.py✅(2023/8/7) @gouzil #55813
47 469 python/paddle/distribution/cauchy.py✅(2023/8/7) @gouzil #55813
48 179 python/paddle/distribution/dirichlet.py✅(2023/8/2) @sunzhongkai588 #55868
49 343 python/paddle/distribution/geometric.py✅(2023/8/2) @sunzhongkai588 #55868
50 267 python/paddle/distribution/gumbel.py✅(2023/8/7) @gouzil #55813
51 98 python/paddle/distribution/independent.py✅(2023/8/7) @gouzil #55813
52 261 python/paddle/distribution/kl.py✅(2023/8/7) @gouzil #55813
53 412 python/paddle/distribution/laplace.py✅(2023/8/7) @gouzil #55813
54 175 python/paddle/distribution/lognormal.py✅(2023/8/7) @gouzil #55813
55 208 python/paddle/distribution/multinomial.py✅(2023/8/7) @gouzil #55813
56 334 python/paddle/distribution/normal.py✅(2023/8/7) @gouzil #55813
57 1290 python/paddle/distribution/transform.py✅(2023/8/7) @gouzil #55813
58 146 python/paddle/distribution/transformed_distribution.py✅(2023/8/7) @gouzil #55813
59 265 python/paddle/distribution/uniform.py✅(2023/8/7) @gouzil #55813
60 244 python/paddle/geometric/math.py✅(2023/8/3) @ooooo-create #55919
61 492 python/paddle/geometric/message_passing/send_recv.py✅(2023/8/3) @ooooo-create #55919
62 264 python/paddle/geometric/reindex.py✅(2023/8/3) @ooooo-create #55919
63 320 python/paddle/geometric/sampling/neighbors.py✅(2023/8/3) @ooooo-create #55919
64 1352 python/paddle/hapi/callbacks.py✅(2023/8/3) @ooooo-create #55919
65 314 python/paddle/hapi/dynamic_flops.py✅(2023/8/16) @enkilee #55953
66 311 python/paddle/hapi/hub.py✅(2023/8/16) @enkilee #55953
67 2487 python/paddle/hapi/model.py✅(2023/8/16) @enkilee #55953
68 493 python/paddle/hapi/model_summary.py✅(2023/8/16) @enkilee #55953
69 365 python/paddle/io/dataloader/batch_sampler.py✅(2023/8/3) @SigureMo #55732
70 543 python/paddle/io/dataloader/dataset.py✅(2023/8/3) @SigureMo #55732
71 318 python/paddle/io/dataloader/sampler.py✅(2023/8/3) @SigureMo #55732
72 403 python/paddle/io/dataloader/worker.py✅(2023/8/3) @SigureMo #55732
73 527 python/paddle/io/reader.py✅(2023/8/3) @SigureMo #55732
74 1873 python/paddle/jit/api.py✅(2023/7/31) @SigureMo #55645
75 344 python/paddle/jit/dy2static/convert_call_func.py✅(2023/7/31) @SigureMo #55645
76 280 python/paddle/jit/dy2static/logging_utils.py✅(2023/7/31) @SigureMo #55645
77 1649 python/paddle/jit/translated_layer.py✅(2023/7/31) @SigureMo #55645
78 233 python/paddle/nn/functional/input.py✅(2023/8/9) @Liyulingyue #55966
79 4107 python/paddle/nn/functional/loss.py✅(2023/9/6) @jinyouzhi #56901
80 2063 python/paddle/nn/functional/pooling.py✅(2023/8/3) @enkilee #55806
81 172 python/paddle/nn/functional/sparse_attention.py✅(2023/8/3) @enkilee #55806
82 1513 python/paddle/nn/layer/activation.py✅(2023/8/3) @enkilee #55806
83 1957 python/paddle/nn/layer/common.py✅(2023/8/3) @enkilee #55806
84 84 python/paddle/nn/layer/distance.py✅(2023/8/3) @enkilee #55806
85 2316 python/paddle/nn/layer/layers.py✅(2023/8/3) @enkilee #55806
86 1884 python/paddle/nn/layer/norm.py✅(2023/8/3) @enkilee #55812
87 1380 python/paddle/nn/layer/pooling.py✅(2023/8/3) @enkilee #55812
88 1977 python/paddle/nn/layer/rnn.py✅(2023/8/3) @enkilee #55812
89 1489 python/paddle/nn/layer/transformer.py✅(2023/8/3) @enkilee #55812
90 228 python/paddle/nn/layer/vision.py✅(2023/8/3) @enkilee #55812
91 2142 python/paddle/nn/layer/loss.py✅(2023/8/4) @enkilee #55832
92 1127 python/paddle/nn/clip.py✅(2023/9/19) @enkilee #57460
93 1095 python/paddle/nn/decode.py✅(2023/8/4) @enkilee #55832
94 237 python/paddle/nn/quant/format.py✅(2023/8/4) @enkilee #55832
95 1172 python/paddle/nn/quant/quant_layers.py✅(2023/8/3) @enkilee #55834
96 82 python/paddle/nn/quant/stub.py✅(2023/8/3) @enkilee #55834
97 107 python/paddle/nn/utils/clip_grad_norm_.py✅(2023/8/3) @enkilee #55834
98 58 python/paddle/nn/utils/clip_grad_value_.py✅(2023/8/3) @enkilee #55834
99 218 python/paddle/nn/utils/spectral_norm_hook.py✅(2023/8/3) @enkilee #55834

✅ 第 2 批(整体进展:100/100)

按 merge 的时间顺序,排名不分先后: @SigureMo (2) @Candy2Tang (18) @Liyulingyue (8) @AndSonder (4) @PommesPeter (8) @enkilee (11) @ooooo-create (15) @liyongchao911 (10) @whisky-12 (10) @DrRyanHuang (12) @megemini (1)

序号 行数 文件 认领人 Github id PR 链接
100 180 python/paddle/nn/utils/transform_parameters.py✅(2023/8/22) @Liyulingyue #55967
101 245 python/paddle/nn/utils/weight_norm_hook.py✅(2023/8/14) @Liyulingyue #55968
102 245 python/paddle/optimizer/adadelta.py✅(2023/8/16) @PommesPeter #56124
103 222 python/paddle/optimizer/adagrad.py✅(2023/8/16) @PommesPeter #56124
104 724 python/paddle/optimizer/adam.py✅(2023/8/16) @PommesPeter #56124
105 358 python/paddle/optimizer/adamax.py✅(2023/8/11) @Candy2Tang #56167
106 637 python/paddle/optimizer/adamw.py✅(2023/8/14) @Candy2Tang #56222
107 322 python/paddle/optimizer/lamb.py✅(2023/8/14) @Candy2Tang #56223
108 780 python/paddle/optimizer/lbfgs.py✅(2023/8/16) @Candy2Tang #56224
109 2229 python/paddle/optimizer/lr.py✅(2023/8/21) @Candy2Tang #56225
110 558 python/paddle/optimizer/momentum.py✅(2023/8/14) @Candy2Tang #56226
111 315 python/paddle/optimizer/rmsprop.py✅(2023/8/14) @Candy2Tang #56227
112 170 python/paddle/optimizer/sgd.py✅(2023/8/14) @Candy2Tang #56228
113 607 python/paddle/nn/layer/container.py✅(2023/8/21) @Candy2Tang #56229
114 528 python/paddle/nn/functional/vision.py✅(2023/8/21) @Candy2Tang #56230
115 1801 python/paddle/jit/dy2static/program_translator.py✅(2023/7/31) @SigureMo #55645
116 1710 python/paddle/optimizer/optimizer.py✅(2023/8/15) @AndSonder #56118
117 461 python/paddle/quantization/config.py✅(2023/8/15) @AndSonder #56118
118 134 python/paddle/quantization/factory.py✅(2023/8/15) @AndSonder #56118
119 754 python/paddle/quantization/imperative/qat.py✅(2023/8/15) @AndSonder #56118
120 78 python/paddle/quantization/observers/abs_max.py✅(2023/8/16) @Candy2Tang #56231
121 82 python/paddle/quantization/ptq.py✅(2023/8/21) @Candy2Tang #56232
122 74 python/paddle/quantization/qat.py✅(2023/8/21) @Candy2Tang #56233
123 230 python/paddle/quantization/quanters/abs_max.py✅(2023/8/14) @Candy2Tang #56234
124 114 python/paddle/quantization/quantize.py✅(2023/8/21) @Candy2Tang #56235
125 129 python/paddle/static/amp/bf16/amp_lists.py✅(2023/8/25) @DrRyanHuang #56121
126 623 python/paddle/static/amp/bf16/amp_utils.py ✅(2023/8/25) @DrRyanHuang #56121
127 335 python/paddle/static/amp/bf16/decorator.py✅(2023/8/25) @DrRyanHuang #56121
128 286 python/paddle/static/amp/debugging.py✅(2023/8/25) @DrRyanHuang #56121
129 945 python/paddle/static/amp/decorator.py✅(2023/8/25) @DrRyanHuang #56121
130 899 python/paddle/static/amp/fp16_utils.py✅(2023/8/25) @DrRyanHuang #56121
131 371 python/paddle/static/input.py✅(2023/8/25) @DrRyanHuang #56121
132 1925 python/paddle/static/io.py✅(2023/8/25) @DrRyanHuang #56121
133 53 python/paddle/static/log_helper.py✅(2023/8/25) @DrRyanHuang #56121
134 4001 python/paddle/static/nn/common.py✅(2023/8/25) @DrRyanHuang #56121
135 1435 python/paddle/static/nn/control_flow.py✅(2023/8/25) @DrRyanHuang #56121
136 264 python/paddle/static/nn/loss.py✅(2023/8/25) @DrRyanHuang #56121
137 569 python/paddle/static/nn/metric.py✅(2023/8/25) @DrRyanHuang #56121
138 5001 python/paddle/tensor/manipulation.py✅(2023/10/19) @ooooo-create #58189
139 1093 python/paddle/tensor/ops.py @megemini #55295
140 1131 python/paddle/tensor/search.py✅(2023/10/19) @ooooo-create #58189
141 2040 python/paddle/static/quantization/post_training_quantization.py✅(2023/9/18) @Candy2Tang #56238
142 289 python/paddle/static/quantization/quant_int8_mkldnn_pass.py✅(2023/8/15) @Candy2Tang #56239
143 3512 python/paddle/static/quantization/quantization_pass.py✅(2023/8/21) @Candy2Tang #56240
144 357 python/paddle/text/datasets/conll05.py✅(2023/8/25) @ooooo-create #56579
145 150 python/paddle/text/datasets/imdb.py✅(2023/8/25) @ooooo-create #56579
146 177 python/paddle/text/datasets/imikolov.py✅(2023/8/25) @ooooo-create #56579
147 238 python/paddle/text/datasets/movielens.py✅(2023/8/25) @ooooo-create #56579
148 130 python/paddle/text/datasets/uci_housing.py✅(2023/8/25) @ooooo-create #56579
149 207 python/paddle/text/datasets/wmt14.py✅(2023/8/25) @ooooo-create #56579
150 276 python/paddle/text/datasets/wmt16.py ✅(2023/8/17) @enkilee #56178
151 143 python/paddle/text/viterbi_decode.py✅(2023/8/17) @enkilee #56178
152 107 python/paddle/vision/models/_utils.py ✅(2023/8/17) @enkilee #56178
153 224 python/paddle/vision/models/alexnet.py✅(2023/8/17) @enkilee #56178
154 511 python/paddle/vision/models/densenet.py✅(2023/8/17) @enkilee #56178
155 277 python/paddle/vision/models/googlenet.py ✅(2023/8/17) @enkilee #56178
156 632 python/paddle/vision/models/inceptionv3.py✅(2023/8/17) @enkilee #56178
157 72 python/paddle/vision/models/lenet.py✅(2023/8/17) @enkilee #56178
158 302 python/paddle/vision/models/mobilenetv1.py✅(2023/8/17) @enkilee #56178
159 241 python/paddle/vision/models/mobilenetv2.py✅(2023/8/17) @enkilee #56178
160 502 python/paddle/vision/models/mobilenetv3.py✅(2023/8/17) @enkilee #56178
161 818 python/paddle/vision/models/resnet.py✅(2023/8/21) @liyongchao911 #56422
162 579 python/paddle/vision/models/shufflenetv2.py✅(2023/8/21) @liyongchao911 #56422
163 285 python/paddle/vision/models/squeezenet.py✅(2023/9/1) @liyongchao911 #56527
164 344 python/paddle/vision/models/vgg.py✅(2023/9/1) @liyongchao911 #56527
165 2335 python/paddle/vision/ops.py✅(2023/9/11) @liyongchao911 #57108
166 1078 python/paddle/vision/transforms/functional.py✅(2023/9/1) @liyongchao911 #56527
167 2111 python/paddle/vision/transforms/transforms.py✅(2023/9/8) @liyongchao911 #56906
168 268 python/paddle/vision/datasets/cifar.py✅(2023/9/8) @liyongchao911 #56906
169 193 python/paddle/vision/datasets/flowers.py✅(2023/9/8) @liyongchao911 #56906
170 94 python/paddle/amp/__init__.py✅(2023/9/8) @liyongchao911 #56906
171 800 python/paddle/amp/auto_cast.py✅(2023/8/22) @whisky-12 #56159
172 632 python/paddle/amp/debugging.py✅(2023/8/22) @whisky-12 #56159
173 1196 python/paddle/amp/grad_scaler.py✅(2023/8/22) @whisky-12 #56159
174 916 python/paddle/device/__init__.py✅(2023/8/22) @whisky-12 #56159
175 537 python/paddle/device/cuda/__init__.py✅(2023/8/22) @whisky-12 #56159
176 60 python/paddle/device/xpu/__init__.py✅(2023/8/22) @whisky-12 #56159
177 982 python/paddle/profiler/profiler.py✅(2023/8/22) @whisky-12 #56159
178 226 python/paddle/profiler/utils.py✅(2023/8/22) @whisky-12 #56159
179 441 python/paddle/sparse/binary.py✅(2023/8/22) @whisky-12 #56159
180 298 python/paddle/sparse/creation.py✅(2023/8/22) @whisky-12 #56159
181 82 python/paddle/sparse/multiary.py✅(2023/8/29) @ooooo-create #56665
182 280 python/paddle/distributed/auto_parallel/interface.py✅(2023/8/29) @ooooo-create #56665
183 316 python/paddle/distributed/auto_parallel/process_mesh.py✅(2023/8/29) @ooooo-create #56665
184 128 python/paddle/distributed/auto_parallel/static/cluster_v2.py✅(2023/9/5) @ooooo-create #56666
185 537 python/paddle/distributed/auto_parallel/static/converter.py✅(2023/9/5) @ooooo-create #56666
186 1873 python/paddle/distributed/auto_parallel/static/engine.py✅(2023/8/22) @PommesPeter #56166
187 147 python/paddle/distributed/auto_parallel/static/process_mesh_v2.py✅(2023/8/22) @PommesPeter #56166
188 2454 python/paddle/distributed/auto_parallel/static/utils.py✅(2023/8/22) @PommesPeter #56166
189 217 python/paddle/distributed/auto_parallel/strategy.py✅(2023/8/22) @PommesPeter #56166
190 352 python/paddle/distributed/collective.py✅(2023/8/22) @PommesPeter #56166
191 6098 python/paddle/tensor/math.py✅(2023/8/7) @SigureMo #55768
192 127 python/paddle/distributed/communication/all_gather.py✅(2023/8/25) @Liyulingyue #55926
193 60 python/paddle/distributed/communication/all_reduce.py✅(2023/8/25) @Liyulingyue #55926
194 145 python/paddle/distributed/communication/all_to_all.py✅(2023/8/25) @Liyulingyue #55926
195 177 python/paddle/distributed/communication/batch_isend_irecv.py✅(2023/8/25) @Liyulingyue #55926
196 137 python/paddle/distributed/communication/broadcast.py✅(2023/8/25) @Liyulingyue #55926
197 60 python/paddle/distributed/communication/gather.py ✅(2023/8/25) @Liyulingyue #55926
198 283 python/paddle/tensor/array.py✅(2023/8/18) @ooooo-create #56186
199 336 python/paddle/tensor/attribute.py✅(2023/8/18) @ooooo-create #56186

✅ 第 3 批 (整体进展:153/153)

按 merge 的时间顺序,排名不分先后: @megemini (1) @Liyulingyue (30) @ooooo-create (21) @PommesPeter (6) @jinyouzhi (26) @yoyoIcy (16) @yuchen202 (11) @KongAKun (2) @enkilee (11) @whisky-12 (5) @longranger2 (19) @Difers (4) @sunzhongkai588 (1) @DrRyanHuang (1)

序号 行数 文件 认领人 Github id PR 链接
200 2544 python/paddle/tensor/creation.py✅(2023/8/29) @ooooo-create #56685
201 1083 python/paddle/tensor/einsum.py✅(2023/8/30) @Liyulingyue #56472
202 194 python/paddle/distributed/communication/stream/all_gather.py✅(2023/8/14) @Liyulingyue #56171
203 130 python/paddle/distributed/communication/stream/all_reduce.py✅(2023/8/23) @Liyulingyue #56473
204 352 python/paddle/distributed/communication/stream/all_to_all.py✅(2023/8/23) @Liyulingyue #56473
205 133 python/paddle/distributed/communication/stream/broadcast.py✅(2023/8/23) @Liyulingyue #56473
206 130 python/paddle/distributed/communication/stream/gather.py✅(2023/8/23) @Liyulingyue #56473
207 121 python/paddle/distributed/communication/stream/recv.py✅(2023/8/23) @Liyulingyue #56473
208 146 python/paddle/distributed/communication/stream/reduce.py✅(2023/8/23) @Liyulingyue #56473
209 260 python/paddle/distributed/communication/stream/reduce_scatter.py✅(2023/8/23) @Liyulingyue #56473
210 237 python/paddle/distributed/communication/stream/scatter.py✅(2023/8/23) @Liyulingyue #56473
211 120 python/paddle/distributed/communication/stream/send.py✅(2023/9/22) @longranger2 #57301
212 269 python/paddle/distributed/communicator.py✅(2023/8/14) @Liyulingyue #56211
213 200 python/paddle/distributed/fleet/base/orthogonal_strategy.py✅(2023/8/28) @jinyouzhi #56651
214 62 python/paddle/distributed/fleet/base/private_helper_function.py✅(2023/8/14) @Liyulingyue #56212
215 241 python/paddle/distributed/fleet/base/strategy_group.py✅(2023/8/28) @jinyouzhi #56651
216 475 python/paddle/distributed/fleet/base/topology.py ✅(2023/8/28) @jinyouzhi #56651
217 753 python/paddle/distributed/fleet/base/util_factory.py ✅(2023/8/28) @jinyouzhi #56651
218 384 python/paddle/distributed/fleet/data_generator/data_generator.py✅(2023/8/29) @jinyouzhi #56730
219 1652 python/paddle/distributed/fleet/dataset/dataset.py✅(2023/9/25) @jinyouzhi #57601
220 569 python/paddle/distributed/fleet/layers/mpu/mp_layers.py✅(2023/9/25) @jinyouzhi #57601
221 899 python/paddle/distributed/fleet/layers/mpu/mp_ops.py✅(2023/9/25) @jinyouzhi #57601
222 896 python/paddle/distributed/fleet/meta_parallel/parallel_layers/pp_layer.py✅(2023/9/25) @jinyouzhi #57601
223 431 python/paddle/distributed/fleet/metrics/metric.py✅(2023/9/25) @jinyouzhi #57601
224 171 python/paddle/distributed/fleet/model.py✅(2023/9/5) @jinyouzhi #56815
225 92 python/paddle/distributed/fleet/optimizer.py✅(2023/9/5) @jinyouzhi #56815
226 508 python/paddle/distributed/fleet/recompute/recompute.py✅(2023/10/12) @jinyouzhi #57787
227 137 python/paddle/distributed/fleet/utils/__init__.py ✅(2023/10/12) @jinyouzhi #57787
228 1562 python/paddle/distributed/fleet/utils/fs.py✅(2023/10/12) @jinyouzhi #57787
229 865 python/paddle/distributed/fleet/utils/hybrid_parallel_inference.py✅(2023/10/12) @jinyouzhi #57787
230 1256 python/paddle/distributed/parallel.py✅(2023/10/12) @jinyouzhi #57787
231 253 python/paddle/distributed/parallel_with_gloo.py✅(2023/8/14) @Liyulingyue #56213
232 377 python/paddle/distributed/rpc/rpc.py✅(2023/10/10) @jinyouzhi #57591
233 251 python/paddle/distributed/sharding/group_sharded.py ✅(2023/10/10) @jinyouzhi #57591
234 601 python/paddle/distributed/spawn.py✅(2023/10/10) @jinyouzhi #57591
235 3028 python/paddle/distributed/transpiler/distribute_transpiler.py✅(2023/10/10) @jinyouzhi #57591
236 564 python/paddle/distributed/utils/launch_utils.py✅(2023/9/12) @jinyouzhi #57203
237 264 python/paddle/distributed/utils/moe_utils.py✅(2023/9/12) @jinyouzhi #57202
238 2032 python/paddle/distributed/fleet/launch_utils.py✅(2023/9/8) @jinyouzhi #57070
239 1009 python/paddle/incubate/asp/asp.py✅(2023/8/30) @ooooo-create #56731
240 604 python/paddle/incubate/asp/utils.py✅(2023/8/29) @Liyulingyue #56474
241 704 python/paddle/incubate/autograd/functional.py✅(2023/8/25) @PommesPeter #56359
242 288 python/paddle/incubate/autograd/primapi.py✅(2023/8/25) @PommesPeter #56359
243 340 python/paddle/incubate/autograd/primreg.py✅(2023/8/25) @PommesPeter #56359
244 832 python/paddle/incubate/autograd/primx.py✅(2023/8/25) @PommesPeter #56359
245 313 python/paddle/incubate/autograd/utils.py✅(2023/8/25) @PommesPeter #56359
246 158 python/paddle/incubate/autotune.py✅(2023/8/22) @Liyulingyue #56475
247 385 python/paddle/incubate/distributed/fleet/base.py✅(2023/8/22) @Liyulingyue #56475
248 2237 python/paddle/incubate/distributed/fleet/fleet_util.py✅(2023/9/6) @ooooo-create #56772
249 123 python/paddle/incubate/distributed/fleet/parameter_server/ir/ps_dispatche.py✅(2023/9/6) @ooooo-create #56772
250 1364 python/paddle/incubate/distributed/fleet/parameter_server/pslib/__init__.py✅(2023/9/6) @enkilee #56541
251 233 python/paddle/incubate/distributed/models/moe/grad_clip.py ✅(2023/9/6) @enkilee #56541
252 500 python/paddle/incubate/distributed/models/moe/moe_layer.py ✅(2023/9/6) @enkilee #56541
253 1659 python/paddle/incubate/layers/nn.py✅(2023/9/6) @enkilee #56541
254 3599 python/paddle/tensor/linalg.py✅(2023/9/6) @enkilee #56541
255 1150 python/paddle/tensor/logic.py ✅(2023/9/6) @enkilee #56541
256 116 python/paddle/incubate/nn/functional/fused_dropout_add.py✅(2023/9/6) @enkilee #56541
257 75 python/paddle/incubate/nn/functional/fused_ec_moe.py✅(2023/9/6) @enkilee #56541
258 166 python/paddle/incubate/nn/functional/fused_gate_attention.py✅(2023/9/6) @enkilee #56541
259 161 python/paddle/incubate/nn/functional/fused_matmul_bias.py✅(2023/9/6) @enkilee #56541
260 49 python/paddle/incubate/nn/functional/fused_rotary_position_embedding.py✅(2023/9/6) @enkilee #56541
261 1164 python/paddle/incubate/nn/functional/fused_transformer.py ✅(2023/10/18) @ooooo-create #58168
262 59 python/paddle/incubate/nn/functional/rms_norm.py✅(2023/10/18) @ooooo-create #58168
263 1674 python/paddle/distributed/fleet/fleet.py✅(2023/10/18) @ooooo-create #58168
264 78 python/paddle/incubate/nn/layer/fused_dropout_add.py✅(2023/9/5) @KongAKun #56907
265 142 python/paddle/incubate/nn/layer/fused_dropout_nd.py✅(2023/9/5) @KongAKun #56907
266 101 python/paddle/incubate/nn/layer/fused_ec_moe.py✅(2023/9/6) @ooooo-create #56772
267 96 python/paddle/incubate/nn/layer/fused_linear.py✅(2023/9/6) @ooooo-create #56772
268 1457 python/paddle/incubate/nn/layer/fused_transformer.py✅(2023/9/6) @ooooo-create #56965
269 224 python/paddle/incubate/nn/layer/io.py✅(2023/9/6) @ooooo-create #56772
270 1474 python/paddle/utils/cpp_extension/extension_utils.py✅(2023/8/22) @Liyulingyue #56476
271 105 python/paddle/utils/dlpack.py✅(2023/8/15) @Liyulingyue #56172
272 387 python/paddle/utils/download.py✅(2023/8/21) @ooooo-create #56438
273 282 python/paddle/utils/install_check.py✅(2023/8/21) @ooooo-create #56438
274 1479 python/paddle/static/nn/sequence_lod.py✅(2023/9/11) @ooooo-create #57146
275 375 python/paddle/distributed/communication/group.py✅(2023/8/22) @Liyulingyue #56476
276 88 python/paddle/distributed/communication/recv.py✅(2023/8/22) @Liyulingyue #56476
277 185 python/paddle/distributed/communication/reduce.py✅(2023/8/22) @Liyulingyue #56476
278 119 python/paddle/distributed/communication/reduce_scatter.py✅(2023/8/22) @Liyulingyue #56476
279 145 python/paddle/distributed/communication/scatter.py✅(2023/8/22) @Liyulingyue #56476
280 89 python/paddle/distributed/communication/send.py✅(2023/8/22) @Liyulingyue #56476
281 1171 python/paddle/tensor/random.py✅(2023/9/22) @longranger2 #57301
282 704 python/paddle/tensor/stat.py✅(2023/8/21) @ooooo-create #56438
283 413 python/paddle/tensor/to_string.py✅(2023/8/21) @ooooo-create #56438
284 73 python/paddle/incubate/nn/loss.py✅(2023/8/31) @yuchen202 #56784
285 175 python/paddle/incubate/operators/graph_khop_sampler.py✅(2023/8/31) @yuchen202 #56784
286 162 python/paddle/incubate/operators/graph_reindex.py✅(2023/9/7) @yuchen202 #56797
287 181 python/paddle/incubate/operators/graph_sample_neighbors.py ✅(2023/9/7) @yuchen202 #56797
288 212 python/paddle/incubate/operators/graph_send_recv.py✅(2023/9/7) @yuchen202 #56797
289 68 python/paddle/incubate/operators/softmax_mask_fuse.py ✅(2023/9/7) @yuchen202 #56797
290 71 python/paddle/incubate/operators/softmax_mask_fuse_upper_triangle.py✅(2023/9/7) @yuchen202 #56797
291 77 python/paddle/incubate/operators/unzip.py✅(2023/9/1) @jinyouzhi #56826
292 598 python/paddle/nn/functional/norm.py✅(2023/8/31) @jinyouzhi #56825
293 480 python/paddle/vision/datasets/folder.py✅(2023/8/25) @ooooo-create #56458
294 313 python/paddle/vision/datasets/mnist.py✅(2023/8/25) @ooooo-create #56458
295 192 python/paddle/vision/datasets/voc2012.py✅(2023/8/25) @ooooo-create #56458
296 167 python/paddle/vision/image.py✅(2023/8/25) @ooooo-create #56458
297 226 python/paddle/incubate/optimizer/functional/bfgs.py✅(2023/9/6) @yuchen202 #56861
298 336 python/paddle/incubate/optimizer/functional/lbfgs.py✅(2023/9/6) @yuchen202 #56861
299 419 python/paddle/incubate/optimizer/lbfgs.py✅(2023/8/29) @Liyulingyue #56597
300 306 python/paddle/incubate/optimizer/lookahead.py✅(2023/8/31) @Liyulingyue #56598
301 542 python/paddle/incubate/optimizer/modelaverage.py✅(2023/9/5) @Liyulingyue #56599
302 483 python/paddle/incubate/passes/ir.py ✅(2023/9/6) @yuchen202 #56861
303 80 python/paddle/incubate/tensor/manipulation.py✅(2023/8/30) @yoyoIcy #56777
304 282 python/paddle/incubate/tensor/math.py✅(2023/9/11) @yoyoIcy #57127
305 705 python/paddle/incubate/xpu/resnet_block.py✅(2023/8/25) @Liyulingyue #56600
306 1232 python/paddle/nn/layer/conv.py✅(2023/7/18) @megemini #55295
307 181 python/paddle/distributed/entry_attr.py✅(2023/8/30) @Liyulingyue #56595
308 597 python/paddle/distributed/io.py✅(2023/9/22) @longranger2 #57301
309 227 python/paddle/distributed/models/moe/utils.py✅(2023/8/31) @Liyulingyue #56596
310 207 python/paddle/sparse/nn/functional/activation.py✅(2023/9/11) @yoyoIcy #57128
311 635 python/paddle/sparse/nn/functional/conv.py✅(2023/9/11) @yoyoIcy #57129
312 100 python/paddle/sparse/nn/functional/pooling.py✅(2023/9/11) @yoyoIcy #57130
313 96 python/paddle/sparse/nn/functional/transformer.py✅(2023/9/18) @yoyoIcy #57131
314 238 python/paddle/sparse/nn/layer/activation.py✅(2023/9/11) @yoyoIcy #57132
315 786 python/paddle/sparse/nn/layer/conv.py✅(2023/9/11) @yoyoIcy #57133
316 417 python/paddle/sparse/nn/layer/norm.py✅(2023/9/11) @yoyoIcy #57135
317 108 python/paddle/sparse/nn/layer/pooling.py✅(2023/9/11) @yoyoIcy #57136
318 1155 python/paddle/sparse/unary.py✅(2023/9/11) @whisky-12 #56748
319 501 paddle/fluid/operators/fused/fused_elemwise_activation_op.cc✅(2023/9/11) @whisky-12 #56748
320 418 paddle/fluid/pybind/cuda_streams_py.cc✅(2023/9/11) @whisky-12 #56748
321 589 paddle/fluid/pybind/custom_device_py.cc✅(2023/9/11) @whisky-12 #56748
322 1255 paddle/fluid/pybind/inference_api.cc ✅(2023/9/11) @whisky-12 #56748
323 3027 paddle/fluid/pybind/imperative.cc✅(2023/9/22) @longranger2 #57301
324 1123 paddle/fluid/pybind/parallel_executor.cc✅(2023/10/11) @longranger2 #57565
325 679 paddle/fluid/pybind/place.cc✅(2023/9/27) @sunzhongkai588 #57610
326 2820 paddle/fluid/pybind/pybind.cc✅(2023/9/12) @Difers #57155
327 1093 paddle/fluid/pybind/tensor.cc✅(2023/9/12) @Difers #57155
328 2756 python/paddle/base/backward.py ✅(2023/9/12) @Difers #57155
329 1264 python/paddle/base/compiler.py ✅(2023/9/12) @Difers #57155
330 259 python/paddle/base/data_feed_desc.py✅(2023/9/12) @yoyoIcy #57137
331 478 python/paddle/base/data_feeder.py✅(2023/9/18) @yoyoIcy #57138
332 1437 python/paddle/base/dataset.py ✅(2023/9/11) @yoyoIcy #57143
333 935 python/paddle/base/dygraph/base.py✅(2023/10/11) @longranger2 #57565
334 246 python/paddle/base/dygraph/math_op_patch.py✅(2023/9/11) @yoyoIcy #57141
335 1016 python/paddle/base/dygraph/tensor_patch_methods.py✅(2023/9/11) @yoyoIcy #57144
336 2841 python/paddle/base/executor.py✅(2023/10/11) @longranger2 #57565
337 7660 python/paddle/base/framework.py✅(2023/9/11) @ooooo-create #57151
338 119 python/paddle/base/initializer.py✅(2023/9/11) @yoyoIcy #57140
339 506 python/paddle/base/io.py✅(2023/9/11) @longranger2 #57087
340 542 python/paddle/base/layer_helper_base.py ✅(2023/9/11) @longranger2 #57087
341 1547 python/paddle/base/layers/control_flow.py ✅(2023/9/11) @longranger2 #57087
342 607 python/paddle/base/layers/learning_rate_scheduler.py @longranger2
343 662 python/paddle/base/layers/math_op_patch.py✅(2023/9/11) @longranger2 #57087
344 280 python/paddle/base/layers/nn.py @longranger2
345 125 python/paddle/base/layers/tensor.py✅(2023/9/11) @longranger2 #57134
346 133 python/paddle/base/lazy_init.py ✅(2023/9/11) @longranger2 #57134
347 170 python/paddle/base/lod_tensor.py✅(2023/9/11) @longranger2 #57134
348 54 python/paddle/base/log_helper.py✅(2023/9/11) @longranger2 #57134
349 6729 python/paddle/base/optimizer.py @longranger2
350 307 python/paddle/base/param_attr.py✅(2023/9/11) @longranger2 #57134
351 1667 python/paddle/base/reader.py✅(2023/9/11) @longranger2 #57134
352 225 python/paddle/base/unique_name.py ✅(2023/9/11) @longranger2 #57134
353 2633 paddle/fluid/pybind/eager_method.cc✅(2023/10/11) @longranger2 #57565
354 1769 setup.py & python/setup.py.in✅(2023/9/19) @PommesPeter #57440
355 657 paddle/fluid/pybind/pir.cc ✅(2023/11/2) @DrRyanHuang #58177
356 305 python/paddle/ir/core.py✅(2023/9/19) @yuchen202 #57437

共计 352 个文件,刨去 ./python/paddle/base(原 fluid 目录),共计 327 个文件。

共计 242464 行,刨去 ./python/paddle/base(原 fluid 目录),共计 209899 行。

部分文件已经修改,可以跳过。


Update 20230922

commit 579103d91e

关联 #54705

任务三:

✅清理遗留代码 (task: cleanup) (整体进展:18/18)

按 merge 的时间顺序,排名不分先后: @megemini (8) @yuchen202 (4) @ooooo-create (7)

序号 文件 认领人 Github id PR 链接
357 paddle/fluid/pybind/eager_properties.cc✅(2023/9/25) @megemini #57670
358 python/paddle/base/dataset.py✅(2023/9/25) @megemini #57670
359 python/paddle/base/framework.py✅(2023/9/25) @megemini #57670
360 python/paddle/base/reader.py✅(2023/9/25) @megemini #57670
361 python/paddle/decomposition/register.py✅(2023/9/25) @megemini #57670
362 python/paddle/distributed/auto_parallel/api.py✅(2023/9/25) @megemini #57670
363 python/paddle/distributed/fleet/base/distributed_strategy.py✅(2023/9/25) @megemini #57670
364 python/paddle/distributed/fleet/base/role_maker.py✅(2023/9/25) @megemini #57670
365 python/paddle/incubate/nn/functional/fused_layer_norm.py✅(2023/11/3) @ooooo-create #58178
366 python/paddle/incubate/nn/functional/fused_rms_norm.py✅(2023/11/3) @ooooo-create #58168
367 python/paddle/incubate/nn/functional/masked_multihead_attention.py ✅(2023/11/3) @ooooo-create #58178
368 python/paddle/incubate/nn/functional/variable_length_memory_efficient_attention.py✅(2023/11/3) @ooooo-create #58178
369 python/paddle/incubate/optimizer/gradient_merge.py✅(2023/11/3) @ooooo-create #58178
370 python/paddle/incubate/optimizer/lars_momentum.py✅(2023/11/3) @ooooo-create #58178
371 python/paddle/incubate/optimizer/pipeline.py ✅(2023/10/17) @yuchen202 #57825
372 python/paddle/incubate/optimizer/recompute.py✅(2023/10/17) @yuchen202 #57825
373 python/paddle/nn/quant/quantized_linear.py✅(2023/10/17) @yuchen202 #57825
374 python/paddle/optimizer/optimizer.py✅(2023/10/17) @yuchen202 #57825

✅ 清理无 reason 的 skip 示例 (task: skip_no_reason) (整体进展:15/15)

按 merge 的时间顺序,排名不分先后: @megemini (1) @SigureMo (4) @ooooo-create (5) @enkilee (4)

序号 文件 认领人 Github id PR 链接
375 python/paddle/base/dataset.py✅(2023/9/25) @megemini #57670
376 python/paddle/distribution/bernoulli.py✅(2023/10/18) @ooooo-create #58173
377 python/paddle/distribution/categorical.py✅(2023/10/18) @ooooo-create #58173
378 python/paddle/distribution/gumbel.py✅(2023/10/18) @ooooo-create #58173
379 python/paddle/hapi/dynamic_flops.py✅(2023/10/18) @ooooo-create #58173
380 python/paddle/hapi/model.py✅(2023/10/18) @ooooo-create #58173
381 python/paddle/hapi/model_summary.py✅(2023/10/18) @ooooo-create #58173
382 python/paddle/jit/api.py ✅(2023/9/27) @SigureMo #57676
383 python/paddle/jit/dy2static/convert_call_func.py ✅(2023/9/27) @SigureMo #57676
384 python/paddle/jit/dy2static/program_translator.py ✅(2023/9/27) @SigureMo #57676
385 python/paddle/jit/translated_layer.py ✅(2023/9/27) @SigureMo #57676
386 python/paddle/nn/functional/flash_attention.py ✅(2023/10/25) @enkilee #58206
387 python/paddle/quantization/config.py ✅(2023/10/25) @enkilee #58206
388 python/paddle/quantization/factory.py ✅(2023/10/25) @enkilee #58206
389 python/paddle/tensor/linalg.py ✅(2023/10/25) @enkilee #58206
@megemini
Copy link
Contributor Author

megemini commented Jul 23, 2023

大家好!

目前项目中的 python 示例代码大多采用无提示符的裸代码形式,如:

def test():
    """ This is a test...

    Examples:
        .. code-block:: python

            import paddle
            paddle.utils.run_check()
    """

这样的书写方式给示例代码的检查带来较多不便。

最新版本的 Paddle 已经引入 xdoctest 辅助进行示例代码的检查,为了更好的规范示例代码的编写与测试其功能的正确性,特开此活动,目的是将上述示例代码改写为有提示符 (>>> ... ) 的形式并开展示例代码检查,如:

def test():
    """ This is a test...

    Examples:
        .. code-block:: python

            >>> import paddle
            >>> paddle.utils.run_check()
    """

欢迎大家参与! 非常感谢!:) 🎉🎉🎉

此 ISSUE 是 赛题五:将 xdoctest 引入到飞桨框架工作流中 Tracking Issue 的第二个批量任务。

  • 参与的流程大致为:

    1. 任务认领
    2. 修改示例
    3. 提交 PR
    4. 任务收尾
  • 该任务时间:任务计划完成时间 9月8日。

  • PR 通过 CI 后,可以评论里或者 review request @sunzhongkai588 @SigureMo @megemini 研发会进行审核

✨ 点击下列标题查看详情!✨

✨ 任务认领

直接在 ISSUE 下回复认领的任务 ID 即可。

由于任务较多,特制定以下认领规则:

  • 此次任务分批次开放认领,

    第一批次开放日期:7月24日,

    第二批次及后续开放时间待定(大约每两周发放一批)。

  • 同一批次中可认领多个任务。

  • 在没有完成上一批次的任务之前,请勿再次认领新批次的任务。

✨ 修改示例

认领完任务之后便可以进行示例的修改。

如前面所述,此次任务是:

** 将裸代码修改为添加提示符的代码 **

也就是把文件中的 docstring 中的 .. code-block:: python 中的示例代码,在保持原示例流程不变的情况下,添加:

  • >>> : 单行代码
  • ... : 多行代码

使其能够在 python shell 中运行。

有几个需要注意的地方:

  • 部分示例代码年代久远,修改时需要在最新的环境 (Paddle 2.5) 中验证。

  • 如果原示例代码有输出,请统一修改为 >>> print(xxx) 的方式,如:

    原示例,采用 # 单独输出:

    res = linear(data)
    print(linear.weight)
    # Tensor(shape=[2, 4], dtype=float32, place=Place(gpu:0), stop_gradient=False,
    #        [[2., 2., 2., 2.],
    #         [2., 2., 2., 2.]])

    修改为:

    >>> res = linear(data)
    >>> print(linear.weight)
    Tensor(shape=[2, 4], dtype=float32, place=Place(cpu), stop_gradient=False,
    [[2., 2., 2., 2.],
    [2., 2., 2., 2.]])

    注意输出的缩进要统一,注意输出的小数要与实际输出一致。

    原示例,输出与代码同一行:

    import paddle
    from paddle.signal import stft, istft
    
    # STFT
    x = paddle.randn([8, 48000], dtype=paddle.float64)
    y = stft(x, n_fft=512)  # [8, 257, 376]

    修改为:

    >>> import paddle
    >>> from paddle.signal import stft, istft
    
    # STFT
    >>> x = paddle.randn([8, 48000], dtype=paddle.float64)
    >>> y = stft(x, n_fft=512)
    >>> print(y.shape)
    [8, 257, 376]

    原示例,默认给出输出的:

    import paddle
    from paddle.signal import stft, istft
    
    # STFT
    x = paddle.randn([8, 48000], dtype=paddle.float64)
    y = stft(x, n_fft=512)  
    # [8, 257, 376]

    修改为:

    >>> import paddle
    >>> from paddle.signal import stft, istft
    
    # STFT
    >>> x = paddle.randn([8, 48000], dtype=paddle.float64)
    >>> y = stft(x, n_fft=512)
    >>> print(y.shape)
    [8, 257, 376]
  • 如果没有 GPU、XPU 等需求,输出请按照 CPU 的格式打印,如:

    请勿输出:

    >>> a = paddle.to_tensor(0.1)
    >>> print(a)
    Tensor(shape=[1], dtype=float32, place=Place(gpu:0), stop_gradient=True,
    [0.10000000])

    而是输出:

    >>> a = paddle.to_tensor(0.1)
    >>> print(a)
    Tensor(shape=[1], dtype=float32, place=Place(cpu), stop_gradient=True,
    [0.10000000])

    为此,可以在本地先执行:

    >>> paddle.device.set_device('cpu')
  • 如果有 GPU、XPU 等需求,请使用 # doctest: +REQUIRES(env:XXX),并设置 device,如:

    原示例:

    # required: gpu
    import paddle
    s1 = paddle.device.cuda.current_stream(paddle.CUDAPlace(0)) 

    替换为:

    >>> # doctest: +REQUIRES(env:GPU)
    >>> import paddle
    >>> paddle.device.set_device('gpu')
    >>> s1 = paddle.device.cuda.current_stream(paddle.CUDAPlace(0)) 

    这里需要修改:

    • # required: gpu# doctest: +REQUIRES(env:GPU)
    • 增加 paddle.device.set_device('gpu')
  • 如果原示例代码中有 # required: skiptest 标注,可以使用 # doctest: +SKIP 代替,并写明跳过的原因,如:

    原示例:

    # required: skiptest
    import paddle

    替换为:

    >>> # doctest: +SKIP('blabla...')
    >>> import paddle
  • 如果原示例代码中包含随机的部分,请先使用 paddle.seed ,如:

    >>> import paddle
    >>> print(paddle.uniform(shape=[2]) )
    Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
       [0.73167229, 0.04029441])

    修改为:

    >>> import paddle
    >>> paddle.seed(2023)
    >>> print(paddle.uniform(shape=[2]) )
    Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
       [0.73167229, 0.04029441])

    如果随即种子设置仍不可行,可以使用 # doctest: +SKIP ,如:

    >>> import paddle
    >>> from paddle.distribution import Bernoulli
    >>> rv = Bernoulli(0.3)
    >>> # doctest: +SKIP('random sample')
    >>> rsample = rv.rsample([3, ])
    >>> print(rsample)
    >>> # doctest: -SKIP
    >>> print(rv.entropy())

    注意,最后一行代码不受随机影响,可以使用 # doctest: -SKIP 恢复测试。

  • 如果原示例代码无法使用 xdoctest 进行检查,可以使用 # doctest: +SKIP ,如:

    >>> def foo():
    ...     return
    
    >>> import inspect
    >>> print(inspect.getsourcelines(foo))

    使用 xdoctest 抛出异常:

    File "/usr/lib/python3.8/inspect.py", line 798, in findsource
        raise OSError('could not get source code')

    可以使用 # doctest: +SKIP

    >>> # doctest: +SKIP('raise OSError')
    >>> def foo():
    ...     return
    
    >>> import inspect
    >>> print(inspect.getsourcelines(foo))
  • 对于代码块中的 连续代码 的空行,要使用 ... 连接,或者去掉此空行,如:

    原示例:

    >>> def func(x):
    ...     if paddle.mean(x) < 0:
    ...         x_v = x - 1
    ...     else:
    ...         x_v = x + 1
    
    ...     return x_v

    修改为:

    >>> def func(x):
    ...     if paddle.mean(x) < 0:
    ...         x_v = x - 1
    ...     else:
    ...         x_v = x + 1
    ...
    ...     return x_v

    或者:

    >>> def func(x):
    ...     if paddle.mean(x) < 0:
    ...         x_v = x - 1
    ...     else:
    ...         x_v = x + 1
    ...     return x_v
  • 对于输出较多的地方,可以在输出中使用 ... 作为 通配符 使用,如:

    >>> sampler = MySampler(data_source=RandomDataset(100))
    >>> for index in sampler:
    ...     print(index)
    0
    1
    2
    ...
    99
  • 对于多行的矩阵显示,如:

    >>> print(sn_conv.weight)
    Tensor(shape=[1, 3, 3, 3], dtype=float32, place=Place(cpu), stop_gradient=False,
    [[[[ 0.01668976,  0.30305523,  0.11405435],
       [-0.06765547, -0.50396705, -0.40925547],
       [ 0.47344422,  0.03628403,  0.45277366]],
      [[-0.15177251, -0.16305730, -0.15723954],
       [-0.28081197, -0.09183260, -0.08081978],
       [-0.40895155,  0.18298769, -0.29325116]],
      [[ 0.21819633, -0.01822380, -0.50351536],
       [-0.06262003,  0.17713565,  0.20517939],
       [ 0.16659889, -0.14333329,  0.05228264]]]])

    使用上面的 括号 对齐方式。

    请注意:不要留有空行!,最好也不要有大量无意义的空格。

    在此基础上,以个人觉得美观即可~

xdoctest 的使用可以参考:https://xdoctest.readthedocs.io/en/latest/

Paddle 中引入 xdoctest 的详细修改设计可以参考:[Add] Paddle 代码 CI 中引入 xdoctest 检查

为了方便大家修改,这里做了一个简单的转换工具

🛠🛠 convert_doctest 🛠🛠

针对单个文件的修改,首先使用 convert-doctest 将旧格式转换为新格式:

$ convert-doctest convert source_file.py --target target_file.py

如果在同一个文件修改:

$ convert-doctest convert source_file.py

修改完之后,还需要手动检查、修改示例的输出部分。

最后,对单个文件进行检查:

$ convert-doctest --debug doctest target_file.py

工具可以帮助大家添加 >>> ... ,但是,由于任务文件较多,不能一一验证,而且工具也无法帮忙转写 print 函数的输出,所以,还请大家在使用工作转写之后进一步手动修改与确认!

即便如此,工具如果不出 bug,至少还是能够提升效率一倍的 ~

欢迎大家提 PR ~ 🤩

除了使用上述工具之外,由于此次使用的工具是 xdoctest,而每次线上等 CI 跑完就太慢了,所以,也可以使用 xdoctest 命令行先在本地验证一下修改的正确性,如:

$ xdoctest \
  --debug --options "+IGNORE_WHITESPACE" --style "freeform" \
  --global-exec "import paddle\npaddle.device.set_device('cpu')" \
  test.py

这里的参数 --global-exec "import paddle\npaddle.device.set_device('cpu')" 请务必加上。test.py 是需要检查的文件。由于直接检查 Paddle 项目中的文件可能存在各种路径依赖问题,所以,建议可以把修改完的示例代码单独封装到一个 python 文件中,单独检查,如:

示例代码:

>>> def func(x):
...     if paddle.mean(x) < 0:
...         x_v = x - 1
...     else:
...         x_v = x + 1
...     return x_v

封装为 test.py

def test():
    """
    >>> def func(x):
    ...     if paddle.mean(x) < 0:
    ...         x_v = x - 1
    ...     else:
    ...         x_v = x + 1
    ...     return x_v
    """
    pass

然后用上面的命令来检查修改的正确性:

$ xdoctest --global-exec "import paddle\npaddle.device.set_device('cpu')" test.py

=====================================
_  _ ___  ____ ____ ___ ____ ____ ___
 \/  |  \ |  | |     |  |___ [__   |
_/\_ |__/ |__| |___  |  |___ ___]  |

=====================================

Start doctest_module('test.py')
Listing tests
============================== static... test.py
gathering tests
running 1 test(s)
====== <exec> ======
* DOCTEST : test.py::test:0, line 3 <- wrt source file
DOCTEST SOURCE
1 >>> def func(x):
2 ...     if paddle.mean(x) < 0:
3 ...         x_v = x - 1
4 ...     else:
5 ...         x_v = x + 1
6 ...     return x_v
DOCTEST STDOUT/STDERR
DOCTEST RESULT
* SUCCESS: test.py::test:0
====== </exec> ======
============
=== 1 passed in 18.15 seconds ===

最后,示例修改完在 commit 的时候,需要增加 test=docs_preview,如:

$ git commit -m "[Doctest]fix No.1, test=docs_preview"

这样,在 PR-CI-Paddle-Doc-Preview 流水线看到中英文文档了。

注意 PR-CI-Paddle-Doc-Preview 默认最后给出一个英文文档的链接,打开链接后可以手动切换至中文文档。

✨ 提交 PR

每个任务需要提交至少一个 PR:

  • Paddle PR,对应任务代码的修改。

Paddle PR 的模板(如,此 PR 对应任务 No.1):

PR 标题: [xdoctest][task 1] reformat example code with google style in nn/utils/transform_parameters.py,一个 PR 里提交多个任务可以使用 [xdoctest][task 11-18] reformat example code with google style in audio/*

上面的 xxx 可以是其他补充信息,如,如果多次提交 PR 的话,可以补充此 PR 的主要文件。

<!-- Demo: https://github.com/PaddlePaddle/Paddle/pull/24810 -->
### PR types
<!-- One of [ New features | Bug fixes | Function optimization | Performance optimization | Breaking changes | Others ] -->
Others

### PR changes
<!-- One of [ OPs | APIs | Docs | Others ] -->
Others

### Description
<!-- Describe what you’ve done -->

修改如下文件的示例代码,使其通过 `xdoctest` 检查:

- `XXX.py`
- `XXX.py`

预览:

- en: http://preview-paddle-pr-XXX.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/en/api/paddle/jit/XXX_en.html
- zh: http://preview-paddle-pr-XXX.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/jit/XXX_cn.html

### Related links
 
- #55629
- #55295

@sunzhongkai588 @SigureMo @megemini 

提交 PR 可直接复制上述模板,修改相应的 XXX 部分,也可补充说明。

✨ 任务收尾

PR 提交之后,需要在 CI 的流程线中确认:

  • PR-CI-Static-Check

    • 是否修改的文件,其中 所有 的 API 都经 xdoctest 进行测试。
    • 是否上面所有的测试都已通过。
  • PR-CI-Paddle-Doc-Preview

    • 是否修改的文件,其中 所有 的中英文 API 都显示了示例代码。
    • 是否上面所有的示例代码显示正确。

注意

  • 部分接口以及私有方法不在系统检查的范围内,如有发现,可在 PR 中说明。
  • 中英文文档示例中的 # doctest: XXX 会默认不渲染。

最后,任务收尾:

  • Merge/Close Paddle 代码的 PR

顺便提醒 reviewer 在此 ISSUE 中 check 任务的状态~

至此,一个任务就算是圆满完工!🎉🎉🎉

最后的最后,还是非常感谢大家的贡献!:)

关联链接:

@SigureMo @luotao1 @jzhang533 @sunzhongkai588

@SigureMo
Copy link
Member

@megemini 这个任务可以先不急着发放,我这两天会先尝试按照流程走一遍,看看流程里是否有我或者其他开发者不明白的地方,也可以作为示例 PR

@paddle-bot paddle-bot bot added the PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc label Jul 23, 2023
@luotao1
Copy link
Contributor

luotao1 commented Jul 24, 2023

请问第一批/第二批/第三批有什么区别?可以一次性放出来么?

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Jul 24, 2023
@megemini
Copy link
Contributor Author

请问第一批/第二批/第三批有什么区别?可以一次性放出来么?

分批次出于以下考虑:

  • 第二批任务涉及较多 xdoctest 指令,如需要 gpu、xpu 等,
  • 第三批任务涉及 c++ 中的示例修改,
  • 第一批任务可以先练练手。
  • 任务较多,分批次的话方便阶段性的总结调整。

至于是否一次性放出来,@SigureMo 看看,如果可以的话,一次性放出来也行~

@luotao1
Copy link
Contributor

luotao1 commented Jul 24, 2023

分任务的时候可以看下行数,比如 python/paddle/incubate/tensor/math.py有6000多行,就不适合和其他任务合并在一起了。 @megemini 看看要不要调整下

@sunzhongkai588
Copy link
Contributor

有一个疑问以及一个需要改正的地方:

  • 疑问:这个 Docs 的临时 pr 应该提交什么内容?我理解 docs 应该不需要修改任何文件,那么应该创建不了pr吧? (@megemini ) 如果只是想看中文预览效果,是不是 paddle repo的PR预览链接里,能直接看对应的效果?( @SigureMo 我不太确定)

Paddle Docs PR,是一个临时 PR,用于检查修改后的示例显示正确。

@megemini
Copy link
Contributor Author

是不是 paddle repo的PR预览链接里,能直接看对应的效果

我看了一下 PR-CI-Paddle-Doc-Preview 的日志,只给了个英文的链接 http://preview-paddle-pr-55645.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/en/api/paddle/abs_en.html,但是能手动跳转到中文预览的页面上~ @SigureMo 这样的话还需要 docs 的 PR 吗?

改正:NO.23的 ./python/paddle/distributed/fleet/base/distributed_strategy.py skip吧

收到!

@SigureMo
Copy link
Member

我看了一下 PR-CI-Paddle-Doc-Preview 的日志,只给了个英文的链接 http://preview-paddle-pr-55645.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/en/api/paddle/abs_en.html,但是能手动跳转到中文预览的页面上~ @SigureMo 这样的话还需要 docs 的 PR 吗?

可以的话就不要了吧,我之前一直以为不可以 😂

@gouzil
Copy link
Member

gouzil commented Jul 30, 2023

认领44-47, 56-59

@longranger2
Copy link
Contributor

认领12-20

@Liyulingyue
Copy link
Contributor

Liyulingyue commented Jul 31, 2023

认领 78 79

@yuchen202
Copy link
Contributor

认领371~374

@yuchen202
Copy link
Contributor

认领376~381

@luotao1
Copy link
Contributor

luotao1 commented Nov 3, 2023

[xdoctest] 分批次修改已有代码的示例 已全部完成,感谢参与的小伙伴们(按 merge 的时间顺序,排名不分先后)!共修改380+个文件、21w行,是一项伟大的工程!

第一批 : @SigureMo (9) @longranger2 (19) @sunzhongkai588 (2) @ooooo-create (15) @enkilee (24) @Liyulingyue (2) @gouzil (14) @Kaedeharai (5) @yuchen202 (8) @jinyouzhi (1)

第二批 : @SigureMo (2) @Candy2Tang (18) @Liyulingyue (8) @AndSonder (4) @PommesPeter (8) @enkilee (11) @ooooo-create (15) @liyongchao911 (10) @whisky-12 (10) @DrRyanHuang (12) @megemini (1)

第三批 : @megemini (1) @Liyulingyue (30) @ooooo-create (21) @PommesPeter (6) @jinyouzhi (26) @yoyoIcy (16) @yuchen202 (11) @KongAKun (2) @enkilee (11) @whisky-12 (5) @longranger2 (19) @Difers (4) @sunzhongkai588 (1) @DrRyanHuang (1)

清理遗留代码 (task: cleanup) : @megemini (8) @yuchen202 (4) @ooooo-create (7)

清理无 reason 的 skip 示例 (task: skip_no_reason) : @megemini (1) @SigureMo (4) @ooooo-create (5) @enkilee (4)

欢迎继续参与 快乐开源的其他活动

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HappyOpenSource 快乐开源活动issue与PR PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/close 已关闭
Projects
Development

No branches or pull requests