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

[few-shot] Add RGL implementation to examples #2651

Merged
merged 10 commits into from
Jul 11, 2022

Conversation

LemonNoel
Copy link
Contributor

@LemonNoel LemonNoel commented Jun 27, 2022

PR types

New features

PR changes

Models

Description

  • Add the implementation of RGL accepted by the Findings of NAACL 2022.
  • Provide the scripts for reproduction.
  • Update the README.

evaluate(model, test_loader, metric_fn, template, verbalizer)


def parse_arguments():
Copy link
Collaborator

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 铺平

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已将arguments parser移到import下边并铺平。

from data import load_dataset, InputFeatures
from utils import set_seed, check_args, convert_example, create_dataloader, LinearSchedulerWarmup


Copy link
Collaborator

Choose a reason for hiding this comment

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

加上paddle.no_grad

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ptuning.py文件已移除,相关实现之后放在PromptTrainer的example中。

'sts-b': PearsonAndSpearman()
})


Copy link
Collaborator

Choose a reason for hiding this comment

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

paddle.no_grad

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已增加。

args = parser.parse_args()

check_args(args)

Copy link
Collaborator

Choose a reason for hiding this comment

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

有个疑问,在RGL的实现code里面为什么要加Ptuning的复现代码了?

Copy link
Contributor Author

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)
Copy link
Collaborator

Choose a reason for hiding this comment

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

看起来是可以直接代码直接卸载template里面,因为这个是example而不是library

Copy link
Contributor Author

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.
Copy link
Collaborator

Choose a reason for hiding this comment

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

和 template类似

Copy link
Contributor Author

Choose a reason for hiding this comment

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

同上。

@LemonNoel LemonNoel marked this pull request as ready for review July 11, 2022 09:28
@LemonNoel LemonNoel changed the title [prompt] add rgl model [few-shot] Add RGL implementation to examples Jul 11, 2022
wawltor
wawltor previously approved these changes Jul 11, 2022
Copy link
Collaborator

@wawltor wawltor left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@wawltor wawltor left a comment

Choose a reason for hiding this comment

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

LGTM

@LemonNoel LemonNoel merged commit 2ced97a into PaddlePaddle:develop Jul 11, 2022
@LemonNoel LemonNoel deleted the prompt branch November 10, 2022 14:36
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