Update for CI (#14)
Browse files* update ci.yaml
* update version of the action steps
* fix bug
* use ruff as a linter
* add settings for ruff
* update JGLUE.py
* update ci.yaml
* remove empty lines
- .github/workflows/ci.yaml +9 -4
- JGLUE.py +31 -34
- poetry.lock +0 -0
- pyproject.toml +9 -5
.github/workflows/ci.yaml
CHANGED
@@ -16,9 +16,11 @@ jobs:
|
|
16 |
python-version: ['3.8', '3.9', '3.10']
|
17 |
|
18 |
steps:
|
19 |
-
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
with:
|
23 |
python-version: ${{ matrix.python-version }}
|
24 |
|
@@ -26,12 +28,15 @@ jobs:
|
|
26 |
run: |
|
27 |
pip install -U pip setuptools wheel poetry
|
28 |
poetry install
|
|
|
29 |
- name: Format
|
30 |
run: |
|
31 |
poetry run black --check .
|
|
|
32 |
- name: Lint
|
33 |
run: |
|
34 |
-
poetry run
|
|
|
35 |
- name: Type check
|
36 |
run: |
|
37 |
poetry run mypy . \
|
|
|
16 |
python-version: ['3.8', '3.9', '3.10']
|
17 |
|
18 |
steps:
|
19 |
+
- name: Checkout
|
20 |
+
uses: actions/checkout@v4
|
21 |
+
|
22 |
+
- name: Setup Python ${{ matrix.python-version }}
|
23 |
+
uses: actions/setup-python@v4
|
24 |
with:
|
25 |
python-version: ${{ matrix.python-version }}
|
26 |
|
|
|
28 |
run: |
|
29 |
pip install -U pip setuptools wheel poetry
|
30 |
poetry install
|
31 |
+
|
32 |
- name: Format
|
33 |
run: |
|
34 |
poetry run black --check .
|
35 |
+
|
36 |
- name: Lint
|
37 |
run: |
|
38 |
+
poetry run ruff check .
|
39 |
+
|
40 |
- name: Type check
|
41 |
run: |
|
42 |
poetry run mypy . \
|
JGLUE.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import json
|
|
|
2 |
import random
|
3 |
import string
|
4 |
import warnings
|
@@ -7,44 +8,40 @@ from typing import Dict, List, Optional, Union
|
|
7 |
import datasets as ds
|
8 |
import pandas as pd
|
9 |
from datasets.tasks import QuestionAnsweringExtractive
|
10 |
-
import logging
|
11 |
|
12 |
logger = logging.getLogger(__name__)
|
13 |
|
14 |
_CITATION = """\
|
15 |
-
@inproceedings{kurihara-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
year = "2022",
|
23 |
-
address = "Marseille, France",
|
24 |
-
publisher = "European Language Resources Association",
|
25 |
-
url = "https://aclanthology.org/2022.lrec-1.317",
|
26 |
-
pages = "2957--2966",
|
27 |
-
abstract = "To develop high-performance natural language understanding (NLU) models, it is necessary to have a benchmark to evaluate and analyze NLU ability from various perspectives. While the English NLU benchmark, GLUE, has been the forerunner, benchmarks are now being released for languages other than English, such as CLUE for Chinese and FLUE for French; but there is no such benchmark for Japanese. We build a Japanese NLU benchmark, JGLUE, from scratch without translation to measure the general NLU ability in Japanese. We hope that JGLUE will facilitate NLU research in Japanese.",
|
28 |
}
|
29 |
|
30 |
-
@
|
31 |
-
|
32 |
-
|
33 |
-
booktitle
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
37 |
}
|
38 |
"""
|
39 |
|
40 |
_DESCRIPTION = """\
|
41 |
-
JGLUE, Japanese General Language Understanding Evaluation,
|
|
|
|
|
42 |
"""
|
43 |
|
44 |
_HOMEPAGE = "https://github.com/yahoojapan/JGLUE"
|
45 |
|
46 |
_LICENSE = """\
|
47 |
-
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License
|
48 |
"""
|
49 |
|
50 |
_DESCRIPTION_CONFIGS = {
|
@@ -59,10 +56,10 @@ _URLS = {
|
|
59 |
"MARC-ja": {
|
60 |
"data": "https://s3.amazonaws.com/amazon-reviews-pds/tsv/amazon_reviews_multilingual_JP_v1_00.tsv.gz",
|
61 |
"filter_review_id_list": {
|
62 |
-
"valid": "https://raw.githubusercontent.com/yahoojapan/JGLUE/main/preprocess/marc-ja/data/filter_review_id_list/valid.txt"
|
63 |
},
|
64 |
"label_conv_review_id_list": {
|
65 |
-
"valid": "https://raw.githubusercontent.com/yahoojapan/JGLUE/main/preprocess/marc-ja/data/label_conv_review_id_list/valid.txt"
|
66 |
},
|
67 |
},
|
68 |
"JSTS": {
|
@@ -84,7 +81,7 @@ _URLS = {
|
|
84 |
}
|
85 |
|
86 |
|
87 |
-
def dataset_info_jsts() -> ds.
|
88 |
features = ds.Features(
|
89 |
{
|
90 |
"sentence_pair_id": ds.Value("string"),
|
@@ -103,7 +100,7 @@ def dataset_info_jsts() -> ds.Features:
|
|
103 |
)
|
104 |
|
105 |
|
106 |
-
def dataset_info_jnli() -> ds.
|
107 |
features = ds.Features(
|
108 |
{
|
109 |
"sentence_pair_id": ds.Value("string"),
|
@@ -125,7 +122,7 @@ def dataset_info_jnli() -> ds.Features:
|
|
125 |
)
|
126 |
|
127 |
|
128 |
-
def dataset_info_jsquad() -> ds.
|
129 |
features = ds.Features(
|
130 |
{
|
131 |
"id": ds.Value("string"),
|
@@ -155,7 +152,7 @@ def dataset_info_jsquad() -> ds.Features:
|
|
155 |
)
|
156 |
|
157 |
|
158 |
-
def dataset_info_jcommonsenseqa() -> ds.
|
159 |
features = ds.Features(
|
160 |
{
|
161 |
"q_id": ds.Value("int64"),
|
@@ -180,7 +177,7 @@ def dataset_info_jcommonsenseqa() -> ds.Features:
|
|
180 |
)
|
181 |
|
182 |
|
183 |
-
def dataset_info_marc_ja() -> ds.
|
184 |
features = ds.Features(
|
185 |
{
|
186 |
"sentence": ds.Value("string"),
|
@@ -525,11 +522,11 @@ class JGLUE(ds.GeneratorBasedBuilder):
|
|
525 |
|
526 |
return [
|
527 |
ds.SplitGenerator(
|
528 |
-
name=ds.Split.TRAIN,
|
529 |
gen_kwargs={"split_df": split_dfs["train"]},
|
530 |
),
|
531 |
ds.SplitGenerator(
|
532 |
-
name=ds.Split.VALIDATION,
|
533 |
gen_kwargs={"split_df": split_dfs["valid"]},
|
534 |
),
|
535 |
]
|
@@ -538,11 +535,11 @@ class JGLUE(ds.GeneratorBasedBuilder):
|
|
538 |
file_paths = dl_manager.download_and_extract(_URLS[self.config.name])
|
539 |
return [
|
540 |
ds.SplitGenerator(
|
541 |
-
name=ds.Split.TRAIN,
|
542 |
gen_kwargs={"file_path": file_paths["train"]},
|
543 |
),
|
544 |
ds.SplitGenerator(
|
545 |
-
name=ds.Split.VALIDATION,
|
546 |
gen_kwargs={"file_path": file_paths["valid"]},
|
547 |
),
|
548 |
]
|
|
|
1 |
import json
|
2 |
+
import logging
|
3 |
import random
|
4 |
import string
|
5 |
import warnings
|
|
|
8 |
import datasets as ds
|
9 |
import pandas as pd
|
10 |
from datasets.tasks import QuestionAnsweringExtractive
|
|
|
11 |
|
12 |
logger = logging.getLogger(__name__)
|
13 |
|
14 |
_CITATION = """\
|
15 |
+
@inproceedings{kurihara-lrec-2022-jglue,
|
16 |
+
title={JGLUE: Japanese general language understanding evaluation},
|
17 |
+
author={Kurihara, Kentaro and Kawahara, Daisuke and Shibata, Tomohide},
|
18 |
+
booktitle={Proceedings of the Thirteenth Language Resources and Evaluation Conference},
|
19 |
+
pages={2957--2966},
|
20 |
+
year={2022},
|
21 |
+
url={https://aclanthology.org/2022.lrec-1.317/}
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
}
|
23 |
|
24 |
+
@inproceedings{kurihara-nlp-2022-jglue,
|
25 |
+
title={JGLUE: 日本語言語理解ベンチマーク},
|
26 |
+
author={栗原健太郎 and 河原大輔 and 柴田知秀},
|
27 |
+
booktitle={言語処理学会第28回年次大会},
|
28 |
+
pages={2023--2028},
|
29 |
+
year={2022},
|
30 |
+
url={https://www.anlp.jp/proceedings/annual_meeting/2022/pdf_dir/E8-4.pdf},
|
31 |
+
note={in Japanese}
|
32 |
}
|
33 |
"""
|
34 |
|
35 |
_DESCRIPTION = """\
|
36 |
+
JGLUE, Japanese General Language Understanding Evaluation, \
|
37 |
+
is built to measure the general NLU ability in Japanese. JGLUE has been constructed \
|
38 |
+
from scratch without translation. We hope that JGLUE will facilitate NLU research in Japanese.\
|
39 |
"""
|
40 |
|
41 |
_HOMEPAGE = "https://github.com/yahoojapan/JGLUE"
|
42 |
|
43 |
_LICENSE = """\
|
44 |
+
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.\
|
45 |
"""
|
46 |
|
47 |
_DESCRIPTION_CONFIGS = {
|
|
|
56 |
"MARC-ja": {
|
57 |
"data": "https://s3.amazonaws.com/amazon-reviews-pds/tsv/amazon_reviews_multilingual_JP_v1_00.tsv.gz",
|
58 |
"filter_review_id_list": {
|
59 |
+
"valid": "https://raw.githubusercontent.com/yahoojapan/JGLUE/main/preprocess/marc-ja/data/filter_review_id_list/valid.txt",
|
60 |
},
|
61 |
"label_conv_review_id_list": {
|
62 |
+
"valid": "https://raw.githubusercontent.com/yahoojapan/JGLUE/main/preprocess/marc-ja/data/label_conv_review_id_list/valid.txt",
|
63 |
},
|
64 |
},
|
65 |
"JSTS": {
|
|
|
81 |
}
|
82 |
|
83 |
|
84 |
+
def dataset_info_jsts() -> ds.DatasetInfo:
|
85 |
features = ds.Features(
|
86 |
{
|
87 |
"sentence_pair_id": ds.Value("string"),
|
|
|
100 |
)
|
101 |
|
102 |
|
103 |
+
def dataset_info_jnli() -> ds.DatasetInfo:
|
104 |
features = ds.Features(
|
105 |
{
|
106 |
"sentence_pair_id": ds.Value("string"),
|
|
|
122 |
)
|
123 |
|
124 |
|
125 |
+
def dataset_info_jsquad() -> ds.DatasetInfo:
|
126 |
features = ds.Features(
|
127 |
{
|
128 |
"id": ds.Value("string"),
|
|
|
152 |
)
|
153 |
|
154 |
|
155 |
+
def dataset_info_jcommonsenseqa() -> ds.DatasetInfo:
|
156 |
features = ds.Features(
|
157 |
{
|
158 |
"q_id": ds.Value("int64"),
|
|
|
177 |
)
|
178 |
|
179 |
|
180 |
+
def dataset_info_marc_ja() -> ds.DatasetInfo:
|
181 |
features = ds.Features(
|
182 |
{
|
183 |
"sentence": ds.Value("string"),
|
|
|
522 |
|
523 |
return [
|
524 |
ds.SplitGenerator(
|
525 |
+
name=ds.Split.TRAIN, # type: ignore
|
526 |
gen_kwargs={"split_df": split_dfs["train"]},
|
527 |
),
|
528 |
ds.SplitGenerator(
|
529 |
+
name=ds.Split.VALIDATION, # type: ignore
|
530 |
gen_kwargs={"split_df": split_dfs["valid"]},
|
531 |
),
|
532 |
]
|
|
|
535 |
file_paths = dl_manager.download_and_extract(_URLS[self.config.name])
|
536 |
return [
|
537 |
ds.SplitGenerator(
|
538 |
+
name=ds.Split.TRAIN, # type: ignore
|
539 |
gen_kwargs={"file_path": file_paths["train"]},
|
540 |
),
|
541 |
ds.SplitGenerator(
|
542 |
+
name=ds.Split.VALIDATION, # type: ignore
|
543 |
gen_kwargs={"file_path": file_paths["valid"]},
|
544 |
),
|
545 |
]
|
poetry.lock
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
pyproject.toml
CHANGED
@@ -1,10 +1,9 @@
|
|
1 |
[tool.poetry]
|
2 |
name = "huggingface-datasets-jglue"
|
3 |
version = "0.1.0"
|
4 |
-
description = ""
|
5 |
authors = ["Shunsuke KITADA <shunsuke.kitada.0831@gmail.com>"]
|
6 |
readme = "README.md"
|
7 |
-
packages = []
|
8 |
|
9 |
[tool.poetry.dependencies]
|
10 |
python = "^3.8"
|
@@ -14,14 +13,19 @@ mecab-python3 = "^1.0.6"
|
|
14 |
pyknp = "^0.6.1"
|
15 |
mojimoji = "^0.0.12"
|
16 |
|
17 |
-
|
18 |
[tool.poetry.group.dev.dependencies]
|
|
|
19 |
black = "^23.1.0"
|
20 |
-
isort = "^5.12.0"
|
21 |
-
flake8 = "^6.0.0"
|
22 |
mypy = "^1.0.1"
|
23 |
pytest = "^7.2.1"
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
[build-system]
|
26 |
requires = ["poetry-core"]
|
27 |
build-backend = "poetry.core.masonry.api"
|
|
|
1 |
[tool.poetry]
|
2 |
name = "huggingface-datasets-jglue"
|
3 |
version = "0.1.0"
|
4 |
+
description = "Dataset loading script for JGLUE: Japanese General Language Understanding Evaluation"
|
5 |
authors = ["Shunsuke KITADA <shunsuke.kitada.0831@gmail.com>"]
|
6 |
readme = "README.md"
|
|
|
7 |
|
8 |
[tool.poetry.dependencies]
|
9 |
python = "^3.8"
|
|
|
13 |
pyknp = "^0.6.1"
|
14 |
mojimoji = "^0.0.12"
|
15 |
|
|
|
16 |
[tool.poetry.group.dev.dependencies]
|
17 |
+
ruff = "^0.0.241"
|
18 |
black = "^23.1.0"
|
|
|
|
|
19 |
mypy = "^1.0.1"
|
20 |
pytest = "^7.2.1"
|
21 |
|
22 |
+
[tool.ruff]
|
23 |
+
target-version = "py38"
|
24 |
+
# select = ["ALL"]
|
25 |
+
ignore = [
|
26 |
+
"E501", # line too long, handled by black
|
27 |
+
]
|
28 |
+
|
29 |
[build-system]
|
30 |
requires = ["poetry-core"]
|
31 |
build-backend = "poetry.core.masonry.api"
|