Spaces:
Running
Running
seonil
commited on
Commit
•
e744fb3
1
Parent(s):
b5aef9f
README update
Browse files- README.md +5 -9
- harim_plus.py +0 -1
- test_harim_score.py +5 -3
README.md
CHANGED
@@ -25,11 +25,12 @@ Note that this metric is reference-free and do not require training. It is ready
|
|
25 |
## Quick Start
|
26 |
### install
|
27 |
```bash
|
28 |
-
# assumes torch, transformers, pandas, tqdm, fire and datasets are installed
|
29 |
pip install evaluate
|
30 |
-
# pip install -r requirments.txt
|
31 |
```
|
32 |
### example
|
|
|
|
|
|
|
33 |
```python
|
34 |
import evaluate
|
35 |
from pprint import pprint
|
@@ -46,13 +47,8 @@ articles = [art] * len(summaries)
|
|
46 |
|
47 |
scorer = evaluate.load('NCSOFT/harim_plus')
|
48 |
scores = scorer.compute(predictions = summaries, references = articles) # use_aggregator=False, bsz=32, return_details=False, tokenwise_score=False)
|
49 |
-
pprint(scores)
|
50 |
-
>>> [
|
51 |
-
1.5361897945404053,
|
52 |
-
1.806436538696289,
|
53 |
-
1.7360382080078125
|
54 |
-
]
|
55 |
-
|
56 |
```
|
57 |
|
58 |
## Powering HaRiM+ score with other summarization model checkpoints
|
|
|
25 |
## Quick Start
|
26 |
### install
|
27 |
```bash
|
|
|
28 |
pip install evaluate
|
|
|
29 |
```
|
30 |
### example
|
31 |
+
You can clone this space and run <code>python test_harim_score.py [--pretrained_name CKPTNAME_FOR_S2SLM] </code> or try below. <br />
|
32 |
+
(running on CPU is possible, but expected to be too slow for use.)
|
33 |
+
|
34 |
```python
|
35 |
import evaluate
|
36 |
from pprint import pprint
|
|
|
47 |
|
48 |
scorer = evaluate.load('NCSOFT/harim_plus')
|
49 |
scores = scorer.compute(predictions = summaries, references = articles) # use_aggregator=False, bsz=32, return_details=False, tokenwise_score=False)
|
50 |
+
pprint([round(s,4) for s in scores])
|
51 |
+
>>> [2.7096, 3.7338, 2.669, 2.4039, 2.3759]
|
|
|
|
|
|
|
|
|
|
|
52 |
```
|
53 |
|
54 |
## Powering HaRiM+ score with other summarization model checkpoints
|
harim_plus.py
CHANGED
@@ -51,7 +51,6 @@ HaRiM+ is proved effective for benchmarking summarization systems (system-level
|
|
51 |
NOTE that for HaRiM+...
|
52 |
* predictions = summaries (List[str])
|
53 |
* references = articles (List[str])
|
54 |
-
|
55 |
"""
|
56 |
|
57 |
_KWARGS_DESCRIPTION = """
|
|
|
51 |
NOTE that for HaRiM+...
|
52 |
* predictions = summaries (List[str])
|
53 |
* references = articles (List[str])
|
|
|
54 |
"""
|
55 |
|
56 |
_KWARGS_DESCRIPTION = """
|
test_harim_score.py
CHANGED
@@ -81,8 +81,9 @@ SUMM_CHUNKS = [
|
|
81 |
"lisa mcelroy , 50 , who teaches legal writing at drexel university , reportedly did not send the ` inappropriate ' message on march 31 . when recipients clicked the enclosed link , they were allegedly directed to a video of ' a woman engaging in a sexually explicit act ' . mcelroy appeared on the popular game show in 2010 with then-host meredith vieira but lost the game after reaching just $ 12,500 . along with teaching law , mcelroy is also an accomplished author with a number of published biographies and children 's books . has been placed on leave while school investigates .", # negation
|
82 |
]# pos2
|
83 |
]
|
84 |
-
def test():
|
85 |
-
|
|
|
86 |
# scorer = Harimplus_Scorer(pretrained_name='facebook/bart-large-cnn')
|
87 |
table = ['neg_rnn', 'neg_1', 'neg_1_', 'neg2', 'pos1', 'pos2']
|
88 |
keys_neg = ['ref', 'self-gen', 'summary-infactual', 'ref+wrong subj', 'ref+negation']
|
@@ -106,7 +107,6 @@ def test():
|
|
106 |
|
107 |
'''https://arxiv.org/abs/2211.12118
|
108 |
|
109 |
-
tablename='neg_rnn'
|
110 |
|
111 |
tablename='neg_1_' # main
|
112 |
{'ref': 1.7218,
|
@@ -122,6 +122,8 @@ tablename='neg_1'
|
|
122 |
'ref+wrong subj': 3.7903,
|
123 |
'ref+negation': 3.3877,
|
124 |
|
|
|
|
|
125 |
{'ref': 2.7096,
|
126 |
'self-gen': 3.7338,
|
127 |
'summary-infactual': 2.669}
|
|
|
81 |
"lisa mcelroy , 50 , who teaches legal writing at drexel university , reportedly did not send the ` inappropriate ' message on march 31 . when recipients clicked the enclosed link , they were allegedly directed to a video of ' a woman engaging in a sexually explicit act ' . mcelroy appeared on the popular game show in 2010 with then-host meredith vieira but lost the game after reaching just $ 12,500 . along with teaching law , mcelroy is also an accomplished author with a number of published biographies and children 's books . has been placed on leave while school investigates .", # negation
|
82 |
]# pos2
|
83 |
]
|
84 |
+
def test(pretrained_name='facebook/bart-large-cnn'):
|
85 |
+
print(f"you can test other ckpts compatible with transformers.AutoModelForSeq2SeqLM class \n\te.g. \n\t\tpython test.py --pretrained_name Yale-LILY/brio-cnndm-cased")
|
86 |
+
scorer = evaluate.load('NCSOFT/harim_plus', pretrained_name=pretrained_name)
|
87 |
# scorer = Harimplus_Scorer(pretrained_name='facebook/bart-large-cnn')
|
88 |
table = ['neg_rnn', 'neg_1', 'neg_1_', 'neg2', 'pos1', 'pos2']
|
89 |
keys_neg = ['ref', 'self-gen', 'summary-infactual', 'ref+wrong subj', 'ref+negation']
|
|
|
107 |
|
108 |
'''https://arxiv.org/abs/2211.12118
|
109 |
|
|
|
110 |
|
111 |
tablename='neg_1_' # main
|
112 |
{'ref': 1.7218,
|
|
|
122 |
'ref+wrong subj': 3.7903,
|
123 |
'ref+negation': 3.3877,
|
124 |
|
125 |
+
|
126 |
+
tablename='neg_rnn'
|
127 |
{'ref': 2.7096,
|
128 |
'self-gen': 3.7338,
|
129 |
'summary-infactual': 2.669}
|