-
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
pretrainedModel add gconfig #6915
Conversation
Thanks for your contribution! |
Codecov Report
@@ Coverage Diff @@
## develop #6915 +/- ##
===========================================
- Coverage 59.92% 59.87% -0.06%
===========================================
Files 547 552 +5
Lines 81009 81452 +443
===========================================
+ Hits 48546 48770 +224
- Misses 32463 32682 +219
|
llm/predictor.py
Outdated
@@ -41,6 +41,7 @@ | |||
PretrainedModel, | |||
PretrainedTokenizer, | |||
) | |||
from paddlenlp.transformers.generation_utils import GenerationConfig |
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.
尽量从paddlenlp.generation 路径import, 后续paddlenlp.transformers.generation_utils 逐渐废弃
from paddlenlp.generation.configuration_utils import * # noqa: F401, F403 | ||
from paddlenlp.generation.logits_process import * # noqa: F401, F403 | ||
from paddlenlp.generation.stopping_criteria import * # noqa: F401, F403 | ||
from paddlenlp.generation.streamers import * # noqa: F401, F403 | ||
from paddlenlp.generation.utils import * # noqa: F401, F403 |
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.
可不可以直接废弃调transformers/generation_utils? 后续都从transformers/generation import?
llm/utils.py
Outdated
@@ -26,6 +26,7 @@ | |||
from sklearn.metrics import accuracy_score | |||
|
|||
from paddlenlp.datasets import InTokensIterableDataset | |||
from paddlenlp.generation import GenerationConfig |
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.
这个不着急改,需要向后兼容一点时间,保持原有api
llm/utils.py
Outdated
generation_config=GenerationConfig( | ||
max_new_token=self.data_args.tgt_length, | ||
decode_strategy="sampling", | ||
top_k=self.gen_args.top_k, | ||
top_p=self.gen_args.top_p, | ||
bos_token_id=self.tokenizer.bos_token_id, | ||
eos_token_id=self.tokenizer.eos_token_id, | ||
pad_token_id=self.tokenizer.pad_token_id, | ||
use_cache=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.
保持原有api
paddlenlp/generation/utils.py
Outdated
logger.warning("`max_length` will be deprecated in future, use" " `max_new_token` instead.") | ||
generation_config.max_new_token = generation_config.max_length | ||
|
||
if generation_config.min_length != 0 and generation_config.min_new_token == 0: | ||
logger.warning("`min_length` will be deprecated in future, use" " `min_new_token` instead.") |
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.
logger.warning("`max_length` will be deprecated in future, use" " `max_new_token` instead.") | |
generation_config.max_new_token = generation_config.max_length | |
if generation_config.min_length != 0 and generation_config.min_new_token == 0: | |
logger.warning("`min_length` will be deprecated in future, use" " `min_new_token` instead.") | |
logger.warning("`max_length` will be deprecated in future releases, use `max_new_token` instead.") | |
generation_config.max_new_token = generation_config.max_length | |
if generation_config.min_length != 0 and generation_config.min_new_token == 0: | |
logger.warning("`min_length` will be deprecated in future releases, use `min_new_token` instead.") |
@@ -46,6 +46,7 @@ | |||
from paddle.utils.download import is_url as is_remote_url | |||
from tqdm.auto import tqdm | |||
|
|||
from paddlenlp.generation import GenerationConfig, GenerationMixin |
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.
全部替换成relative import
PR types
PR changes
Description
目录结构变动,PretrainedModel 适配 gconfig