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

PaddlePaddle Hackathon 56 提交 #1088

Merged
merged 25 commits into from Nov 9, 2021
Merged

PaddlePaddle Hackathon 56 提交 #1088

merged 25 commits into from Nov 9, 2021

Conversation

JunnYu
Copy link
Member

@JunnYu JunnYu commented Sep 24, 2021

Task: #1074

  • 权重文件等百度云上传,链接:https://pan.baidu.com/s/1dyaOShLEgnL_RJW4sbs40g 提取码:kayr。
  • 模型中有的layernorm未设置eps=1e-5。
  • 删除GPTEmbeddingspaddle.ParamAttr的name属性,设置了话会报错,提示说重复使用了相同的名字,单元测试无法通过,jupyter notebook中无法重复初始化。
  • 添加compare.py比较转换后的模型预测结果。(该文件所处位置等审核通过后再修改)。
  • 添加convert.py转换脚本。(该文件所处位置等审核通过后再修改)。
  • microsoft-DialoGPT-small转换后的误差有点大,问题与之前的应该类似,其他的两个模型转换后误差正常。(使用了相同的转换代码,因此不存在转换时代码的错误。)
  • 添加GPTForTokenClassification, GPTForSequenceClassification这2个类,并添加注释。
  • 添加单元测试代码。TestElectraForSequenceClassification,TestGPTForTokenClassification。
  • 转换代码时候并未添加lm_head.weight,因为是它是与word embedding绑定的,所以没必要转换它,如果有需要可自行修改。

@ZHUI ZHUI self-requested a review September 26, 2021 02:36
paddlenlp/transformers/gpt/modeling.py Outdated Show resolved Hide resolved
@yingyibiao
Copy link
Contributor

merges.txt也通过百度云上传

@JunnYu
Copy link
Member Author

JunnYu commented Sep 27, 2021

@yingyibiao baidu网盘包含merges.txt,现在已经删除community/junnyu所有文件。

@yingyibiao
Copy link
Contributor

yingyibiao commented Oct 13, 2021

@yingyibiao baidu网盘包含merges.txt,现在已经删除community/junnyu所有文件。
还是需要在community/junnyu中上传相关文件,具体可以参考:
https://paddlenlp.readthedocs.io/zh/latest/community/contribute_models/contribute_awesome_pretrained_models.html

@JunnYu JunnYu requested a review from ZHUI October 13, 2021 16:25
@yingyibiao
Copy link
Contributor

Task: #1074

  • 权重文件等百度云上传,链接:https://pan.baidu.com/s/1dyaOShLEgnL_RJW4sbs40g 提取码:kayr。
  • 模型中有的layernorm未设置eps=1e-5。
  • 删除GPTEmbeddingspaddle.ParamAttr的name属性,设置了话会报错,提示说重复使用了相同的名字,单元测试无法通过,jupyter notebook中无法重复初始化。
  • 添加compare.py比较转换后的模型预测结果。(该文件所处位置等审核通过后再修改)。
  • 添加convert.py转换脚本。(该文件所处位置等审核通过后再修改)。
  • microsoft-DialoGPT-small转换后的误差有点大,问题与之前的应该类似,其他的两个模型转换后误差正常。(使用了相同的转换代码,因此不存在转换时代码的错误。)
  • 添加GPTForTokenClassification, GPTForSequenceClassification这2个类,并添加注释。
  • 添加单元测试代码。TestElectraForSequenceClassification,TestGPTForTokenClassification。
  • 转换代码时候并未添加lm_head.weight,因为是它是与word embedding绑定的,所以没必要转换它,如果有需要可自行修改。

权重已上传至bos

@yingyibiao
Copy link
Contributor

参照 #1085 的review意见修改类似问题~

@yingyibiao
Copy link
Contributor

顺便将 DialoGPT-medium,DialoGPT-large 这两个权重也导入~

@yingyibiao
Copy link
Contributor

Copy link
Contributor

@ZHUI ZHUI left a comment

Choose a reason for hiding this comment

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

非常不错!
GPTForTokenClassification GPTForSequenceClassification 是否也能给 https://github.com/PaddlePaddle/PaddleNLP/blob/develop/examples/language_model/gpt/ 中添加一些实际使用的例子

paddlenlp/transformers/gpt/modeling.py Outdated Show resolved Hide resolved
paddlenlp/transformers/gpt/modeling.py Show resolved Hide resolved
return logits


class GPTForSequenceClassification(GPTPretrainedModel):
Copy link
Contributor

Choose a reason for hiding this comment

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

GPTForTokenClassification
GPTForSequenceClassification
这两个东西能否加一个例子到 https://github.com/PaddlePaddle/PaddleNLP/blob/develop/examples/language_model/gpt/

Copy link
Member Author

@JunnYu JunnYu Oct 22, 2021

Choose a reason for hiding this comment

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

GPTForTokenClassificationBertForTokenClassification基本一样的,只是模型不需要输入token type id.

GPTForSequenceClassification 现已完成

Copy link
Member Author

Choose a reason for hiding this comment

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

现已添加使用GPTForTokenClassification进行NER的例子,发现效果很差。

@JunnYu
Copy link
Member Author

JunnYu commented Oct 22, 2021

1634901105

@JunnYu
Copy link
Member Author

JunnYu commented Oct 22, 2021

@yingyibiao
large和medium的权重在这
链接:https://pan.baidu.com/s/1cdqfjHVrE6CwBvYW5692rg
提取码:83jh

docs/model_zoo/transformers.rst Outdated Show resolved Hide resolved
docs/model_zoo/transformers.rst Outdated Show resolved Hide resolved
@yingyibiao
Copy link
Contributor

@yingyibiao
large和medium的权重在这
链接:https://pan.baidu.com/s/1cdqfjHVrE6CwBvYW5692rg
提取码:83jh

已上传~

@yingyibiao
Copy link
Contributor

LGTM for community related files

@yingyibiao yingyibiao requested a review from ZHUI October 25, 2021 01:55
Copy link
Contributor

@ZHUI ZHUI left a comment

Choose a reason for hiding this comment

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

LGTM

Precision | 0.484939 |
Recall | 0.634716 |
F1 | 0.549810 |

Copy link
Contributor

Choose a reason for hiding this comment

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

这效果感觉可能有些偏低。

@ZeyuChen ZeyuChen added this to In progress in PaddleNLP v2.2 via automation Nov 2, 2021

基于`gpt-cpm-small-cn-distill`在MSRA的NER任务上Fine-tuning后,在验证集上有如下结果:

Metric | Result |
Copy link
Member

Choose a reason for hiding this comment

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

GPT可以解决TokenClassification问题这个事有相关paper佐证吗?@ZHUI

Copy link
Contributor

@yingyibiao yingyibiao left a comment

Choose a reason for hiding this comment

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

LGTM

PaddleNLP v2.2 automation moved this from In progress to Reviewer approved Nov 9, 2021
@yingyibiao yingyibiao merged commit 844f24c into PaddlePaddle:develop Nov 9, 2021
PaddleNLP v2.2 automation moved this from Reviewer approved to Done Nov 9, 2021
@JunnYu JunnYu deleted the update_gpt branch November 9, 2021 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants