Spaces:
Sleeping
Sleeping
ronald
commited on
Commit
·
43aea8d
1
Parent(s):
11e7cd1
coh mech
Browse files- ccl_win.py +3 -2
ccl_win.py
CHANGED
|
@@ -132,6 +132,7 @@ class ccl_win(evaluate.Measurement):
|
|
| 132 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 133 |
|
| 134 |
results = []
|
|
|
|
| 135 |
aggregator = None
|
| 136 |
if use_aggregator:
|
| 137 |
np.random.seed(42)
|
|
@@ -158,8 +159,8 @@ class ccl_win(evaluate.Measurement):
|
|
| 158 |
#
|
| 159 |
|
| 160 |
offset = 0
|
| 161 |
-
for _len in len_by_sample:
|
| 162 |
-
score = float(np.mean(scores[offset:offset+_len]))
|
| 163 |
if use_aggregator:
|
| 164 |
aggregator.add_scores({"loc_coh_ccl": score})
|
| 165 |
else:
|
|
|
|
| 132 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 133 |
|
| 134 |
results = []
|
| 135 |
+
sent_lens = [len(x.split("\n")) for x in predictions]
|
| 136 |
aggregator = None
|
| 137 |
if use_aggregator:
|
| 138 |
np.random.seed(42)
|
|
|
|
| 159 |
#
|
| 160 |
|
| 161 |
offset = 0
|
| 162 |
+
for i,_len in enumerate(len_by_sample):
|
| 163 |
+
score = float(np.mean(scores[offset:offset+_len])) if sent_lens[i]>1 else 0.
|
| 164 |
if use_aggregator:
|
| 165 |
aggregator.add_scores({"loc_coh_ccl": score})
|
| 166 |
else:
|