Skip to content

Conversation

gouzil
Copy link
Member

@gouzil gouzil commented May 22, 2025

PR Category

User Experience

PR Types

Not User Facing

Description

  • 增加 B005 规则,用于明确删除前缀后缀字符串缀意图

Link:

@gouzil gouzil requested a review from SigureMo as a code owner May 22, 2025 16:38
Copy link

paddle-bot bot commented May 22, 2025

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@@ -97,9 +97,11 @@ def prune_fp16(block, shard, reduced_grads_to_param, ring_ids):
output_name = op.desc.output_arg_names()[0]
# TODO (JZ-LIANG) revise this for uniform mixed parallelism
param_name = (
output_name.strip("@GRAD@MERGED")
output_name.removeprefix("@GRAD@MERGED").removesuffix(
Copy link
Member

Choose a reason for hiding this comment

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

这里 removesuffix 就好,因为老 IR 里这些一定是后缀,或者说这里可以改成

param_name = output_name.removesuffix("@MERGED").removesuffix("@GRAD")

这样就好了,也不用加什么 if

@paddle-bot paddle-bot bot added the contributor External developers label May 22, 2025
@SigureMo SigureMo changed the title [CodeStyle][Ruff] add B005 rule [CodeStyle][Ruff] Introduce rule B005 and fix discovered bugs May 23, 2025
@SigureMo
Copy link
Member

skip-reason: codestyle only

@SigureMo SigureMo merged commit 5d76b02 into PaddlePaddle:develop May 23, 2025
52 of 56 checks passed
@SigureMo SigureMo deleted the ruff/add_B005 branch May 23, 2025 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants