-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[few-shot] Add RGL implementation to examples #2651
Conversation
examples/few_shot/RGL/ptuning.py
Outdated
evaluate(model, test_loader, metric_fn, template, verbalizer) | ||
|
||
|
||
def parse_arguments(): |
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.
arguments parser 摞在import下面,同时将argumentss parser 铺平
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.
已将arguments parser移到import下边并铺平。
examples/few_shot/RGL/ptuning.py
Outdated
from data import load_dataset, InputFeatures | ||
from utils import set_seed, check_args, convert_example, create_dataloader, LinearSchedulerWarmup | ||
|
||
|
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.
加上paddle.no_grad
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.
ptuning.py文件已移除,相关实现之后放在PromptTrainer的example中。
examples/few_shot/RGL/rgl.py
Outdated
'sts-b': PearsonAndSpearman() | ||
}) | ||
|
||
|
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.
paddle.no_grad
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.
已增加。
examples/few_shot/RGL/ptuning.py
Outdated
args = parser.parse_args() | ||
|
||
check_args(args) | ||
|
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.
有个疑问,在RGL的实现code里面为什么要加Ptuning的复现代码了?
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.
这部分是当时复现代码一起push上来了,为了避免冗余,更新版本中ptuning.py文件已移除。
}): | ||
super().__init__(tokenizer=tokenizer, | ||
model=model, | ||
text_mapping=text_mapping) |
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.
看起来是可以直接代码直接卸载template里面,因为这个是example而不是library
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.
已将目录下代码整理到template.py文件。
@@ -0,0 +1,196 @@ | |||
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. |
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.
和 template类似
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.
同上。
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.
LGTM
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.
LGTM
PR types
New features
PR changes
Models
Description