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

[Pre-Training] ERNIE-CW pre-training tasks docs. #3111

Merged
merged 57 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
9f92b4a
add ernie-large config
ZHUI May 7, 2022
7243573
update
ZHUI May 7, 2022
8dace3d
update clue finetune.
ZHUI May 18, 2022
80c4ac9
unused delete.
ZHUI May 19, 2022
8921177
update
ZHUI May 25, 2022
e5dfcac
fix pretraining bugs and support for load no weights configs.
ZHUI May 31, 2022
c229380
support no nsp for enrie.
ZHUI Jun 2, 2022
c5c4828
fix evaluation
ZHUI Jun 2, 2022
c6f406d
fix amp o2 save_dtype bugs.
ZHUI Jun 14, 2022
c9b991c
extand ernie.
ZHUI Jun 27, 2022
e6fd720
fix ernie pretrain with ## vocab.
ZHUI Jun 28, 2022
815cae4
extend vocab
ZHUI Jun 28, 2022
eed89ec
Merge remote-tracking branch 'origin/add-ernie-1.0-base-zh' into enha…
ZHUI Jun 28, 2022
70c4189
support custom tokenizer.
ZHUI Jun 28, 2022
50d39c5
add some comments.
ZHUI Jun 29, 2022
95a67ba
fix bugs.
ZHUI Jun 29, 2022
21cbc7f
add comments.
ZHUI Jun 29, 2022
c6d6c72
fix bug.
ZHUI Jun 29, 2022
de24d7b
fix run_pretrain_static logging.
ZHUI Jul 2, 2022
0ff8c8f
fix all gather.
ZHUI Jul 5, 2022
994db93
fix a100
ZHUI Jul 5, 2022
a18f621
fix
ZHUI Jul 6, 2022
54a821f
fix bugs
ZHUI Jul 7, 2022
9942c37
fix save
ZHUI Jul 8, 2022
9184419
tmp commit for pre-process.
ZHUI Aug 9, 2022
dc4d299
Update README.md
ZHUI Aug 12, 2022
c1fc1e1
Update README.md
ZHUI Aug 12, 2022
21a5788
add amp o1 support
ZHUI Aug 9, 2022
8af8082
ernie cw readme.
ZHUI Aug 22, 2022
fc1b395
Merge remote-tracking branch 'origin/develop' into pretrain_doc_opt
ZHUI Aug 22, 2022
3dbb34f
fix
ZHUI Aug 22, 2022
4bbd3fb
throw error when dataset is invalid.
ZHUI Aug 24, 2022
93b89a0
update document.
ZHUI Aug 24, 2022
0dcc64a
Merge remote-tracking branch 'origin/ZHUI-patch-1' into pretrain_doc_opt
ZHUI Aug 25, 2022
d565fb4
refine readme.
ZHUI Aug 25, 2022
17e216e
Merge remote-tracking branch 'origin/develop' into pretrain_doc_opt
ZHUI Aug 25, 2022
2b55c66
fix
ZHUI Aug 25, 2022
666be57
refactor
ZHUI Aug 26, 2022
8639e62
refator2
ZHUI Aug 26, 2022
a6c08df
Add pre-training introduction.
ZHUI Aug 29, 2022
0d0c23b
update image width.
ZHUI Aug 29, 2022
4096e46
refine doc
ZHUI Aug 30, 2022
7f7b4e0
fit table width.
ZHUI Aug 30, 2022
68caef0
fix c++ style
ZHUI Aug 30, 2022
c355c51
fix table
ZHUI Aug 30, 2022
8629207
refine docs
ZHUI Aug 30, 2022
7afe8f4
refine model_zoo/ernie-1.0/README.md
ZHUI Sep 1, 2022
1805538
readfine readme.
ZHUI Sep 1, 2022
5f8f0c5
Merge branch 'develop' into pretrain_doc_opt
ZHUI Sep 1, 2022
c0b6479
fix link
ZHUI Sep 1, 2022
2628e41
Merge remote-tracking branch 'zhui/pretrain_doc_opt' into pretrain_do…
ZHUI Sep 1, 2022
4ac204f
fix bug
ZHUI Sep 2, 2022
02e35a5
fix documents.
ZHUI Sep 7, 2022
e86664a
add weight.
ZHUI Sep 8, 2022
24f3b5e
Merge remote-tracking branch 'origin/develop' into pretrain_doc_opt
ZHUI Sep 8, 2022
5f02216
Merge branch 'develop' into pretrain_doc_opt
ZHUI Sep 8, 2022
a7ff81d
fix config
ZHUI Sep 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions .copyright.hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals

