Datasets:
Tasks:
Token Classification
Modalities:
Text
Sub-tasks:
named-entity-recognition
Languages:
English
Size:
100K - 1M
ArXiv:
License:
Delete loading script auxiliary file
Browse files- get_model_list.py +0 -89
get_model_list.py
DELETED
|
@@ -1,89 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
import os
|
| 3 |
-
import requests
|
| 4 |
-
|
| 5 |
-
import pandas as pd
|
| 6 |
-
|
| 7 |
-
dataset_link = "[`tweetner7`](https://huggingface.co/datasets/tner/tweetner7)"
|
| 8 |
-
metric_dir = 'metric_files'
|
| 9 |
-
os.makedirs(metric_dir, exist_ok=True)
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
def lm_link(_model): return f"[`{_model}`](https://huggingface.co/{_model})"
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
def model_link(_model, _type): return f"[`tner/{_model}-tweetner7-{_type}`](https://huggingface.co/tner/{_model}-tweetner7-{_type})"
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
def download(_model, _type):
|
| 19 |
-
url = f"https://huggingface.co/tner/{_model}-tweetner7-{_type}/raw/main/eval"
|
| 20 |
-
filename = f"{metric_dir}/{_model}-{_type}.json"
|
| 21 |
-
print(url, filename)
|
| 22 |
-
try:
|
| 23 |
-
with open(filename) as f:
|
| 24 |
-
return json.load(f)
|
| 25 |
-
except Exception:
|
| 26 |
-
tmp = {}
|
| 27 |
-
for metric in ["metric.test_2021", "metric.test_2020", "metric_span.test_2021", "metric_span.test_2020"]:
|
| 28 |
-
year = metric[-4:]
|
| 29 |
-
if metric not in tmp:
|
| 30 |
-
_metric = json.loads(requests.get(f"{url}/{metric}.json").content)
|
| 31 |
-
if '_span' in metric:
|
| 32 |
-
tmp[f"Entity-Span F1 ({year})"] = round(100 * _metric["micro/f1"], 2)
|
| 33 |
-
else:
|
| 34 |
-
tmp[f"Micro F1 ({year})"] = round(100 * _metric["micro/f1"], 2)
|
| 35 |
-
tmp[f"Macro F1 ({year})"] = round(100 * _metric["macro/f1"], 2)
|
| 36 |
-
tmp.update({f"F1 ({year})/{k}": round(100 * v['f1'], 2) for k, v in _metric["per_entity_metric"].items()})
|
| 37 |
-
with open(filename, "w") as f:
|
| 38 |
-
json.dump(tmp, f)
|
| 39 |
-
return tmp
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
lms = [
|
| 43 |
-
"roberta-large",
|
| 44 |
-
"roberta-base",
|
| 45 |
-
"cardiffnlp/twitter-roberta-base-2019-90m",
|
| 46 |
-
"cardiffnlp/twitter-roberta-base-dec2020",
|
| 47 |
-
"cardiffnlp/twitter-roberta-base-dec2021"
|
| 48 |
-
"vinai/bertweet-large",
|
| 49 |
-
"vinai/bertweet-base",
|
| 50 |
-
"bert-large",
|
| 51 |
-
"bert-base"
|
| 52 |
-
]
|
| 53 |
-
|
| 54 |
-
types = [
|
| 55 |
-
["all", "continuous", "2021", "2020"],
|
| 56 |
-
["random"],
|
| 57 |
-
[
|
| 58 |
-
"selflabel2020",
|
| 59 |
-
"selflabel2021",
|
| 60 |
-
"2020-selflabel2020-all",
|
| 61 |
-
"2020-selflabel2021-all",
|
| 62 |
-
"selflabel2020-continuous",
|
| 63 |
-
"selflabel2021-continuous"
|
| 64 |
-
]
|
| 65 |
-
]
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
for tt in types:
|
| 69 |
-
metrics = []
|
| 70 |
-
for t in tt:
|
| 71 |
-
for lm in lms:
|
| 72 |
-
|
| 73 |
-
if 'selflabel' in t and lm != "roberta-large":
|
| 74 |
-
continue
|
| 75 |
-
_lm_link = lm_link(lm)
|
| 76 |
-
lm = os.path.basename(lm)
|
| 77 |
-
_model_link = model_link(lm, t)
|
| 78 |
-
__metric = {
|
| 79 |
-
"Model (link)": model_link(lm, t),
|
| 80 |
-
"Data": dataset_link,
|
| 81 |
-
"Language Model": _lm_link
|
| 82 |
-
}
|
| 83 |
-
__metric.update(download(lm, t))
|
| 84 |
-
metrics.append(__metric)
|
| 85 |
-
|
| 86 |
-
df = pd.DataFrame(metrics)
|
| 87 |
-
print(tt)
|
| 88 |
-
print(df.to_markdown(index=False))
|
| 89 |
-
print()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|