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

【Fluid Clean】 Rename paddle.fluid to paddle.base #56576

Merged
merged 11 commits into from
Sep 7, 2023

Conversation

Difers
Copy link
Contributor

@Difers Difers commented Aug 23, 2023

PR types

Breaking changes

PR changes

APIs

Description

  • 飞桨2.0版本发布时,将fluid API标记为废弃状态并计划将fluid代码退场。经过近一年的清理工作,python/paddle/fluid目录下由近3000文件数,72W行代码,清理到39个文件,2.9W行代码,原fluid API及相关辅助函数已移除或迁移完毕,仅剩余框架基础组件内容。经过飞桨内部讨论,这部分内容将更名为paddle.base,作为基础组件继续提供功能支持。
  • 在本PR中,python/paddle/fluid目录将更名为python/paddle/base,c++目录paddle/fluid不受影响。这意味着fluid API的彻底退场,用户将不再能调用任何形式的fluid API,如对相关功能仍有需求,可以参考Paddle 1.8 与 Paddle 2.0 API 映射表 ,使用推荐的飞桨2.0API。

@paddle-bot paddle-bot bot added the contributor External developers label Aug 23, 2023
@Difers Difers force-pushed the rename_fluid branch 7 times, most recently from 1bd9c3d to b38d97a Compare August 24, 2023 15:09
${py_src}
COMMENT
"Replacing 'paddle.fluid' with 'paddle.base' generated by protobuf"
COMMENT "Replace ${py_src}")
Copy link
Contributor

Choose a reason for hiding this comment

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

此处是由于当前proto文件存放在paddle/fluid/目录下,在通过protoc工具自动转换成py文件时,文件内容中的import关系仍保持为包含fluid的路径;由于paddle/fluid目录并不在本次改动范围内,不适合调整proto文件本身的位置。因此这里对生成的文件内的import路径做修改。

paddle.fluid.optimizer.PipelineOptimizer.minimize (ArgSpec(args=['self', 'loss', 'startup_program', 'parameter_list', 'no_grad_set'], varargs=None, keywords=None, defaults=(None, None, None)), ('document', '6adf97f83acf6453d4a6a4b1070f3754'))
paddle.base.optimizer.PipelineOptimizer (paddle.base.optimizer.PipelineOptimizer, ('document', '2e55a29dbeb874934f7a1a1af3a22b8c'))
paddle.base.optimizer.PipelineOptimizer.__init__ (ArgSpec(args=['self', 'optimizer', 'num_microbatches', 'start_cpu_core_id'], varargs=None, keywords=None, defaults=(1, 0)), ('document', '6adf97f83acf6453d4a6a4b1070f3754'))
paddle.base.optimizer.PipelineOptimizer.minimize (ArgSpec(args=['self', 'loss', 'startup_program', 'parameter_list', 'no_grad_set'], varargs=None, keywords=None, defaults=(None, None, None)), ('document', '6adf97f83acf6453d4a6a4b1070f3754'))
Copy link
Contributor

Choose a reason for hiding this comment

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

PipelineOptimizer的当前路径是paddle.incubate.optimizer.PipelineOptimizer

# may be remove it later
mkdir -p ${PADDLE_ROOT}/pr && cp -r ${PADDLE_ROOT}/build/pr_whl ${PADDLE_ROOT}/pr
rm -rf ${PADDLE_ROOT}/build && mkdir -p ${PADDLE_ROOT}/build
mv ${PADDLE_ROOT}/pr/pr_whl ${PADDLE_ROOT}/build
Copy link
Contributor

Choose a reason for hiding this comment

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

该PR编译后的产物和环境,由于会产出两份用于develop版本代码编译会造成问题;这段代码仅用于帮助通过build流水线检查,后续将移除

parameter_tar = paddle.dataset.common.download(
FLUID_URL_MODEL, 'uci_housing', FLUID_MD5_MODEL, 'fit_a_line.fluid.tar'
FLUID_URL_MODEL, 'uci_housing', FLUID_MD5_MODEL, 'fit_a_line.base.tar'
Copy link
Contributor

Choose a reason for hiding this comment

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

这个文件中是url和文件名以及函数名,不应该改动

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -158,7 +158,7 @@ def forward(
# Note:
# If not marked non_differentiable, all output tensors' attr `stop gradient`
# will be reset to `False` in c++ backend.
# See https://github.com/PaddlePaddle/Paddle/blob/9d62efb0e6e5373823039d9eda96cd5905426c0a/paddle/fluid/pybind/eager_py_layer.cc#L388
# See https://github.com/PaddlePaddle/Paddle/blob/9d62efb0e6e5373823039d9eda96cd5905426c0a/paddle/base/pybind/eager_py_layer.cc#L388
Copy link
Contributor

Choose a reason for hiding this comment

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

请不要改动url

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -150,7 +150,7 @@ def reader():
return reader


def fluid_model():
def base_model():
Copy link
Contributor

Choose a reason for hiding this comment

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

这个文件中的两处均不应该改动:URL和函数名

@Difers Difers force-pushed the rename_fluid branch 2 times, most recently from 3866b90 to a4b6de9 Compare August 30, 2023 04:56
@@ -393,7 +393,7 @@ void BindTensor(pybind11::module &m) { // NOLINT
Examples:
.. code-block:: python

import paddle.fluid as fluid
import paddle.base as fluid
Copy link
Contributor

Choose a reason for hiding this comment

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

is it better to use import paddle.base as base, and replace fluid.Tensor() with base.Tensor() ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can other example code in this file be processed in the same way

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks for pointing out the mistake.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, works of Document Standardization will be done in open-source task: #55629

@Difers Difers force-pushed the rename_fluid branch 11 times, most recently from 94be2eb to bda9596 Compare September 5, 2023 03:14
@Difers Difers changed the title Rename fluid 【Fluid Clean】 Rename paddle.fluid to paddle.base Sep 5, 2023
Copy link
Contributor

@risemeup1 risemeup1 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@sunzhongkai588 sunzhongkai588 left a comment

Choose a reason for hiding this comment

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

LGTM for docs

Copy link
Contributor

@jeff41404 jeff41404 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@raindrops2sea raindrops2sea left a comment

Choose a reason for hiding this comment

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

LGTM

@raindrops2sea raindrops2sea merged commit e53afe5 into PaddlePaddle:develop Sep 7, 2023
25 of 26 checks passed
SigureMo added a commit to PaddlePaddle/PaddleSOT that referenced this pull request Sep 7, 2023
SigureMo added a commit to PaddlePaddle/PaddleSOT that referenced this pull request Sep 8, 2023
BeingGod pushed a commit to BeingGod/Paddle that referenced this pull request Sep 9, 2023
* rename fluid to base

* fix setup and rename paddle.fluid

* fix protobuf generated paddle.fluid

* fix some errors

* fix cmake depends

* fix some error

* try to fix cache error

* fix codestyle && some doc error

* remove build change

* fix some error

---------

Co-authored-by: XiangGao <jeff41404@gmail.com>
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.

None yet

9 participants