import argparse
import io
import re
import sys
import os
import datetime

COPYRIGHT = '''Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.'''

def _generate_copyright(comment_mark):
copyright=COPYRIGHT.split(os.linesep)
header = copyright[0].rstrip()

p = re.search('(\d{4})', header).group(0)
now = datetime.datetime.now()

header = header.replace(p,str(now.year))

ans=[comment_mark + " " + header + os.linesep]
for idx, line in enumerate(copyright[1:]):
ans.append(comment_mark + " " + line.rstrip() + os.linesep)

return ans

def _get_comment_mark(path):
lang_type=re.compile(r"\.(py|sh)$")
if lang_type.search(path) is not None:
return "#"

lang_type=re.compile(r"\.(h|c|hpp|cc|cpp|cu|go|cuh|proto)$")
if lang_type.search(path) is not None:
return "//"

return None


RE_ENCODE = re.compile(r"^[ \t\v]*#.*?coding[:=]", re.IGNORECASE)
RE_COPYRIGHT = re.compile(r".*Copyright \(c\) \d{4}", re.IGNORECASE)
RE_SHEBANG = re.compile(r"^[ \t\v]*#[ \t]?\!")

def _check_copyright(path):
head=[]
try:
with open(path) as f:
head = [next(f) for x in range(4)]
except StopIteration:
pass

for idx, line in enumerate(head):
if RE_COPYRIGHT.search(line) is not None:
return True

return False

def generate_copyright(path, comment_mark):
original_contents = io.open(path, encoding="utf-8").readlines()
head = original_contents[0:4]

insert_line_no=0
for i, line in enumerate(head):
if RE_ENCODE.search(line) or RE_SHEBANG.search(line):
insert_line_no=i+1

copyright = _generate_copyright(comment_mark)
if insert_line_no == 0:
new_contents = copyright
if len(original_contents) > 0 and len(original_contents[0].strip()) != 0:
new_contents.append(os.linesep)
new_contents.extend(original_contents)
else:
new_contents=original_contents[0:insert_line_no]
new_contents.append(os.linesep)
new_contents.extend(copyright)
if len(original_contents) > insert_line_no and len(original_contents[insert_line_no].strip()) != 0:
new_contents.append(os.linesep)
new_contents.extend(original_contents[insert_line_no:])
new_contents="".join(new_contents)

with io.open(path, 'w') as output_file:
output_file.write(new_contents)



def main(argv=None):
parser = argparse.ArgumentParser(
description='Checker for copyright declaration.')
parser.add_argument('filenames', nargs='*', help='Filenames to check')
args = parser.parse_args(argv)

retv = 0
for path in args.filenames:
comment_mark = _get_comment_mark(path)
if comment_mark is None:
print("warning:Unsupported file", path, file=sys.stderr)
continue

if _check_copyright(path):
continue

generate_copyright(path, comment_mark)


