-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Alter faster to fast in FG #4213
Conversation
Thanks for your contribution! |
Codecov Report
@@ Coverage Diff @@
## develop #4213 +/- ##
===========================================
- Coverage 36.32% 36.30% -0.02%
===========================================
Files 419 419
Lines 59244 59223 -21
===========================================
- Hits 21521 21503 -18
+ Misses 37723 37720 -3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
convert to Draft since this is still under testing |
Fix #4238 one by one... |
@@ -541,7 +541,7 @@ def generate( | |||
num_return_sequences=1, | |||
diversity_rate=0.0, | |||
use_cache=True, | |||
use_faster=False, | |||
use_fast=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
对之前的使用最好还是兼容一段时间并且给出deprecated的warning,之后再完全移除掉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
model.generate()
这里这么搞有点问题,我们的 repo 里面 log 打印的设置有点问题,如果设置全局的 warning filter,在任意 action
设置下,都不会有 warning 打印出来;如果在 def generate()
里面设置 filter,在任意设置下都会打印 warning,即,没法做到仅打印一次,而是每一次前向都会打印。
根据 generate()
预期的使用场景,这样会导致 log 爆炸。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
对于使用logging/logger时重复log的问题的避免 tokenizer_utils中有参考,增加flag通过flag来判断是否已经打印过
if not self.deprecation_warnings.get("max_len_sentences_pair", False):
logger.warning(
"Setting 'max_len_sentences_pair' is now deprecated. This value is automatically set up."
)
self.deprecation_warnings["max_len_sentences_pair"] = True
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
另外正常使用 warnings.warn
也会只打印一次,对于使用 warnings.warn
不打印的情况,还请 @wawltor @sijunhe 看看是否调整下咱们 Taskflow中的warnings的全局设置 https://github.com/PaddlePaddle/PaddleNLP/blob/develop/paddlenlp/taskflow/taskflow.py#L47
warnings.simplefilter(action="ignore", category=Warning, lineno=0, append=False)
当前的设置可能会对其他使用 warnings
的地方造成些干扰
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个simplefilter我不太清楚历史原因,还是由得@wawltor 解答
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已通过新增 self.deprecated_warnings
的方式控制打印的次数。
cpp, cuda还有各种范例, doc里面直接faster -> fast, 我觉得是ok的. 在python端的model.generate()里面,是不是可以做一下向后兼容?例如
如果只在generate被调用的顶上做一次warning, 是不是就没有log爆炸的问题? |
上面我的 comment 说的就是在 |
Co-authored-by: Sijun He <sijun.he@hotmail.com>
PR types
Breaking changes
PR changes
Others
Description
Alter faster to fast in FG.
当前 PR 存在不兼容升级:
model.generate()
中use_faster
参数会修改成use_fast
load("FasterTransformer")
->load("FastGeneration")
修复以下 BUG: