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 No.69】PR.md #4721

Merged
merged 9 commits into from
Oct 25, 2022
Merged

【Hackathon No.69】PR.md #4721

merged 9 commits into from
Oct 25, 2022

Conversation

sober-6
Copy link
Contributor

@sober-6 sober-6 commented May 3, 2022

任务69PR提交

@paddle-bot-old
Copy link

paddle-bot-old bot commented May 3, 2022

Thanks for your contribution!

@paddle-bot-old
Copy link

paddle-bot-old bot commented May 3, 2022

✅ This PR's description meets the template requirements!
Please wait for other CI results.




# 三、API使用及对比
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个地方不够细节,API设计是一个比较宏大的事情,大到各个API目录的设计思路,小到API的参数设计,等等都是有自己的设计理念的,可以再多看看。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改




# 四、Tensor 索引
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里也是同理,Tensor 花式索引的方式非常多,Paddle 目前支持哪些,不支持哪些,这些都可以详细谈谈。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改




# 五、NumPy兼容性分析及对比
Copy link
Collaborator

Choose a reason for hiding this comment

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

numpy 的兼容性包括对numpy API的重写、Tensor 操作的支持等。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改


这部分在Paddle使用过程中,优化器等trick的使用体验与Pytorch感觉没有区别

# 八、报错汇总
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

Choose a reason for hiding this comment

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

已添加修改

@sober-6 sober-6 requested a review from TCChenlong May 10, 2022 00:11

# 三、API使用及对比

## 一、从PaddlePaddle的各个API目录来对比分析
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

Choose a reason for hiding this comment

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

已修改


在paddle.io.DataLoader中, feed_list 表示feed变量列表,PyTorch无此参数。 use_shared_memory 表示是否使用共享内存来提升子进程将数据放入进程间队列的速度,PyTorch无此参数。

在torch.utils.data.DataLoader中,prefetch_factor 表示每个worker预先加载的数据数量,PaddlePaddle无此参数;还有就是PyTorch可通过设置sampler自定义数据采集器,PaddlePaddle无此功能,只能自定义一个DataLoader来实现该功能,会有些繁琐。总的来说,这部分Pytorch的体验更好一些。
Copy link
Collaborator

Choose a reason for hiding this comment

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

Paddle 有 batch_sample 可以实现

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改


​ 从整体的API使用上,感觉paddle升级后的 paddle.xxx (例如:paddle.device paddle.nn paddle.vision )比之前的 padddle.fluid.xxx 好用很多,还有就是新增加的高层API个人比较喜欢,一是对初学者比较友好、易用,二是对于开发者可以节省代码量,更简洁直观一些,在(六、动态图单机训练)中进行了代码展示和对比分析。

与Pytorch相比,基础API的结构和调用没有太大区别,但是在速度上,paddle的基础API会更快一点,如果是利用了paddle高层API,速度会快很多,在同样epoch的情况下,能减少大约三分之二的训练时间。
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

Choose a reason for hiding this comment

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

已修改

pred_boxes[:, 3] = pred_ctr_y + 0.5 * pred_h

# paddlepaddle code
pred_boxes = fluid.layers.concat([
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里别使用 fluid 下的API

示例2:不能维度直接赋值

```python
#报错:
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

Choose a reason for hiding this comment

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

已修改

# pytorch code
bbox_x[bind, :, np.newaxis ]
# paddlepaddle code
fluid.layers.reshape(bbox_x[bind, :], [1, -1, 1])
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

Choose a reason for hiding this comment

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

已修改


```

**示例3: tensor的值不能直接利用**
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里也是同理,没有示例代码的bug

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改,在下面


```

**三、Paddle 目前支持的Tensor索引规则:**
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里更希望能整理一个目前花式索引的功能合集:然后列举下 Paddle 支持的状态;以及不支持的场景下,是否可以通过其他方式实现。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的


**1、关于numpy API的重写**

在Paddle动态图单机训练中,NumPy在Paddle的体验,感觉和Pytorch的体验并无区别,但是 所有与组网相关的 numpy 操作都必须用 paddle 的 API 重新实现 ,这一点个人认为需要注意,因为在习惯使用Pytorch代码逻辑时,转为PaddlePaddle容易出错,下面举例说明:
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的差别其实很大的,包含面向不同功能的API(比如创建、线性代数),以及API的数量多少,以及有没有某些设计上的习惯,都是需要分析一下的。


与Pytorch相比,Paddle文档中提供的代码下载不了数据集,需要手动下载。

# 七、各种 trick 的用法
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里可以参考下我们的论文复现赛活动中,各个论文冠军的实现,找找里面的trick用法,目前场景比较少,所以你感觉没有:PaddlePaddle/Paddle#42410

@Ligoml Ligoml merged commit 6df51cb into PaddlePaddle:develop Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants