converted all column types to str
Browse files- all2023/val.json +2 -2
- major/test.json +2 -2
- major/train.json +2 -2
- minor/test.json +2 -2
- minor/train.json +2 -2
- preprocess_all2023.py +3 -2
- preprocess_major_minor.py +12 -11
all2023/val.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:791d41446d57c53220d6b9a17324455ec4456c2f99d0a866624ae88707580e7c
|
| 3 |
+
size 276804917
|
major/test.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0410cf07331a5a337e268b3cbd516194e67b4d808c33813fc3771076ceac34f8
|
| 3 |
+
size 216928959
|
major/train.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4b9d8350587ecbea3a6ed80e386c2e12f01983c02dc69947f14cdbb3edaba92c
|
| 3 |
+
size 863959698
|
minor/test.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:604e83967f955123d5b1108dc1f033d19254c57974c836b80d3206a9ac381a44
|
| 3 |
+
size 861534750
|
minor/train.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f8c6a3670aa07476c00783b6478fed26a766f63d077a972052d182b06a2a2980
|
| 3 |
+
size 3413790835
|
preprocess_all2023.py
CHANGED
|
@@ -91,9 +91,10 @@ for i, original_df in tqdm(enumerate(pd.read_csv(file_path, sep='\t', chunksize=
|
|
| 91 |
if df['primary_subfield'].isin(CATEGORY_ALIASES.keys()).sum():
|
| 92 |
ValueError("IMPLEMENT CODE TO CHANGE CATEGORY_ALIASES ")
|
| 93 |
|
|
|
|
| 94 |
if i == 0:
|
| 95 |
-
df.to_json(save_path, lines=True, orient="records", indent=2)
|
| 96 |
else:
|
| 97 |
-
df.to_json(save_path, lines=True, orient="records", mode='a', indent=2)
|
| 98 |
|
| 99 |
# %%
|
|
|
|
| 91 |
if df['primary_subfield'].isin(CATEGORY_ALIASES.keys()).sum():
|
| 92 |
ValueError("IMPLEMENT CODE TO CHANGE CATEGORY_ALIASES ")
|
| 93 |
|
| 94 |
+
# convert all columns to string per huggingface requirements
|
| 95 |
if i == 0:
|
| 96 |
+
df.astype(str).to_json(save_path, lines=True, orient="records", indent=2)
|
| 97 |
else:
|
| 98 |
+
df.astype(str).to_json(save_path, lines=True, orient="records", mode='a', indent=2)
|
| 99 |
|
| 100 |
# %%
|
preprocess_major_minor.py
CHANGED
|
@@ -40,18 +40,18 @@ from tqdm import tqdm
|
|
| 40 |
|
| 41 |
# %%
|
| 42 |
IGNORED_CATEGOREIES = set([
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
])
|
| 47 |
print("number of ignored categories: ", len(IGNORED_CATEGOREIES))
|
| 48 |
CATEGORY_ALIASES = {
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
}
|
| 56 |
print("number of category aliases: ", len(CATEGORY_ALIASES))
|
| 57 |
|
|
@@ -90,9 +90,10 @@ for i, original_df in tqdm(enumerate(pd.read_json(file_path, lines=True, chunksi
|
|
| 90 |
if df['primary_subfield'].isin(CATEGORY_ALIASES.keys()).sum():
|
| 91 |
ValueError("IMPLEMENT CODE TO CHANGE CATEGORY_ALIASES ")
|
| 92 |
|
|
|
|
| 93 |
if i == 0:
|
| 94 |
-
df.to_json(save_path, lines=True, orient="records", indent=2)
|
| 95 |
else:
|
| 96 |
-
df.to_json(save_path, lines=True, orient="records", mode='a', indent=2)
|
| 97 |
|
| 98 |
# %%
|
|
|
|
| 40 |
|
| 41 |
# %%
|
| 42 |
IGNORED_CATEGOREIES = set([
|
| 43 |
+
"atom-ph", "bayes-an", "chao-dyn", "chem-ph", "cmp-lg", "comp-gas", "cond-mat", "dg-ga", "funct-an",
|
| 44 |
+
"mtrl-th", "patt-sol", "plasm-ph", "q-alg", "q-bio", "solv-int", "supr-con", "test", "test.dis-nn",
|
| 45 |
+
"test.mes-hall", "test.mtrl-sci", "test.soft", "test.stat-mech", "test.str-el", "test.supr-con"
|
| 46 |
])
|
| 47 |
print("number of ignored categories: ", len(IGNORED_CATEGOREIES))
|
| 48 |
CATEGORY_ALIASES = {
|
| 49 |
+
'math.MP': 'math-ph',
|
| 50 |
+
'stat.TH': 'math.ST',
|
| 51 |
+
'math.IT': 'cs.IT',
|
| 52 |
+
'q-fin.EC': 'econ.GN',
|
| 53 |
+
'cs.SY': 'eess.SY',
|
| 54 |
+
'cs.NA': 'math.NA'
|
| 55 |
}
|
| 56 |
print("number of category aliases: ", len(CATEGORY_ALIASES))
|
| 57 |
|
|
|
|
| 90 |
if df['primary_subfield'].isin(CATEGORY_ALIASES.keys()).sum():
|
| 91 |
ValueError("IMPLEMENT CODE TO CHANGE CATEGORY_ALIASES ")
|
| 92 |
|
| 93 |
+
# convert all columns to string per huggingface requirements
|
| 94 |
if i == 0:
|
| 95 |
+
df.astype(str).to_json(save_path, lines=True, orient="records", indent=2)
|
| 96 |
else:
|
| 97 |
+
df.astype(str).to_json(save_path, lines=True, orient="records", mode='a', indent=2)
|
| 98 |
|
| 99 |
# %%
|