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

[CodeStyle][task 1] enable Ruff UP032 rule with . except python/paddle/base #57409

Merged
merged 8 commits into from
Sep 22, 2023

Conversation

Liyulingyue
Copy link
Contributor

PR types

Others

PR changes

Others

Description

#57367 task1

@Liyulingyue
Copy link
Contributor Author

@gouzil

@gouzil
Copy link
Member

gouzil commented Sep 16, 2023

你这也没修呀

ruff check . --statistics
871	UP032	[*] Use f-string instead of `format` call

@SigureMo SigureMo changed the title [CodeStyle][task 1] enable Ruff UP0032 rule with . except python/paddle/base [CodeStyle][task 1] enable Ruff UP032 rule with . except python/paddle/base Sep 16, 2023
@Liyulingyue
Copy link
Contributor Author

@gouzil

@gouzil
Copy link
Member

gouzil commented Sep 18, 2023

LGTM, 可以等UP018或者UP028的冲突来 rerun ci

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Sep 18, 2023
@luotao1
Copy link
Contributor

luotao1 commented Sep 20, 2023

需要解决冲突

@Liyulingyue
Copy link
Contributor Author

Liyulingyue commented Sep 21, 2023

@gouzil @SigureMo @luotao1 麻烦看看~

Comment on lines -505 to 500
os.environ['PADDLE_TRAINER_ID'] = '{}'.format(
host_endpoints.index(self.curr_host)
)
os.environ[
'PADDLE_TRAINER_ID'
] = f'{host_endpoints.index(self.curr_host)}'
hosts = ','.join(
Copy link
Member

Choose a reason for hiding this comment

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

这玩意是不是可以直接str一下

Comment on lines -558 to +552
os.environ['PADDLE_TRAINER_ID'] = '{}'.format(
sorted_endpoints.index(self.curr_host)
)
os.environ[
'PADDLE_TRAINER_ID'
] = f'{sorted_endpoints.index(self.curr_host)}'
Copy link
Member

Choose a reason for hiding this comment

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

同上

assert fwd_op_id in self._op_fp16_dict, "{}".format(
str(op)
)
assert fwd_op_id in self._op_fp16_dict, f"{str(op)}"
Copy link
Member

Choose a reason for hiding this comment

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

同上

Comment on lines -129 to +137
item_str = '{{:.{}e}}'.format(
DEFAULT_PRINT_OPTIONS.precision
).format(np_var)
item_str = f'{{:.{DEFAULT_PRINT_OPTIONS.precision}e}}'.format(
np_var
)
elif np.ceil(np_var) == np_var:
item_str = f'{np_var:.0f}.'
else:
item_str = '{{:.{}f}}'.format(
DEFAULT_PRINT_OPTIONS.precision
).format(np_var)
item_str = f'{{:.{DEFAULT_PRINT_OPTIONS.precision}f}}'.format(
np_var
)
Copy link
Member

Choose a reason for hiding this comment

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

这两处有点奇怪需要单独看一下

"received tensor_version:{} != wrapper_version_snapshot:{}".format(
1, 0
),
f"received tensor_version:{1} != wrapper_version_snapshot:{0}",
Copy link
Member

Choose a reason for hiding this comment

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

这个文件下的基本都可以写死吧

@gouzil
Copy link
Member

gouzil commented Sep 21, 2023

其余LGTM,在下一个pr修改优化,@SigureMo

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow 🐾

等 CI 通过即可

@luotao1 luotao1 merged commit f092028 into PaddlePaddle:develop Sep 22, 2023
27 checks passed
@Liyulingyue Liyulingyue deleted the up32_2 branch September 23, 2023 16:09
Frida-a pushed a commit to Frida-a/Paddle that referenced this pull request Oct 14, 2023
…le/base` (PaddlePaddle#57409)

* update up032

* update up032

* Update api_gen.py

* Update api_gen.py

* Update sampcd_processor_utils.py
jiahy0825 pushed a commit to jiahy0825/Paddle that referenced this pull request Oct 16, 2023
…le/base` (PaddlePaddle#57409)

* update up032

* update up032

* Update api_gen.py

* Update api_gen.py

* Update sampcd_processor_utils.py
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
…le/base` (PaddlePaddle#57409)

* update up032

* update up032

* Update api_gen.py

* Update api_gen.py

* Update sampcd_processor_utils.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants