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

[AutoNLP] add compress #4963

Closed
wants to merge 0 commits into from
Closed

Conversation

lugimzzz
Copy link
Contributor

@lugimzzz lugimzzz commented Feb 23, 2023

PR types

Others

PR changes

APIs

Description

新增压缩和预测

@paddle-bot
Copy link

paddle-bot bot commented Feb 23, 2023

Thanks for your contribution!

@codecov
Copy link

codecov bot commented Feb 23, 2023

Codecov Report

Merging #4963 (2ee9c2d) into develop (f38a255) will increase coverage by 0.05%.
The diff coverage is 92.03%.

@@             Coverage Diff             @@
##           develop    #4963      +/-   ##
===========================================
+ Coverage    47.58%   47.64%   +0.05%     
===========================================
  Files          453      453              
  Lines        65378    65460      +82     
===========================================
+ Hits         31109    31187      +78     
- Misses       34269    34273       +4     
Impacted Files Coverage Δ
paddlenlp/taskflow/text_classification.py 74.01% <66.66%> (+1.85%) ⬆️
paddlenlp/taskflow/task.py 50.65% <88.88%> (+1.86%) ⬆️
...dlenlp/experimental/autonlp/text_classification.py 96.69% <93.67%> (-0.40%) ⬇️
...addlenlp/experimental/autonlp/auto_trainer_base.py 89.68% <100.00%> (+0.08%) ⬆️
paddlenlp/transformers/ernie/modeling.py 85.34% <100.00%> (+0.03%) ⬆️
paddlenlp/utils/downloader.py 65.04% <0.00%> (-0.45%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -104,8 +105,8 @@ def supported_languages(self) -> List[str]:
return ["Chinese", "English"]

@property
def _default_training_argument(self) -> TrainingArguments:
return TrainingArguments(
def _default_training_argument(self) -> CompressionArguments:
Copy link
Collaborator

Choose a reason for hiding this comment

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

我感觉还是先维持TrainingArguments吧,好像现在也没有太用到CompressionArguments里的内容。后续我们看考虑接入trainer.compress的时候,再看CompressionArguments

@@ -240,6 +241,7 @@ def _model_candidates(self) -> List[Dict[str, Any]]:
"trainer_type": "PromptTrainer",
"template.prompt": "{'mask'}{'soft'}“{'text': '" + self.text_column + "'}”",
"early_stopping_patience": 5,
"early_stopping_patience": 5,
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove

@@ -552,29 +558,35 @@ def _preprocess_dataset(
processed_dataset = copy.deepcopy(dataset).map(trans_func, lazy=False)
return processed_dataset

def to_taskflow(self, trial_id=None, export_path=None, batch_size=1, precision="fp32"):
def to_taskflow(
Copy link
Collaborator

Choose a reason for hiding this comment

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

建议当前先把compress和export做成独立的功能。
export -> to_taskflow
compress -> to_taskflow
这两部能不能分开走?即如果一个trial_id已经被export或者compress过了,都可以直接taskflow直接加载推理?

Copy link
Contributor Author

@lugimzzz lugimzzz Feb 27, 2023

Choose a reason for hiding this comment

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

但这么设计,相当于compress出来就只有一个模型,不需要选择。现在只有一个策略没有问题,如果未来有多个策略,那么需要一个可以选择的函数。
我的想法是:train->(compress)->(export[training_path]->taskflow)->export[specify_path],export这个函数是指定路径的,也意味着承载着选择用户最终需要的模型功能。

@sijunhe sijunhe changed the title add compress & predict [AutoNLP] add compress Feb 28, 2023
@lugimzzz lugimzzz closed this Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants