Download 2_Relation_Extraction-master/utils.py from Dorothydu/gitrepo_20: direct link, hf CLI and curl.
- Browser
- Download file 317 Bytes
-
https://huggingface.co/datasets/Dorothydu/gitrepo_20/resolve/main/2_Relation_Extraction-master/utils.py
- Command line
-
hf download hf://datasets/Dorothydu/gitrepo_20/2_Relation_Extraction-master/utils.py
-
curl -L -o utils.py https://huggingface.co/datasets/Dorothydu/gitrepo_20/resolve/main/2_Relation_Extraction-master/utils.py
317 Bytes
| from sklearn.metrics import accuracy_score | |
| # 평가를 위한 metrics function. | |
| def compute_metrics(pred): | |
| labels = pred.label_ids | |
| preds = pred.predictions.argmax(-1) | |
| # calculate accuracy using sklearn's function | |
| acc = accuracy_score(labels, preds) | |
| return { | |
| 'accuracy': round(acc, 4) | |
| } |