Spaces:
Sleeping
Sleeping
left in manual test for progress bar
Browse files
tests.py
CHANGED
@@ -472,6 +472,36 @@ class TestSemNCG(unittest.TestCase):
|
|
472 |
documents = ["There was a cat on a mat."]
|
473 |
print(f"Case: Empty String Input\n{_call_metric(predictions, references, documents, tokenize_sentences)}\n")
|
474 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
|
476 |
if __name__ == '__main__':
|
477 |
unittest.main(verbosity=2)
|
|
|
472 |
documents = ["There was a cat on a mat."]
|
473 |
print(f"Case: Empty String Input\n{_call_metric(predictions, references, documents, tokenize_sentences)}\n")
|
474 |
|
475 |
+
def _test_check_verbose(self):
|
476 |
+
"""UNUSED: previously used to manually check the progress bar
|
477 |
+
|
478 |
+
This test should not be used since they rely on files that are
|
479 |
+
not kept in version control. this is purely just left here for
|
480 |
+
historical purposes and has the '_' prepended to the function
|
481 |
+
name to avoid being executed.
|
482 |
+
"""
|
483 |
+
import sqlite3
|
484 |
+
import string
|
485 |
+
|
486 |
+
con = sqlite3.connect('sem_ncg_samples.db')
|
487 |
+
cur = con.cursor()
|
488 |
+
data = cur.execute(
|
489 |
+
'SELECT * FROM sem_ncg_samples').fetchmany(100)
|
490 |
+
data = list(filter(
|
491 |
+
lambda x: x[0].translate(
|
492 |
+
str.maketrans('', '', string.punctuation)
|
493 |
+
).strip() != '',
|
494 |
+
data
|
495 |
+
))
|
496 |
+
preds, refs, docs = list(zip(*data))
|
497 |
+
result = self.metric.compute(
|
498 |
+
predictions=preds, references=refs,
|
499 |
+
documents=docs, verbose=True,
|
500 |
+
gpu=2
|
501 |
+
)
|
502 |
+
|
503 |
+
breakpoint()
|
504 |
+
|
505 |
|
506 |
if __name__ == '__main__':
|
507 |
unittest.main(verbosity=2)
|