if __name__ == '__main__':
exit(main())
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ repos:
files: \.md$
- id: remove-tabs
files: \.md$
- repo: local
hooks:
- id: copyright_checker
name: copyright_checker
entry: python .copyright.hook
language: system
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|xpu|kps|py|sh)$
54 changes: 46 additions & 8 deletions examples/benchmark/clue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,51 @@
<td style="text-align:center;">
<span style="font-size:18px;">C<sup>3</sup></span>
</td>
</tr> <tr>
<td rowspan=3 align=center> 24L1024H </td>
<td style="text-align:center">
<span style="font-size:18px">ERNIE 1.0-Large-zh-CW</span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>79.03</b></span>
</td>
<td style="text-align:center">
<span style="font-size:18px">75.97</span>
</td>
<td style="text-align:center">
<span style="font-size:18px">59.65</span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>62.91</b></span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>85.09</b></span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>81.73</b></span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>93.09</b></span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>84.53</b></span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>74.22/91.88</b></span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>88.57</b></span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>84.54</b></span>
</td>
</tr>
<tr>
<td rowspan=2 align=center> 24L1024H </td>
<td style="text-align:center">
<span style="font-size:18px">ERNIE 2.0-Large-zh</span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>77.03</b></span>
<span style="font-size:18px">77.03</span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>76.41</b></span>
Expand All @@ -89,16 +126,16 @@
<span style="font-size:18px">83.82</span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>79.69</b></span>
<span style="font-size:18px">79.69</span>
</td>
<td style="text-align:center">
<span style="font-size:18px">89.14</span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>84.10</b></span>
<span style="font-size:18px">84.10</span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>71.48/90.35</b></span>
<span style="font-size:18px">71.48/90.35</span>
</td>
<td style="text-align:center">
<span style="font-size:18px">85.52</span>
Expand All @@ -124,13 +161,13 @@
<span style="font-size:18px">62.02</span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>83.88</b></span>
<span style="font-size:18px">83.88</span>
</td>
<td style="text-align:center">
<span style="font-size:18px">78.81</span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>90.79</b></span>
<span style="font-size:18px">90.79</span>
</td>
<td style="text-align:center">
<span style="font-size:18px">83.67</span>
Expand All @@ -139,7 +176,7 @@
<span style="font-size:18px">70.58/89.82</span>
</td>
<td style="text-align:center">
<span style="font-size:18px"><b>85.72</b></span>
<span style="font-size:18px">85.72</span>
</td>
<td style="text-align:center">
<span style="font-size:18px">75.26</span>
Expand Down Expand Up @@ -1154,6 +1191,7 @@ AFQMC(语义相似度)、TNEWS(文本分类)、IFLYTEK(长文本分类

| Model | AFQMC | TNEWS | IFLYTEK | CMNLI | OCNLI | CLUEWSC2020 | CSL | CMRC2018 | CHID | C<sup>3</sup> |
| -------------------------------- | ------- | ------- | ------- | -------- | -------- | ----------- | ------- | -------- | ------- | ------------- |
| ERNIE 1.0-Large-zh-cw | 2e-5,64 | 3e-5,32 | 5e-5,16 | 2e-5,16 | 2e-5,32 | 1e-5,32 | 1e-5,16 | 2e-5,24 | 1e-5,24 | 2e-5,32 |
| ERNIE 3.0-Xbase-zh | 2e-5,16 | 3e-5,32 | 3e-5,32 | 3e-5,64 | 3e-5,64 | 2e-5,32 | 1e-5,16 | 3e-5,24 | 2e-5,24 | 3e-5,24 |
| ERNIE 2.0-Large-zh | 1e-5,32 | 3e-5,64 | 3e-5,32 | 2e-5,32 | 1e-5,16 | 3e-5,32 | 1e-5,64 | 2e-5,24 | 2e-5,24 | 3e-5,32 |
| HFL/RoBERTa-wwm-ext-large | 1e-5,32 | 3e-5,32 | 2e-5,32 | 1e-5,16 | 1e-5,16 | 2e-5,16 | 2e-5,16 | 3e-5,32 | 1e-5,24 | 2e-5,24 |
Expand Down
Loading